wok view busybox/receipt @ rev 19597

Up: cURL (7.52.1)
author Alexander Medvedev <devl547@gmail.com>
date Sun Jan 01 17:49:15 2017 +0000 (2017-01-01)
parents eb9f71e0e68d
children e899d0ad6fde
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 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"
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 printable.u
41 cmdline.u
42 diff.u
43 diet.u
44 losetup.u
45 fbvnc.u
46 cpio.u
47 ftpd.u
48 dpkgxz.u
49 shutdown.u
50 EOT
51 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
52 }
54 # Rules to configure and make the package.
55 compile_rules()
56 {
57 case "$ARCH" in
58 arm*)
59 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
60 apply_bb_patchs &&
61 cp $stuff/arm/$PACKAGE.config .config
62 make oldconfig &&
63 make && make install || return 1
64 chmod 4755 $src/_install/bin/busybox ;;
65 x86_64) echo "TODO" ;;
66 i?86)
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 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
76 make oldconfig && make || return 1
77 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
78 mv busybox busybox-pam
79 mv docs/busybox.1 docs/busybox.pam.1
81 # prepare busybox-static package
82 if [ -x /usr/bin/uclibc-i486-gcc ]; then
83 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
84 make oldconfig && make || return 1
85 cp busybox busybox-static
86 mv busybox busybox-uclibc
87 mv -f docs/busybox.1 docs/busybox.static.1
88 fi
90 if [ -x /usr/bin/musl-gcc ]; then
91 # prepare busybox-musl package
92 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
93 sed -i 's|uclibc-i486-||' .config
94 make oldconfig && make CC=musl-gcc || return 1
95 mv busybox busybox-musl
96 mv -f docs/busybox.1 docs/busybox.static.1
97 fi
99 if [ -x /usr/lib/diet/bin/diet ]; then
100 # prepare busybox-diet package
101 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
102 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
103 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
104 mv busybox busybox-diet
105 mv -f docs/busybox.1 docs/busybox.static.1
106 fi
108 # prepare ssfs-busybox package
109 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
110 mkdir -p $rootfs/etc
111 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
112 make oldconfig && make busybox &&
113 make CONFIG_PREFIX=$rootfs install || return 1
114 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
115 chown -R 0.0 $rootfs/etc
116 chmod 0600 $rootfs/etc/busybox.conf
117 chmod 4755 $rootfs/bin/busybox
119 # Compile translations
120 make -C $stuff/po install
121 cp docs/busybox.base.1 docs/busybox.1
123 ;;
125 esac
126 }
128 # Cross compilation check.
129 testsuite()
130 {
131 readelf -h $src/_install/bin/busybox
132 }
134 # Rules to gen a SliTaz package suitable for Tazpkg.
135 genpkg_rules()
136 {
137 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
138 cp -a $src/_install/* $fs
139 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
140 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
141 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
142 cp -a $src/docs/cgi $install/usr/share/doc/busybox
143 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
144 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
145 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
146 $fs/var/lib/misc
148 # Busybox config files.
149 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
150 syslog.conf zcip.script
151 do
152 cp $stuff/$f $fs/etc
153 done
154 chown -R 0.0 $fs/etc
155 chmod 600 $fs/etc/busybox.conf
156 touch $fs/etc/resolv.conf
158 # Daemon scripts.
159 cp $stuff/daemon $fs/etc/init.d
160 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
161 for i in $DAEMON; do
162 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
163 ln -s daemon $fs/etc/init.d/$i
164 done
165 rm $fs/linuxrc
166 mkdir -p $fs/etc/modprobe.d
168 # Udhcpc stuff.
169 mkdir -p $fs/usr/share/udhcpc
170 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
171 chmod +x $fs/usr/share/udhcpc/default.script
173 # Httpd stuff.
174 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
175 cp -a $stuff/www $fs/var
177 # Update copyright year
178 grep -rl 'copy; 2' $fs/var/www | xargs \
179 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
181 # Remove kmod & core-util-mount links
182 while read link; do
183 rm -f $fs$link
184 done <<EOT
185 /bin/mount
186 /bin/mountpoint
187 /bin/umount
188 /sbin/depmod
189 /sbin/insmod
190 /sbin/modinfo
191 /sbin/modprobe
192 /sbin/rmmod
193 EOT
194 }
196 # GNU utils stuff.
197 pre_install()
198 {
199 local i
200 [ -s $1/etc/resolv.conf ] &&
201 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
202 answer=""
203 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
204 [ -f "$1$i" ] || continue
205 case "$i" in
206 /bin/busybox) continue ;;
207 *bin/*) ;;
208 *) continue ;;
209 esac
210 if [ -z "$answer" ]; then
211 echo -n "Keep installed GNU utilities ? "
212 read -t 30 answer # by default: keep
213 case "$answer" in
214 n*|N*) break;;
215 *) answer="Y";;
216 esac
217 fi
218 cp -a "$1$i" "$1$i-busybox-install"
219 done
220 }
222 post_install()
223 {
224 local i
225 [ -f $1/etc/resolv.conf-busybox-install ] &&
226 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
227 while read i ; do
228 [ -f "$1$i-busybox-install" ] || continue
229 mv "$1$i-busybox-install" "$1$i"
230 done < "$1$INSTALLED/$PACKAGE/files.list"
231 chmod 4755 "$1/bin/busybox"
233 touch $1/etc/daemons.conf
234 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
235 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
236 echo '# Domain name server options.' >> $1/etc/daemons.conf
237 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
238 echo '' >> $1/etc/daemons.conf
239 fi
240 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
241 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
242 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
243 echo '' >> $1/etc/daemons.conf
244 fi
245 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
246 }
248 pre_remove()
249 {
250 # We can not remove this package !
251 exit 1
252 }