wok-current view busybox/receipt @ rev 19610

busybox: replace 1.25 stuff by 1.26
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jan 08 14:40:47 2017 +0100 (2017-01-08)
parents 2be6ee0ddc5a
children 9c81bcc2a3b7
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 shutdown.u
50 EOT
51 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
52 }
54 # Rules to configure and make the package.
55 compile_rules()
56 {
57 case "$ARCH" in
58 arm*)
59 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
60 apply_bb_patchs &&
61 cp $stuff/arm/$PACKAGE.config .config
62 make oldconfig &&
63 make && make install || return 1
64 chmod 4755 $src/_install/bin/busybox ;;
65 x86_64) echo "TODO" ;;
66 i?86)
67 echo "=== Build busybox ==="
68 apply_bb_patchs &&
69 make oldconfig &&
70 make && make install || return 1
71 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
72 $src/_install/bin/busybox
73 mv docs/busybox.1 docs/busybox.base.1
75 # prepare busybox-pam package
76 echo "=== Build busybox-pam ==="
77 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
78 make oldconfig && make || return 1
79 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
80 mv busybox busybox-pam
81 mv docs/busybox.1 docs/busybox.pam.1
83 # prepare busybox-static package
84 if [ -x /usr/bin/uclibc-i486-gcc ]; then
85 echo "=== Build busybox-uclibc ==="
86 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
87 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
88 make oldconfig && make || return 1
89 cp busybox busybox-static
90 mv busybox busybox-uclibc
91 mv -f docs/busybox.1 docs/busybox.static.1
92 fi
94 if [ -x /usr/bin/musl-gcc ]; then
95 echo "=== Build busybox-musl ==="
96 # prepare busybox-musl package
97 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
98 sed -i 's|uclibc-i486-||' .config
99 make oldconfig && make CC=musl-gcc || return 1
100 mv busybox busybox-musl
101 mv -f docs/busybox.1 docs/busybox.static.1
102 fi
104 if [ -x /usr/lib/diet/bin/diet ]; then
105 echo "=== Build busybox-diet ==="
106 # prepare busybox-diet package
107 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
108 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
109 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
110 mv busybox busybox-diet
111 mv -f docs/busybox.1 docs/busybox.static.1
112 fi
114 # prepare ssfs-busybox package
115 echo "=== Build busybox-ssfs ==="
116 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
117 mkdir -p $rootfs/etc
118 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
119 make oldconfig && make busybox &&
120 make CONFIG_PREFIX=$rootfs install || return 1
121 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
122 chown -R 0.0 $rootfs/etc
123 chmod 0600 $rootfs/etc/busybox.conf
124 chmod 4755 $rootfs/bin/busybox
126 # Compile translations
127 echo "=== Build translations ==="
128 make -C $stuff/po install
129 cp docs/busybox.base.1 docs/busybox.1
131 ;;
133 esac
134 }
136 # Cross compilation check.
137 testsuite()
138 {
139 readelf -h $src/_install/bin/busybox
140 }
142 # Rules to gen a SliTaz package suitable for Tazpkg.
143 genpkg_rules()
144 {
145 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
146 cp -a $src/_install/* $fs
147 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
148 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
149 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
150 cp -a $src/docs/cgi $install/usr/share/doc/busybox
151 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
152 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
153 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
154 $fs/var/lib/misc
156 # Busybox config files.
157 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
158 syslog.conf zcip.script
159 do
160 cp $stuff/$f $fs/etc
161 done
162 chown -R 0.0 $fs/etc
163 chmod 600 $fs/etc/busybox.conf
164 touch $fs/etc/resolv.conf
166 # Daemon scripts.
167 cp $stuff/daemon $fs/etc/init.d
168 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
169 for i in $DAEMON; do
170 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
171 ln -s daemon $fs/etc/init.d/$i
172 done
173 rm $fs/linuxrc
174 mkdir -p $fs/etc/modprobe.d
176 # Udhcpc stuff.
177 mkdir -p $fs/usr/share/udhcpc
178 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
179 chmod +x $fs/usr/share/udhcpc/default.script
181 # Httpd stuff.
182 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
183 cp -a $stuff/www $fs/var
185 # Update copyright year
186 grep -rl 'copy; 2' $fs/var/www | xargs \
187 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
189 # Remove kmod & core-util-mount links
190 while read link; do
191 rm -f $fs$link
192 done <<EOT
193 /bin/mount
194 /bin/mountpoint
195 /bin/umount
196 /sbin/depmod
197 /sbin/insmod
198 /sbin/modinfo
199 /sbin/modprobe
200 /sbin/rmmod
201 EOT
202 }
204 # GNU utils stuff.
205 pre_install()
206 {
207 local i
208 [ -s $1/etc/resolv.conf ] &&
209 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
210 answer=""
211 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
212 [ -f "$1$i" ] || continue
213 case "$i" in
214 /bin/busybox) continue ;;
215 *bin/*) ;;
216 *) continue ;;
217 esac
218 if [ -z "$answer" ]; then
219 echo -n "Keep installed GNU utilities ? "
220 read -t 30 answer # by default: keep
221 case "$answer" in
222 n*|N*) break;;
223 *) answer="Y";;
224 esac
225 fi
226 cp -a "$1$i" "$1$i-busybox-install"
227 done
228 }
230 post_install()
231 {
232 local i
233 [ -f $1/etc/resolv.conf-busybox-install ] &&
234 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
235 while read i ; do
236 [ -f "$1$i-busybox-install" ] || continue
237 mv "$1$i-busybox-install" "$1$i"
238 done < "$1$INSTALLED/$PACKAGE/files.list"
239 chmod 4755 "$1/bin/busybox"
241 touch $1/etc/daemons.conf
242 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
243 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
244 echo '# Domain name server options.' >> $1/etc/daemons.conf
245 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
246 echo '' >> $1/etc/daemons.conf
247 fi
248 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
249 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
250 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
251 echo '' >> $1/etc/daemons.conf
252 fi
253 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
254 }
256 pre_remove()
257 {
258 # We can not remove this package !
259 exit 1
260 }