wok view busybox/receipt @ rev 24095

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