wok-next view busybox/receipt @ rev 18309
Up cookutils (750)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Aug 25 12:04:37 2015 +0200 (2015-08-25) |
parents | d6fc3dbec1de |
children | ca1faa27f526 |
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 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
126 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
127 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd
129 # Busybox config files.
130 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
131 syslog.conf zcip.script
132 do
133 cp $stuff/$f $fs/etc
134 done
135 chown -R 0.0 $fs/etc
136 chmod 600 $fs/etc/busybox.conf
137 touch $fs/etc/resolv.conf
139 # Daemon scripts.
140 cp $stuff/daemon $fs/etc/init.d
141 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
142 for i in $DAEMON; do
143 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
144 ln -s daemon $fs/etc/init.d/$i
145 done
146 rm $fs/linuxrc
147 mkdir -p $fs/etc/modprobe.d
149 # Udhcpc stuff.
150 mkdir -p $fs/usr/share/udhcpc
151 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
152 chmod +x $fs/usr/share/udhcpc/default.script
154 # Httpd stuff.
155 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
156 cp -a $stuff/www $fs/var
158 # Update copyright year
159 grep -rl 'copy; 2' $fs/var/www | xargs \
160 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
161 }
163 # GNU utils stuff.
164 pre_install()
165 {
166 local i
167 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
168 answer=""
169 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
170 [ -f $1$i ] || continue
171 case "$i" in
172 /bin/busybox) continue ;;
173 *bin/*) ;;
174 *) continue ;;
175 esac
176 if [ -z "$answer" ]; then
177 echo -n "Keep installed GNU utilities ? "
178 read -t 30 answer # by default: keep
179 case "$answer" in
180 n*|N*) break;;
181 *) answer="Y";;
182 esac
183 fi
184 cp -a $1$i $1$i-busybox-install
185 done
186 }
188 post_install()
189 {
190 local i
191 [ -f /etc/resolv.conf-busybox-install ] &&
192 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
193 while read i ; do
194 [ -f $1$i-busybox-install ] || continue
195 mv $1$i-busybox-install $1$i
196 done < $1$INSTALLED/$PACKAGE/files.list
197 chmod 4755 $1/bin/busybox
199 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
200 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
201 echo '# Domain name server options.' >> $root/etc/daemons.conf
202 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
203 echo '' >> $root/etc/daemons.conf
204 fi
205 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
206 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
207 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
208 echo '' >> $root/etc/daemons.conf
209 fi
210 sed -i "s/copy; 20../copy; $(date +%Y)/" $root/var/www/httpd/404.html
211 }
213 pre_remove()
214 {
215 # We can not remove this package !
216 exit 1
217 }