source: trunk/debian/buildenv/buildenv.mk @ 675

Last change on this file since 675 was 675, checked in by amain, 4 years ago

Add Jessie support. Allow skipping cross-compiling of DebWrt Debian packages.

File size: 2.6 KB
Line 
1# DebWrt - Debian on Embedded devices
2#
3# Copyright (C) 2010-2015 Johan van Zoomeren <amain@debwrt.net>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18debian/buildenv/create: debian/buildenv/prepare
19        touch $@
20
21debian/buildenv/prepare:
22        mkdir -p $(DEBIAN_BUILD_DIR)
23        # Due to various bugs in debootstrap in combination with fakechroot it is not
24        # possible to create a fakechroot here - and therefore we need to use chroot
25        # with sudo
26        #fakeroot fakechroot debootstrap
27                                                #--variant=fakechroot
28        sudo debootstrap    --include=$(subst $(space),$(empty),$(CONFIG_DEBIAN_BUILDENV_INCLUDE_PACKAGES)) \
29                                            $(DEBIAN_BUILD_VERSION) \
30                                                $(DEBIAN_BUILD_DIR) \
31                                                $(CONFIG_DEBIAN_BUILDENV_REPOSITORY)
32        sudo bash -c "echo 127.0.0.1 `hostname -s` localhost >$(DEBIAN_BUILD_DIR)/etc/hosts"
33        sudo bash -c "echo debwrt-$(TARGET_ARCH)-$(DEBIAN_BUILD_VERSION) > $(DEBIAN_BUILD_DIR)/etc/debian_chroot"
34        sudo bash -c "echo syntax on >$(DEBIAN_BUILD_DIR)/etc/vimrc"
35        sudo bash -c "echo 0 > /proc/sys/vm/mmap_min_addr" # for ARM targets
36        sudo bash -c "echo \"deb $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
37        sudo bash -c "echo \"deb-src $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
38        sudo chown $(USER):$(GROUP) $(DEBIAN_BUILD_DIR)/usr/src
39        sudo chroot $(DEBIAN_BUILD_DIR) apt-get update
40        sudo chroot $(DEBIAN_BUILD_DIR) groupadd -g $(shell id -g) debwrt
41        sudo chroot $(DEBIAN_BUILD_DIR) useradd -g debwrt -s /bin/bash -m -u $(shell id -u) $$USER
42        sudo mkdir -p $(DEBIAN_BUILD_DIR)/etc/sudoers.d
43        sudo bash -c "echo \"$(USER) ALL=(ALL) NOPASSWD: ALL\" >$(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt"
44        sudo chmod 0440 $(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt
45        touch $@
46
47debian/buildenv/clean: debian/buildenv/qemu-clean debian/buildenv/emdebian-clean
48        # sudo should not be needed if fakechroot would have worked
49        sudo rm -rf $(DEBIAN_BUILD_DIR)
50        rm -f debian/buildenv/prepare
51        rm -f debian/buildenv/create
52
53.PHONY: debian/buildenv/clean
54
Note: See TracBrowser for help on using the repository browser.