wok view busybox/receipt @ rev 15142

bmpanel2: typo
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Aug 15 11:41:58 2013 +0000 (2013-08-15)
parents a4254bd509cd
children 73d80d561b42
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.21.1"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
10 WEB_SITE="http://www.busybox.net/"
11 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
12 HOST_ARCH="i486 arm"
14 DEPENDS="slitaz-base-files glibc-base ncurses-common"
15 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \
16 musl-libc-dev dietlibc"
18 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
19 /etc/resolv.conf /etc/httpd.conf"
20 AUFS_NOT_RAMFS="uclibc-cross-compiler-i486 is not compatible with aufs+tmpfs 8("
22 # Handle cross compilation
23 case "$ARCH" in
24 arm) BUILD_DEPENDS="bzip2" ;;
25 esac
27 # Busybox patches
28 apply_bb_patchs()
29 {
30 cd $src
31 while read file; do
32 [ -f done.$file ] && continue
33 echo "Apply $file..."
34 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
35 touch done.$file
36 done <<EOT
37 tar.u
38 stat.u
39 ris.u
40 zmodules.u
41 printable.u
42 cmdline.u
43 diff.u
44 nfs-segfault.u
45 musl.u
46 diet.u
47 EOT
48 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
49 }
51 # Rules to configure and make the package.
52 compile_rules()
53 {
54 case "$ARCH" in
55 arm)
56 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
57 apply_bb_patchs &&
58 cp $stuff/arm/$PACKAGE.config .config
59 make oldconfig &&
60 make && make install || return 1
61 chmod 4755 $src/_install/bin/busybox ;;
62 x86_64) echo "TODO" ;;
63 i?86)
64 apply_bb_patchs &&
65 make oldconfig &&
66 make && make install || return 1
67 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
68 $src/_install/bin/busybox
70 # prepare busybox-pam package
71 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
72 make oldconfig && make || return 1
73 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
74 mv busybox busybox-pam
76 # prepare busybox-static package
77 if [ -x /usr/bin/uclibc-i486-gcc ]; then
78 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
79 make oldconfig && make || return 1
80 cp busybox busybox-static
81 mv busybox busybox-uclibc
82 fi
84 if [ -x /usr/bin/musl-gcc ]; then
85 # prepare busybox-musl package
86 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
87 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D__musl__ |' .config
88 make oldconfig && make CC=musl-gcc || return 1
89 mv busybox busybox-musl
90 fi
92 if [ -x /usr/lib/diet/bin/diet ]; then
93 # prepare busybox-diet package
94 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
95 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
96 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
97 mv busybox busybox-diet
98 fi
100 # prepare ssfs-busybox package
101 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
102 mkdir -p $rootfs/etc
103 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
104 make oldconfig && make busybox &&
105 make CONFIG_PREFIX=$rootfs install || return 1
106 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
107 chown -R 0.0 $rootfs/etc
108 chmod 0600 $rootfs/etc/busybox.conf
109 chmod 4755 $rootfs/bin/busybox ;;
110 esac
111 }
113 # Cross compilation check.
114 testsuite()
115 {
116 readelf -h $src/_install/bin/busybox
117 }
119 # Rules to gen a SliTaz package suitable for Tazpkg.
120 genpkg_rules()
121 {
122 cp -a $src/_install/* $fs
123 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
124 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd
126 # Busybox config files.
127 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
128 syslog.conf zcip.script
129 do
130 cp $stuff/$f $fs/etc
131 done
132 chown -R 0.0 $fs/etc
133 chmod 600 $fs/etc/busybox.conf
134 touch $fs/etc/resolv.conf
136 # Daemon scripts.
137 cp $stuff/daemon $fs/etc/init.d
138 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
139 for i in $DAEMON; do
140 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
141 ln -s daemon $fs/etc/init.d/$i
142 done
143 rm $fs/linuxrc
144 mkdir -p $fs/etc/modprobe.d
146 # Udhcpc stuff.
147 mkdir -p $fs/usr/share/udhcpc
148 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
149 chmod +x $fs/usr/share/udhcpc/default.script
151 # Httpd stuff.
152 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
153 cp -a $stuff/www $fs/var
154 }
156 # GNU utils stuff.
157 pre_install()
158 {
159 local i
160 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
161 answer=""
162 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
163 [ -f $1$i ] || continue
164 case "$i" in
165 /bin/busybox) continue ;;
166 *bin/*) ;;
167 *) continue ;;
168 esac
169 if [ -z "$answer" ]; then
170 echo -n "Keep installed GNU utilities ? "
171 read -t 30 answer # by default: keep
172 case "$answer" in
173 n*|N*) break;;
174 *) answer="Y";;
175 esac
176 fi
177 cp -a $1$i $1$i-busybox-install
178 done
179 }
181 post_install()
182 {
183 local i
184 [ -f /etc/resolv.conf-busybox-install ] &&
185 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
186 while read i ; do
187 [ -f $1$i-busybox-install ] || continue
188 mv $1$i-busybox-install $1$i
189 done < $1$INSTALLED/$PACKAGE/files.list
190 chmod 4755 $1/bin/busybox
192 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
193 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
194 echo '# Domain name server options.' >> $root/etc/daemons.conf
195 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
196 echo '' >> $root/etc/daemons.conf
197 fi
198 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
199 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
200 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
201 echo '' >> $root/etc/daemons.conf
202 fi
203 }
205 pre_remove()
206 {
207 # We can not remove this package !
208 exit 1
209 }