summaryrefslogtreecommitdiff
path: root/sub/busybox/Makefile
blob: cb5ef8b8fd02995ebb2f50ecd01d9671b25367b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Version from 2024-07-14
BUSYBOX_VERSION := 371fe9f71d445d18be28c82a2a6d82115c8af19d

clean-busybox:
	rm -f $(OUTPUT)/sources/.lh_bb_cloned
	rm -rf $(OUTPUT)/sources/busybox
	rm -f $(OUTPUT)/sources/.lh_bb_dled
	rm -rf $(OUTPUT)/build-$(TRIPLE)/.lh_bb_*
	rm -rf $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)


$(OUTPUT)/sources/.lh_bb_cloned: | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/sources/busybox
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources git clone git://git.busybox.net/busybox
	exec setuidgid $(NORMALUSER) touch $@

$(OUTPUT)/sources/.lh_bb_dled: $(OUTPUT)/sources/.lh_bb_cloned | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources/busybox git checkout $(BUSYBOX_VERSION)
	exec setuidgid $(NORMALUSER) touch $@


$(OUTPUT)/build-$(TRIPLE)/.lh_bb_copied: $(OUTPUT)/sources/.lh_bb_dled | $(OUTPUT)/build-build/.lh_skarnet_installed $(OUTPUT)/tmp/.lh_prepared
	exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)
	exec setuidgid $(NORMALUSER) s6-hiercopy $(OUTPUT)/sources/busybox $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)/.config: $(OUTPUT)/build-$(TRIPLE)/.lh_bb_copied sub/busybox/host-full-config | $(OUTPUT)/build-build/.lh_skarnet_installed $(OUTPUT)/tmp/.lh_prepared
ifeq ($(TARGET_STATIC),true)
	exec setuidgid $(NORMALUSER) redirfd -w 1 $@ sed -e 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' $(WD)/sub/busybox/host-full-config
else
	exec setuidgid $(NORMALUSER) cp -f $(WD)/sub/busybox/host-full-config $@
endif

$(OUTPUT)/build-$(TRIPLE)/.lh_bb_built: $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)/.config $(OUTPUT)/build-$(TRIPLE)/.lh_skarnet_installed | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION) $(MAKE) -j1 busybox install CROSS_COMPILE=$(TRIPLE)- CC="$(TARGET_CC)" HOSTCC="$(BUILD_CC)"
	exec setuidgid $(NORMALUSER) s6-touch $@

$(OUTPUT)/build-$(TRIPLE)/.lh_bb_installed: $(OUTPUT)/build-$(TRIPLE)/.lh_bb_built $(OUTPUT)/tmp/.lh_layout_installed | $(OUTPUT)/build-build/.lh_skarnet_installed
	exec s6-rmrf $(OUTPUT)/rootfs/opt/busybox-$(BUSYBOX_VERSION)
	exec cp -RP $(OUTPUT)/build-$(TRIPLE)/busybox-$(BUSYBOX_VERSION)/_install $(OUTPUT)/rootfs/opt/busybox-$(BUSYBOX_VERSION)
	exec makenamelink $(OUTPUT)/rootfs/opt busybox busybox-$(BUSYBOX_VERSION) $(OUTPUT)/tmp
	exec makelinks $(OUTPUT)/rootfs /bin /opt/busybox/bin
	exec makelinks $(OUTPUT)/rootfs /bin /opt/busybox/sbin
	exec setuidgid $(NORMALUSER) s6-touch $@