wok-6.x view busybox/receipt @ rev 12755

busybox: handle ARCH and build for Aarmv6
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 12 04:20:53 2012 +0200 (2012-05-12)
parents 908c9bb70b66
children 198bdfe3af18
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.20.0"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-i486 is not compatible with aufs 8("
9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
10 WEB_SITE="http://www.busybox.net/"
11 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
12 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf /etc/resolv.conf /etc/httpd.conf"
14 DEPENDS="slitaz-base-files glibc-base ncurses-common"
15 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486"
17 case "$ARCH" in
18 arm) BUILD_DEPENDS="bzip2" ;;
19 esac
21 apply_bb_patchs()
22 {
23 cd $src
24 while read file; do
25 [ -f done.$file ] && continue
26 echo "Apply $file..."
27 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
28 touch done.$file
29 done <<EOT
30 tar.u
31 stat.u
32 ris.u
33 zmodules.u
34 printable.u
35 cmdline.u
36 su-nochdir.u
37 diff.u
38 getty.u
39 EOT
40 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
41 }
43 # Rules to compile & install the temporary toolchain.
44 cook_tmp_toolchain()
45 {
46 { stuff=${stuff:-../stuff}
47 apply_bb_patchs &&
48 make oldconfig &&
49 make &&
50 make CONFIG_PREFIX=/tools install
51 } || return 1
52 echo "Chmod 4755 on busybox binary..."
53 chmod 4755 /tools/bin/busybox
54 }
56 # Cook Busybox
57 cook_bb()
58 {
59 { apply_bb_patchs &&
60 make oldconfig &&
61 make && make install
62 } || return 1
63 }
64 # Rules to configure and make the package.
65 compile_rules()
66 {
67 case "$ARCH" in
68 arm)
69 export CROSS_COMPILE=$HOST_SYSTEM-
70 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
71 cook_bb
72 chmod 4755 $src/_install/bin/busybox ;;
73 x86_64) echo "TODO" ;;
74 i?86)
75 cook_bb
76 strip --strip-unneeded \
77 -R .eh_frame -R .eh_frame_hdr \
78 $src/_install/bin/busybox
80 # prepare busybox-pam package
81 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
82 make oldconfig && make || return 1
83 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
84 mv busybox busybox-pam
86 # prepare busybox-static package
87 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
88 make oldconfig && make || return 1
89 mv busybox busybox-static
91 # prepare ssfs-busybox package
92 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
93 mkdir -p $rootfs/etc
94 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
95 make oldconfig && make busybox &&
96 make CONFIG_PREFIX=$rootfs install || return 1
97 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
98 chown -R 0.0 $rootfs/etc
99 chmod 0600 $rootfs/etc/busybox.conf
100 chmod 4755 $rootfs/bin/busybox ;;
101 esac
102 }
104 # Cross compilation check.
105 testsuite()
106 {
107 readelf -h $src/_install/bin/busybox
108 }
110 # Rules to gen a SliTaz package suitable for Tazpkg.
111 genpkg_rules()
112 {
113 cp -a $src/_install/* $fs
114 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
115 mkdir -p $fs/etc/init.d $fs/var
117 # Busybox config files.
118 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf zcip.script
119 do
120 cp $stuff/$f $fs/etc
121 done
122 chown -R 0.0 $fs/etc
123 chmod 600 $fs/etc/busybox.conf
124 touch $fs/etc/resolv.conf
126 # Daemon scripts.
127 cp $stuff/daemon $fs/etc/init.d
128 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
129 for i in $DAEMON; do
130 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
131 ln -s daemon $fs/etc/init.d/$i
132 done
133 rm $fs/linuxrc
134 mkdir -p $fs/etc/modprobe.d
136 # Udhcpc stuff.
137 mkdir -p $fs/usr/share/udhcpc
138 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
139 chmod +x $fs/usr/share/udhcpc/default.script
141 # Httpd stuff.
142 cp -a $stuff/www $fs/var
143 }
145 # GNU utils stuff.
146 pre_install()
147 {
148 local i
149 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
150 answer=""
151 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
152 [ -f $1$i ] || continue
153 case "$i" in
154 /bin/busybox) continue ;;
155 *bin/*) ;;
156 *) continue ;;
157 esac
158 if [ -z "$answer" ]; then
159 echo -n "Keep installed GNU utilities ? "
160 read -t 30 answer # by default: keep
161 case "$answer" in
162 n*|N*) break;;
163 *) answer="Y";;
164 esac
165 fi
166 cp -a $1$i $1$i-busybox-install
167 done
168 }
170 post_install()
171 {
172 local i
173 [ -f /etc/resolv.conf-busybox-install ] &&
174 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
175 while read i ; do
176 [ -f $1$i-busybox-install ] || continue
177 mv $1$i-busybox-install $1$i
178 done < $1$INSTALLED/$PACKAGE/files.list
179 chmod 4755 $1/bin/busybox
181 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
182 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
183 echo '# Domain name server options.' >> $root/etc/daemons.conf
184 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
185 echo '' >> $root/etc/daemons.conf
186 fi
187 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
188 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
189 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
190 echo '' >> $root/etc/daemons.conf
191 fi
192 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
193 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
194 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
195 echo '' >> $root/etc/daemons.conf
196 fi
197 }
199 pre_remove()
200 {
201 # We can not remove this package !
202 exit 1
203 }