blob: 7e8e7b2eaacc620bcbe2ed9ec89a8584de21e220 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "Toybox combines common utilities together into a single executable."
2HOMEPAGE = "http://www.landley.net/toybox/"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08003DEPENDS = "attr virtual/crypt"
Brad Bishop316dfdd2018-06-25 12:45:53 -04004
5LICENSE = "BSD-0-Clause"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511"
7
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz \
9 file://OE-path-changes.patch \
10 "
Brad Bishop316dfdd2018-06-25 12:45:53 -040011SRC_URI[md5sum] = "a8bb502a1be941f06dd2644fff25f547"
12SRC_URI[sha256sum] = "3ada450ac1eab1dfc352fee915ea6129b9a4349c1885f1394b61bd2d89a46c04"
13
14SECTION = "base"
15
16TOYBOX_BIN = "generated/unstripped/toybox"
17
18EXTRA_OEMAKE = 'HOSTCC="${BUILD_CC}" CPUS=${@oe.utils.cpu_count()}'
19
20do_configure() {
21 oe_runmake defconfig
22
23 # Disable killall5 as it isn't managed by update-alternatives
24 sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config
25
26 # Disable swapon as it doesn't handle the '-a' argument used during boot
27 sed -e 's/CONFIG_SWAPON=y/# CONFIG_SWAPON is not set/' -i .config
28}
29
30do_compile() {
31 oe_runmake ${TOYBOX_BIN}
32
33 # Create a list of links needed
34 ${BUILD_CC} -I . scripts/install.c -o generated/instlist
35 ./generated/instlist long | sed -e 's#^#/#' > toybox.links
36}
37
38do_install() {
39 # Install manually instead of using 'make install'
40 install -d ${D}${base_bindir}
41 if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then
42 install -m 4755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox
43 else
44 install -m 0755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox
45 fi
46
47 install -d ${D}${sysconfdir}
48 install -m 0644 ${B}/toybox.links ${D}${sysconfdir}
49}
50
51inherit update-alternatives
52
53# If you've chosen to install toybox you probably want it to take precedence
54# over busybox where possible but not over other packages
55ALTERNATIVE_PRIORITY = "60"
56
57python do_package_prepend () {
58 # Read links from /etc/toybox.links and create appropriate
59 # update-alternatives variables
60
61 dvar = d.getVar('D')
62 pn = d.getVar('PN')
63 target = "/bin/toybox"
64
65 f = open('%s/etc/toybox.links' % (dvar), 'r')
66 for alt_link_name in f:
67 alt_link_name = alt_link_name.strip()
68 alt_name = os.path.basename(alt_link_name)
69 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
70 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
71 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
72 f.close()
73}