wok view busybox/receipt @ rev 12879

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