wok view busybox/receipt @ rev 18125

Add xaos
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jun 11 15:46:55 2015 +0200 (2015-06-11)
parents c85231500a1d
children d6fc3dbec1de
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.23.2"
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
157 # Update copyright year
158 grep -rl 'copy; 2' $fs/var/www | xargs \
159 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
160 }
162 # GNU utils stuff.
163 pre_install()
164 {
165 local i
166 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
167 answer=""
168 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
169 [ -f $1$i ] || continue
170 case "$i" in
171 /bin/busybox) continue ;;
172 *bin/*) ;;
173 *) continue ;;
174 esac
175 if [ -z "$answer" ]; then
176 echo -n "Keep installed GNU utilities ? "
177 read -t 30 answer # by default: keep
178 case "$answer" in
179 n*|N*) break;;
180 *) answer="Y";;
181 esac
182 fi
183 cp -a $1$i $1$i-busybox-install
184 done
185 }
187 post_install()
188 {
189 local i
190 [ -f /etc/resolv.conf-busybox-install ] &&
191 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
192 while read i ; do
193 [ -f $1$i-busybox-install ] || continue
194 mv $1$i-busybox-install $1$i
195 done < $1$INSTALLED/$PACKAGE/files.list
196 chmod 4755 $1/bin/busybox
198 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
199 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
200 echo '# Domain name server options.' >> $root/etc/daemons.conf
201 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
202 echo '' >> $root/etc/daemons.conf
203 fi
204 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
205 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
206 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
207 echo '' >> $root/etc/daemons.conf
208 fi
209 sed -i "s/copy; 20../copy; $(date +%Y)/" $root/var/www/httpd/404.html
210 }
212 pre_remove()
213 {
214 # We can not remove this package !
215 exit 1
216 }