wok-current view busybox/receipt @ rev 17832

Up: slitaz-boot-scripts (5.7)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Mar 23 02:04:52 2015 +0200 (2015-03-23)
parents dfa8d15648ab
children cae46182492e
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.23.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 while read file; do
31 [ -f done.$file ] && continue
32 echo "Apply $file..."
33 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
34 touch done.$file
35 done <<EOT
36 tar.u
37 stat.u
38 ris.u
39 zmodules.u
40 printable.u
41 cmdline.u
42 diff.u
43 diet.u
44 losetup.u
45 fbvnc.u
46 cpio.u
47 ftpd.u
48 dpkgxz.u
49 EOT
50 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
51 }
53 # Rules to configure and make the package.
54 compile_rules()
55 {
56 case "$ARCH" in
57 arm*)
58 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
59 apply_bb_patchs &&
60 cp $stuff/arm/$PACKAGE.config .config
61 make oldconfig &&
62 make && make install || return 1
63 chmod 4755 $src/_install/bin/busybox ;;
64 x86_64) echo "TODO" ;;
65 i?86)
66 apply_bb_patchs &&
67 make oldconfig &&
68 make && make install || return 1
69 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
70 $src/_install/bin/busybox
72 # prepare busybox-pam package
73 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
74 make oldconfig && make || return 1
75 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
76 mv busybox busybox-pam
78 # prepare busybox-static package
79 if [ -x /usr/bin/uclibc-i486-gcc ]; then
80 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
81 make oldconfig && make || return 1
82 cp busybox busybox-static
83 mv busybox busybox-uclibc
84 fi
86 if [ -x /usr/bin/musl-gcc ]; then
87 # prepare busybox-musl package
88 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
89 sed -i 's|uclibc-i486-||' .config
90 make oldconfig && make CC=musl-gcc || return 1
91 mv busybox busybox-musl
92 fi
94 if [ -x /usr/lib/diet/bin/diet ]; then
95 # prepare busybox-diet package
96 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
97 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
98 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
99 mv busybox busybox-diet
100 fi
102 # prepare ssfs-busybox package
103 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
104 mkdir -p $rootfs/etc
105 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
106 make oldconfig && make busybox &&
107 make CONFIG_PREFIX=$rootfs install || return 1
108 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
109 chown -R 0.0 $rootfs/etc
110 chmod 0600 $rootfs/etc/busybox.conf
111 chmod 4755 $rootfs/bin/busybox ;;
112 esac
113 }
115 # Cross compilation check.
116 testsuite()
117 {
118 readelf -h $src/_install/bin/busybox
119 }
121 # Rules to gen a SliTaz package suitable for Tazpkg.
122 genpkg_rules()
123 {
124 cp -a $src/_install/* $fs
125 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
126 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd
128 # Busybox config files.
129 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
130 syslog.conf zcip.script
131 do
132 cp $stuff/$f $fs/etc
133 done
134 chown -R 0.0 $fs/etc
135 chmod 600 $fs/etc/busybox.conf
136 touch $fs/etc/resolv.conf
138 # Daemon scripts.
139 cp $stuff/daemon $fs/etc/init.d
140 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
141 for i in $DAEMON; do
142 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
143 ln -s daemon $fs/etc/init.d/$i
144 done
145 rm $fs/linuxrc
146 mkdir -p $fs/etc/modprobe.d
148 # Udhcpc stuff.
149 mkdir -p $fs/usr/share/udhcpc
150 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
151 chmod +x $fs/usr/share/udhcpc/default.script
153 # Httpd stuff.
154 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
155 cp -a $stuff/www $fs/var
156 }
158 # GNU utils stuff.
159 pre_install()
160 {
161 local i
162 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
163 answer=""
164 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
165 [ -f $1$i ] || continue
166 case "$i" in
167 /bin/busybox) continue ;;
168 *bin/*) ;;
169 *) continue ;;
170 esac
171 if [ -z "$answer" ]; then
172 echo -n "Keep installed GNU utilities ? "
173 read -t 30 answer # by default: keep
174 case "$answer" in
175 n*|N*) break;;
176 *) answer="Y";;
177 esac
178 fi
179 cp -a $1$i $1$i-busybox-install
180 done
181 }
183 post_install()
184 {
185 local i
186 [ -f /etc/resolv.conf-busybox-install ] &&
187 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
188 while read i ; do
189 [ -f $1$i-busybox-install ] || continue
190 mv $1$i-busybox-install $1$i
191 done < $1$INSTALLED/$PACKAGE/files.list
192 chmod 4755 $1/bin/busybox
194 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
195 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
196 echo '# Domain name server options.' >> $root/etc/daemons.conf
197 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
198 echo '' >> $root/etc/daemons.conf
199 fi
200 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
201 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
202 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
203 echo '' >> $root/etc/daemons.conf
204 fi
205 sed -i "s/copy; 20../copy; $(date +%Y)/" $root/var/www/httpd/404.html
206 }
208 pre_remove()
209 {
210 # We can not remove this package !
211 exit 1
212 }