wok view busybox/receipt @ rev 23877

Up busybox (1.32.0)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 01 17:06:12 2020 +0000 (2020-07-01)
parents c251d5eb8ec2
children 675c9264bc6a
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.32.0"
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 cp $stuff/$PACKAGE-${VERSION%.*}-$file 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 EOT
57 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
58 cp $stuff/$PACKAGE-${VERSION%.*}.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 cp busybox busybox-glibc
82 mv busybox_unstripped.map busybox-glibc.map
83 mv docs/busybox.1 docs/busybox.base.1
85 # prepare busybox-pam package
86 echo "=== Build busybox-pam ==="
87 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
88 make oldconfig | sed 's|ERROR|error|' && make || return 1
89 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
90 mv busybox busybox-pam
91 mv busybox_unstripped.map busybox-pam.map
92 mv docs/busybox.1 docs/busybox.pam.1
94 # prepare busybox-static package
95 if [ -x /usr/bin/uclibc-i486-gcc ]; then
96 echo "=== Build busybox-uclibc ==="
97 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
98 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
99 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
100 make oldconfig | sed 's|ERROR|error|' &&
101 LDFLAGS="" make || return 1
102 cp busybox busybox-static
103 mv busybox busybox-uclibc
104 mv busybox_unstripped.map busybox-uclibc.map
105 mv -f docs/busybox.1 docs/busybox.static.1
106 fi
108 if [ -x /usr/bin/musl-gcc ]; then
109 echo "=== Build busybox-musl ==="
110 # prepare busybox-musl package
111 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
112 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
113 sed -i 's|uclibc-i486-||' .config
114 make oldconfig | sed 's|ERROR|error|' &&
115 if make CC=musl-gcc 2> musl-err.log ; then
116 mv busybox busybox-musl
117 mv busybox_unstripped.map busybox-musl.map
118 mv -f docs/busybox.1 docs/busybox.static.1
119 fi
120 fi
122 if [ -x /usr/lib/diet/bin/diet ]; then
123 echo "=== Build busybox-diet ==="
124 # prepare busybox-diet package
125 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
126 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
127 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
128 make oldconfig | sed 's|ERROR|error|' &&
129 if make CC="/usr/lib/diet/bin/diet gcc" 2> diet-err.log ; then
130 mv busybox busybox-diet
131 mv busybox_unstripped.map busybox-diet.map
132 mv -f docs/busybox.1 docs/busybox.static.1
133 fi
134 fi
136 # prepare ssfs-busybox package
137 echo "=== Build busybox-ssfs ==="
138 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
139 mkdir -p $rootfs/etc
140 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
141 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .
142 make oldconfig | sed 's|ERROR|error|' && make busybox &&
143 make CONFIG_PREFIX=$rootfs install || return 1
144 mv busybox_unstripped.map busybox-ssfs.map
145 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
146 chown -R 0.0 $rootfs/etc
147 chmod 0600 $rootfs/etc/busybox.conf
148 chmod 4755 $rootfs/bin/busybox
150 # Compile translations
151 echo "=== Build translations ==="
152 make -C $stuff/po install
153 cp docs/busybox.base.1 docs/busybox.1
155 ;;
157 esac
158 }
160 # Cross compilation check.
161 testsuite()
162 {
163 readelf -h $src/_install/bin/busybox
164 }
166 # Keep e2fsprogs kmod & util-linux-mount files
167 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
168 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
169 /sbin/tune2fs"
171 # Rules to gen a SliTaz package suitable for Tazpkg.
172 genpkg_rules()
173 {
174 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
175 cp -a $src/_install/* $fs
176 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
177 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
178 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
179 cp -a $src/docs/cgi $install/usr/share/doc/busybox
180 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
181 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
182 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
183 $fs/var/lib/misc
184 cp $stuff/command_not_found $fs/bin
186 # Busybox config files.
187 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
188 syslog.conf zcip.script
189 do
190 cp $stuff/$f $fs/etc
191 done
192 chown -R 0.0 $fs/etc
193 chmod 600 $fs/etc/busybox.conf
194 touch $fs/etc/resolv.conf
196 # Daemon scripts.
197 cp $stuff/daemon $fs/etc/init.d
198 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
199 for i in $DAEMON; do
200 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
201 ln -s daemon $fs/etc/init.d/$i
202 done
203 mkdir -p $fs/etc/modprobe.d
205 # Udhcpc stuff.
206 mkdir -p $fs/usr/share/udhcpc
207 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
208 chmod +x $fs/usr/share/udhcpc/default.script
210 # Httpd stuff.
211 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
212 cp -a $stuff/www $fs/var
214 # Update copyright year
215 grep -rl 'copy; 2' $fs/var/www | xargs \
216 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
218 # Remove kmod & util-linux-mount links
219 for link in $REMOVED_SYMLINKS; do
220 rm -f $fs$link
221 done
222 }
224 # GNU utils stuff.
225 pre_install()
226 {
227 local i
228 [ -s $1/etc/resolv.conf ] &&
229 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
230 answer=""
231 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
232 [ -f "$1$i" ] || continue
233 case "$i" in
234 /bin/busybox) continue ;;
235 *bin/*) ;;
236 *) continue ;;
237 esac
238 if [ -z "$answer" ]; then
239 echo
240 echo -n "Keep installed GNU utilities ? "
241 read -t 30 answer # by default: keep
242 case "$answer" in
243 n*|N*) break;;
244 *) answer="Y";;
245 esac
246 fi
247 cp -a "$1$i" "$1$i-busybox-install"
248 done
249 }
251 post_install()
252 {
253 local i
254 [ -f $1/etc/resolv.conf-busybox-install ] &&
255 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
256 while read i ; do
257 [ -f "$1$i-busybox-install" ] || continue
258 mv "$1$i-busybox-install" "$1$i"
259 done < "$1$INSTALLED/$PACKAGE/files.list"
260 chmod 4755 "$1/bin/busybox"
262 touch $1/etc/daemons.conf
263 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
264 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
265 echo '# Domain name server options.' >> $1/etc/daemons.conf
266 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
267 echo '' >> $1/etc/daemons.conf
268 fi
269 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
270 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
271 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
272 echo '' >> $1/etc/daemons.conf
273 fi
274 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
275 for link in $REMOVED_SYMLINKS; do
276 [ -e $1$link ] || ln -s /bin/busybox $1$link
277 done
278 }
280 pre_remove()
281 {
282 # We can not remove this package !
283 exit 1
284 }