wok view busybox/receipt @ rev 25194

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