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