wok-next view busybox/receipt @ rev 19589

Up faenza-icon-theme, tzdata.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jan 21 11:36:06 2017 +0200 (2017-01-21)
parents 2be6ee0ddc5a
children 4eab61ea2c5a
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.23.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 WEB_SITE="http://www.busybox.net/"
10 HOST_ARCH="i486 arm"
12 TARBALL="$PACKAGE-$VERSION.tar.bz2"
13 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
15 DEPENDS="slitaz-base-files glibc-base ncurses"
16 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \
17 musl-libc-dev dietlibc gettext"
18 SPLIT="busybox-boot busybox-pam busybox-static ssfs-busybox"
19 SIBLINGS="busybox-slish"
21 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
22 /etc/resolv.conf /etc/httpd.conf"
23 AUFS_NOT_RAMFS="uclibc-cross-compiler-i486 is not compatible with aufs+tmpfs 8("
25 # Handle cross compilation
26 case "$ARCH" in
27 arm*) BUILD_DEPENDS="bzip2" ;;
28 esac
30 # Busybox patches
31 apply_bb_patchs()
32 {
33 while read file; do
34 [ -f done.$file ] && continue
35 echo "Apply $file..."
36 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
37 touch done.$file
38 done <<EOT
39 tar.u
40 stat.u
41 ris.u
42 zmodules.u
43 printable.u
44 cmdline.u
45 diff.u
46 diet.u
47 losetup.u
48 fbvnc.u
49 cpio.u
50 ftpd.u
51 dpkgxz.u
52 shutdown.u
53 EOT
54 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
55 }
57 # Rules to configure and make the package.
58 compile_rules()
59 {
60 case "$ARCH" in
61 arm*)
62 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
63 apply_bb_patchs &&
64 cp $stuff/arm/$PACKAGE.config .config
65 make oldconfig &&
66 make && make install || return 1
67 chmod 4755 $src/_install/bin/busybox
68 ;;
69 x86_64)
70 echo "TODO"
71 ;;
72 i?86)
73 echo 'Making busybox'
74 apply_bb_patchs &&
75 make oldconfig &&
76 make && make install || return 1
77 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
78 $src/_install/bin/busybox
79 mv docs/busybox.1 docs/busybox.base.1
81 echo 'Making busybox-pam'
82 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
83 make oldconfig && make || return 1
84 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
85 mv busybox busybox-pam
86 mv docs/busybox.1 docs/busybox.pam.1
88 echo 'Making busybox-static'
89 if [ -x /usr/bin/uclibc-i486-gcc ]; then
90 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
91 make oldconfig && make || return 1
92 cp busybox busybox-static
93 mv busybox busybox-uclibc
94 mv -f docs/busybox.1 docs/busybox.static.1
95 fi
97 echo 'Making busybox-musl'
98 if [ -x /usr/bin/musl-gcc ]; then
99 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
100 sed -i 's|uclibc-i486-||' .config
101 make oldconfig && make CC=musl-gcc || return 1
102 mv busybox busybox-musl
103 mv -f docs/busybox.1 docs/busybox.static.1
104 fi
106 echo 'Making busybox-diet'
107 if [ -x /usr/lib/diet/bin/diet ]; then
108 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
109 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
110 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
111 mv busybox busybox-diet
112 mv -f docs/busybox.1 docs/busybox.static.1
113 fi
115 echo 'Making ssfs-busybox'
116 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
117 mkdir -p $rootfs/etc
118 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
119 make oldconfig && make busybox &&
120 make CONFIG_PREFIX=$rootfs install || return 1
121 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
122 chown -R 0.0 $rootfs/etc
123 chmod 0600 $rootfs/etc/busybox.conf
124 chmod 4755 $rootfs/bin/busybox
126 echo 'Making translations'
127 make -C $stuff/po install
128 cp docs/busybox.base.1 docs/busybox.1
130 ;;
132 esac
134 mkdir -p $install/usr/share/man/man1
135 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
137 mkdir -p $install/usr/share/doc/busybox
138 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
139 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
140 cp -a $src/docs/cgi $install/usr/share/doc/busybox
141 }
143 # Cross compilation check.
144 testsuite()
145 {
146 readelf -h $src/_install/bin/busybox
147 }
149 # Rules to gen a SliTaz package suitable for Tazpkg.
150 genpkg_rules()
151 {
152 cp -a $src/_install/* $fs
153 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
154 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
155 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
156 $fs/var/lib/misc
158 # Busybox config files.
159 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
160 syslog.conf zcip.script
161 do
162 cp $stuff/$f $fs/etc
163 done
164 chown -R 0.0 $fs/etc
165 chmod 600 $fs/etc/busybox.conf
166 touch $fs/etc/resolv.conf
168 # Daemon scripts.
169 cp $stuff/daemon $fs/etc/init.d
170 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
171 for i in $DAEMON; do
172 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
173 ln -s daemon $fs/etc/init.d/$i
174 done
175 rm $fs/linuxrc
176 mkdir -p $fs/etc/modprobe.d
178 # Udhcpc stuff.
179 mkdir -p $fs/usr/share/udhcpc
180 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
181 chmod +x $fs/usr/share/udhcpc/default.script
183 # Httpd stuff.
184 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
185 cp -a $stuff/www $fs/var
187 # Update copyright year
188 grep -rl 'copy; 2' $fs/var/www | xargs \
189 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
191 # Remove kmod & core-util-mount links
192 while read link; do
193 rm -f $fs$link
194 done <<EOT
195 /bin/mount
196 /bin/mountpoint
197 /bin/umount
198 /sbin/depmod
199 /sbin/insmod
200 /sbin/modinfo
201 /sbin/modprobe
202 /sbin/rmmod
203 EOT
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 }
258 pre_remove()
259 {
260 # We can not remove this package!
261 exit 1
262 }