libgcrypt: restore BBCLASSEXTEND
[openembedded.git] / recipes / busybox / busybox_1.3.1.bb
1 require busybox.inc
2
3 PR = "${INC_PR}.1"
4
5 DEFAULT_PREFERENCE = "-1"
6
7 SRC_URI = "\
8         http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
9         file://defconfig"
10 SRC_URI[tarball.md5sum] = "571531cfa83726947ccb566de017ad4f"
11 SRC_URI[tarball.sha256sum] = "5bf9ead9cca99620d2e56ddf79fdf5fb306fd7f30087b5556e0956e3b1948206"
12
13 do_configure () {
14         install -m 0644 ${WORKDIR}/defconfig ${S}/.config.oe
15
16         echo "CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"" > ${S}/.config
17         echo "USING_CROSS_COMPILER=y" >> ${S}/.config
18
19         sed -e  '/CROSS_COMPILER_PREFIX/d' \
20             -e  '/USING_CROSS_COMPILER/d' \
21                 '${S}/.config.oe' >>'${S}/.config'
22         cml1_do_configure
23 }
24
25 do_install () {
26         install -d ${D}${sysconfdir}/init.d
27         oe_runmake "PREFIX=${D}" install
28         cp -pPR ${S}/_install/* ${D}/
29
30         # Move everything to /busybox (not supposed to end up in any package)
31         install -d ${D}/busybox
32         ls ${D} -R
33
34         cp -dPr ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
35         # Move the busybox binary back to /bin
36         install -d ${D}${base_bindir}
37         mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
38         # Move back the sh symlink
39         test -h ${D}/busybox${base_bindir}/sh && mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
40
41         install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
42         install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
43         if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
44                 # Move crond back to /usr/sbin/crond
45                 install -d ${D}${sbindir}
46                 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
47
48                 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
49         fi
50         if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
51                 # Move httpd back to /usr/sbin/httpd
52                 install -d ${D}${sbindir}
53                 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
54
55                 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
56                 install -d ${D}/srv/www
57         fi
58         if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
59                 # Move udhcpd back to /usr/sbin/udhcpd
60                 install -d ${D}${sbindir}
61                 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
62
63                 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
64         fi
65         if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
66                 # Move hwclock back to /sbin/hwclock
67                 install -d ${D}${base_sbindir}
68                 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
69
70                 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
71         fi
72         if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
73                 # Move dhcpc back to /usr/sbin/udhcpc
74                 install -d ${D}${base_sbindir}
75                 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
76
77                 install -d ${D}${sysconfdir}/udhcpc.d
78                 install -d ${D}${datadir}/udhcpc
79                 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
80                 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
81         fi
82
83         install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
84 }
85
86 pkg_prerm_${PN} () {
87         # This is so you can make busybox commit suicide - removing busybox with no other packages
88         # providing its files, this will make update-alternatives work, but the update-rc.d part
89         # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
90         tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
91         ln -s /bin/busybox $tmpdir/[
92         ln -s /bin/busybox $tmpdir/test
93         ln -s /bin/busybox $tmpdir/head
94         ln -s /bin/busybox $tmpdir/sh
95         ln -s /bin/busybox $tmpdir/basename
96         ln -s /bin/busybox $tmpdir/echo
97         ln -s /bin/busybox $tmpdir/mv
98         ln -s /bin/busybox $tmpdir/ln
99         ln -s /bin/busybox $tmpdir/dirname
100         ln -s /bin/busybox $tmpdir/rm
101         ln -s /bin/busybox $tmpdir/sed
102         ln -s /bin/busybox $tmpdir/sort
103         export PATH=$PATH:$tmpdir
104         while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; sh /usr/bin/update-alternatives --remove $bn $to; done </etc/busybox.links
105 }