diff options
Diffstat (limited to 'meta-oe/recipes-core/toybox/toybox_git.bb')
-rw-r--r-- | meta-oe/recipes-core/toybox/toybox_git.bb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/toybox/toybox_git.bb b/meta-oe/recipes-core/toybox/toybox_git.bb new file mode 100644 index 000000000..08f971573 --- /dev/null +++ b/meta-oe/recipes-core/toybox/toybox_git.bb | |||
@@ -0,0 +1,75 @@ | |||
1 | SUMMARY = "Toybox combines common utilities together into a single executable." | ||
2 | HOMEPAGE = "http://www.landley.net/toybox/" | ||
3 | DEPENDS = "attr" | ||
4 | |||
5 | LICENSE = "BSD-0-Clause" | ||
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511" | ||
7 | |||
8 | PV = "0.7.4+git${SRCPV}" | ||
9 | |||
10 | SRCREV = "78289203031afc23585035c362beec10db54958d" | ||
11 | SRC_URI = "git://github.com/landley/toybox;protocol=https \ | ||
12 | " | ||
13 | |||
14 | S = "${WORKDIR}/git" | ||
15 | |||
16 | SECTION = "base" | ||
17 | |||
18 | TOYBOX_BIN = "generated/unstripped/toybox" | ||
19 | |||
20 | EXTRA_OEMAKE = 'HOSTCC="${BUILD_CC}" CPUS=${@oe.utils.cpu_count()}' | ||
21 | |||
22 | do_configure() { | ||
23 | oe_runmake defconfig | ||
24 | |||
25 | # Disable killall5 as it isn't managed by update-alternatives | ||
26 | sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config | ||
27 | |||
28 | # Disable swapon as it doesn't handle the '-a' argument used during boot | ||
29 | sed -e 's/CONFIG_SWAPON=y/# CONFIG_SWAPON is not set/' -i .config | ||
30 | } | ||
31 | |||
32 | do_compile() { | ||
33 | oe_runmake ${TOYBOX_BIN} | ||
34 | |||
35 | # Create a list of links needed | ||
36 | ${BUILD_CC} -I . scripts/install.c -o generated/instlist | ||
37 | ./generated/instlist long | sed -e 's#^#/#' > toybox.links | ||
38 | } | ||
39 | |||
40 | do_install() { | ||
41 | # Install manually instead of using 'make install' | ||
42 | install -d ${D}${base_bindir} | ||
43 | if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then | ||
44 | install -m 4755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox | ||
45 | else | ||
46 | install -m 0755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox | ||
47 | fi | ||
48 | |||
49 | install -d ${D}${sysconfdir} | ||
50 | install -m 0644 ${B}/toybox.links ${D}${sysconfdir} | ||
51 | } | ||
52 | |||
53 | inherit update-alternatives | ||
54 | |||
55 | # If you've chosen to install toybox you probably want it to take precedence | ||
56 | # over busybox where possible but not over other packages | ||
57 | ALTERNATIVE_PRIORITY = "60" | ||
58 | |||
59 | python do_package_prepend () { | ||
60 | # Read links from /etc/toybox.links and create appropriate | ||
61 | # update-alternatives variables | ||
62 | |||
63 | dvar = d.getVar('D') | ||
64 | pn = d.getVar('PN') | ||
65 | target = "/bin/toybox" | ||
66 | |||
67 | f = open('%s/etc/toybox.links' % (dvar), 'r') | ||
68 | for alt_link_name in f: | ||
69 | alt_link_name = alt_link_name.strip() | ||
70 | alt_name = os.path.basename(alt_link_name) | ||
71 | d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name) | ||
72 | d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name) | ||
73 | d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target) | ||
74 | f.close() | ||
75 | } | ||