wok view busybox/receipt @ rev 23417

updated perl-xml-simple (2.18 -> 2.25)
author Hans-G?nter Theisgen
date Wed Apr 01 07:44:12 2020 +0100 (2020-04-01)
parents 7f2789b79625
children 539876c71561
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 make CC=musl-gcc || return 1
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
117 if [ -x /usr/lib/diet/bin/diet ]; then
118 echo "=== Build busybox-diet ==="
119 # prepare busybox-diet package
120 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
121 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
122 make oldconfig | sed 's|ERROR|error|' &&
123 make CC="/usr/lib/diet/bin/diet gcc" || return 1
124 mv busybox busybox-diet
125 mv busybox_unstripped.map busybox-diet.map
126 mv -f docs/busybox.1 docs/busybox.static.1
127 fi
129 # prepare ssfs-busybox package
130 echo "=== Build busybox-ssfs ==="
131 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
132 mkdir -p $rootfs/etc
133 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
134 make oldconfig | sed 's|ERROR|error|' && make busybox &&
135 make CONFIG_PREFIX=$rootfs install || return 1
136 mv busybox_unstripped.map busybox-ssfs.map
137 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
138 chown -R 0.0 $rootfs/etc
139 chmod 0600 $rootfs/etc/busybox.conf
140 chmod 4755 $rootfs/bin/busybox
142 # Compile translations
143 echo "=== Build translations ==="
144 make -C $stuff/po install
145 cp docs/busybox.base.1 docs/busybox.1
147 ;;
149 esac
150 }
152 # Cross compilation check.
153 testsuite()
154 {
155 readelf -h $src/_install/bin/busybox
156 }
158 # Keep e2fsprogs kmod & util-linux-mount files
159 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
160 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
161 /sbin/tune2fs"
163 # Rules to gen a SliTaz package suitable for Tazpkg.
164 genpkg_rules()
165 {
166 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
167 cp -a $src/_install/* $fs
168 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
169 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
170 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
171 cp -a $src/docs/cgi $install/usr/share/doc/busybox
172 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
173 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
174 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
175 $fs/var/lib/misc
176 cp $stuff/command_not_found $fs/bin
178 # Busybox config files.
179 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
180 syslog.conf zcip.script
181 do
182 cp $stuff/$f $fs/etc
183 done
184 chown -R 0.0 $fs/etc
185 chmod 600 $fs/etc/busybox.conf
186 touch $fs/etc/resolv.conf
188 # Daemon scripts.
189 cp $stuff/daemon $fs/etc/init.d
190 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
191 for i in $DAEMON; do
192 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
193 ln -s daemon $fs/etc/init.d/$i
194 done
195 mkdir -p $fs/etc/modprobe.d
197 # Udhcpc stuff.
198 mkdir -p $fs/usr/share/udhcpc
199 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
200 chmod +x $fs/usr/share/udhcpc/default.script
202 # Httpd stuff.
203 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
204 cp -a $stuff/www $fs/var
206 # Update copyright year
207 grep -rl 'copy; 2' $fs/var/www | xargs \
208 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
210 # Remove kmod & util-linux-mount links
211 for link in $REMOVED_SYMLINKS; do
212 rm -f $fs$link
213 done
214 }
216 # GNU utils stuff.
217 pre_install()
218 {
219 local i
220 [ -s $1/etc/resolv.conf ] &&
221 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
222 answer=""
223 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
224 [ -f "$1$i" ] || continue
225 case "$i" in
226 /bin/busybox) continue ;;
227 *bin/*) ;;
228 *) continue ;;
229 esac
230 if [ -z "$answer" ]; then
231 echo
232 echo -n "Keep installed GNU utilities ? "
233 read -t 30 answer # by default: keep
234 case "$answer" in
235 n*|N*) break;;
236 *) answer="Y";;
237 esac
238 fi
239 cp -a "$1$i" "$1$i-busybox-install"
240 done
241 }
243 post_install()
244 {
245 local i
246 [ -f $1/etc/resolv.conf-busybox-install ] &&
247 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
248 while read i ; do
249 [ -f "$1$i-busybox-install" ] || continue
250 mv "$1$i-busybox-install" "$1$i"
251 done < "$1$INSTALLED/$PACKAGE/files.list"
252 chmod 4755 "$1/bin/busybox"
254 touch $1/etc/daemons.conf
255 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
256 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
257 echo '# Domain name server options.' >> $1/etc/daemons.conf
258 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
259 echo '' >> $1/etc/daemons.conf
260 fi
261 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
262 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
263 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
264 echo '' >> $1/etc/daemons.conf
265 fi
266 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
267 for link in $REMOVED_SYMLINKS; do
268 [ -e $1$link ] || ln -s /bin/busybox $1$link
269 done
270 }
272 pre_remove()
273 {
274 # We can not remove this package !
275 exit 1
276 }