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