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