wok-6.x view busybox/receipt @ rev 19991
Up busybox (1.27.1), vala (0.36.4)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jul 21 16:38:46 2017 +0200 (2017-07-21) |
parents | 10cf54238be9 |
children | ee7f2d5d32f9 |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.27.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 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 EOT
50 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
51 }
53 # Rules to configure and make the package.
54 compile_rules()
55 {
56 case "$ARCH" in
57 arm*)
58 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
59 apply_bb_patchs &&
60 cp $stuff/arm/$PACKAGE.config .config
61 make oldconfig &&
62 make && make install || return 1
63 chmod 4755 $src/_install/bin/busybox ;;
64 x86_64) echo "TODO" ;;
65 i?86)
66 echo "=== Build busybox ==="
67 apply_bb_patchs &&
68 make oldconfig &&
69 make && make install || return 1
70 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
71 $src/_install/bin/busybox
72 mv docs/busybox.1 docs/busybox.base.1
74 # prepare busybox-pam package
75 echo "=== Build busybox-pam ==="
76 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
77 make oldconfig && make || return 1
78 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
79 mv busybox busybox-pam
80 mv docs/busybox.1 docs/busybox.pam.1
82 # prepare busybox-static package
83 if [ -x /usr/bin/uclibc-i486-gcc ]; then
84 echo "=== Build busybox-uclibc ==="
85 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
86 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
87 make oldconfig && make || return 1
88 cp busybox busybox-static
89 mv busybox busybox-uclibc
90 mv -f docs/busybox.1 docs/busybox.static.1
91 fi
93 if [ -x /usr/bin/musl-gcc ]; then
94 echo "=== Build busybox-musl ==="
95 # prepare busybox-musl package
96 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
97 sed -i 's|uclibc-i486-||' .config
98 make oldconfig && make CC=musl-gcc || return 1
99 mv busybox busybox-musl
100 mv -f docs/busybox.1 docs/busybox.static.1
101 fi
103 if [ -x /usr/lib/diet/bin/diet ]; then
104 echo "=== Build busybox-diet ==="
105 # prepare busybox-diet package
106 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
107 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
108 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
109 mv busybox busybox-diet
110 mv -f docs/busybox.1 docs/busybox.static.1
111 fi
113 # prepare ssfs-busybox package
114 echo "=== Build busybox-ssfs ==="
115 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
116 mkdir -p $rootfs/etc
117 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
118 make oldconfig && make busybox &&
119 make CONFIG_PREFIX=$rootfs install || return 1
120 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
121 chown -R 0.0 $rootfs/etc
122 chmod 0600 $rootfs/etc/busybox.conf
123 chmod 4755 $rootfs/bin/busybox
125 # Compile translations
126 echo "=== Build translations ==="
127 make -C $stuff/po install
128 cp docs/busybox.base.1 docs/busybox.1
130 ;;
132 esac
133 }
135 # Cross compilation check.
136 testsuite()
137 {
138 readelf -h $src/_install/bin/busybox
139 }
141 # Keep e2fsprogs kmod & util-linux-mount files
142 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
143 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
144 /sbin/tune2fs"
146 # Rules to gen a SliTaz package suitable for Tazpkg.
147 genpkg_rules()
148 {
149 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
150 cp -a $src/_install/* $fs
151 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
152 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
153 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
154 cp -a $src/docs/cgi $install/usr/share/doc/busybox
155 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
156 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
157 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
158 $fs/var/lib/misc
160 # Busybox config files.
161 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
162 syslog.conf zcip.script
163 do
164 cp $stuff/$f $fs/etc
165 done
166 chown -R 0.0 $fs/etc
167 chmod 600 $fs/etc/busybox.conf
168 touch $fs/etc/resolv.conf
170 # Daemon scripts.
171 cp $stuff/daemon $fs/etc/init.d
172 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
173 for i in $DAEMON; do
174 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
175 ln -s daemon $fs/etc/init.d/$i
176 done
177 mkdir -p $fs/etc/modprobe.d
179 # Udhcpc stuff.
180 mkdir -p $fs/usr/share/udhcpc
181 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
182 chmod +x $fs/usr/share/udhcpc/default.script
184 # Httpd stuff.
185 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
186 cp -a $stuff/www $fs/var
188 # Update copyright year
189 grep -rl 'copy; 2' $fs/var/www | xargs \
190 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
192 # Remove kmod & util-linux-mount links
193 for link in $REMOVED_SYMLINKS; do
194 rm -f $fs$link
195 done
196 }
198 # GNU utils stuff.
199 pre_install()
200 {
201 local i
202 [ -s $1/etc/resolv.conf ] &&
203 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
204 answer=""
205 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
206 [ -f "$1$i" ] || continue
207 case "$i" in
208 /bin/busybox) continue ;;
209 *bin/*) ;;
210 *) continue ;;
211 esac
212 if [ -z "$answer" ]; then
213 echo -n "Keep installed GNU utilities ? "
214 read -t 30 answer # by default: keep
215 case "$answer" in
216 n*|N*) break;;
217 *) answer="Y";;
218 esac
219 fi
220 cp -a "$1$i" "$1$i-busybox-install"
221 done
222 }
224 post_install()
225 {
226 local i
227 [ -f $1/etc/resolv.conf-busybox-install ] &&
228 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
229 while read i ; do
230 [ -f "$1$i-busybox-install" ] || continue
231 mv "$1$i-busybox-install" "$1$i"
232 done < "$1$INSTALLED/$PACKAGE/files.list"
233 chmod 4755 "$1/bin/busybox"
235 touch $1/etc/daemons.conf
236 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
237 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
238 echo '# Domain name server options.' >> $1/etc/daemons.conf
239 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
240 echo '' >> $1/etc/daemons.conf
241 fi
242 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
243 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
244 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
245 echo '' >> $1/etc/daemons.conf
246 fi
247 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
248 for link in $REMOVED_SYMLINKS; do
249 [ -e $1$link ] || ln -s /bin/busybox $1$link
250 done
251 }
253 pre_remove()
254 {
255 # We can not remove this package !
256 exit 1
257 }