wok view busybox/receipt @ rev 20212

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