wok-current view busybox/receipt @ rev 19622
Up busybox (1.26.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jan 11 10:36:15 2017 +0100 (2017-01-11) |
parents | e899d0ad6fde |
children | 1bf436c396bc |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.26.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 ftpd.u
47 shutdown.u
48 scriptreplay.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 # Rules to gen a SliTaz package suitable for Tazpkg.
142 genpkg_rules()
143 {
144 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
145 cp -a $src/_install/* $fs
146 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
147 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
148 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
149 cp -a $src/docs/cgi $install/usr/share/doc/busybox
150 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
151 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
152 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
153 $fs/var/lib/misc
155 # Busybox config files.
156 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
157 syslog.conf zcip.script
158 do
159 cp $stuff/$f $fs/etc
160 done
161 chown -R 0.0 $fs/etc
162 chmod 600 $fs/etc/busybox.conf
163 touch $fs/etc/resolv.conf
165 # Daemon scripts.
166 cp $stuff/daemon $fs/etc/init.d
167 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
168 for i in $DAEMON; do
169 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
170 ln -s daemon $fs/etc/init.d/$i
171 done
172 mkdir -p $fs/etc/modprobe.d
174 # Udhcpc stuff.
175 mkdir -p $fs/usr/share/udhcpc
176 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
177 chmod +x $fs/usr/share/udhcpc/default.script
179 # Httpd stuff.
180 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
181 cp -a $stuff/www $fs/var
183 # Update copyright year
184 grep -rl 'copy; 2' $fs/var/www | xargs \
185 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
187 # Remove kmod & core-util-mount links
188 while read link; do
189 rm -f $fs$link
190 done <<EOT
191 /bin/mount
192 /bin/mountpoint
193 /bin/umount
194 /sbin/depmod
195 /sbin/insmod
196 /sbin/modinfo
197 /sbin/modprobe
198 /sbin/rmmod
199 EOT
200 }
202 # GNU utils stuff.
203 pre_install()
204 {
205 local i
206 [ -s $1/etc/resolv.conf ] &&
207 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
208 answer=""
209 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
210 [ -f "$1$i" ] || continue
211 case "$i" in
212 /bin/busybox) continue ;;
213 *bin/*) ;;
214 *) continue ;;
215 esac
216 if [ -z "$answer" ]; then
217 echo -n "Keep installed GNU utilities ? "
218 read -t 30 answer # by default: keep
219 case "$answer" in
220 n*|N*) break;;
221 *) answer="Y";;
222 esac
223 fi
224 cp -a "$1$i" "$1$i-busybox-install"
225 done
226 }
228 post_install()
229 {
230 local i
231 [ -f $1/etc/resolv.conf-busybox-install ] &&
232 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
233 while read i ; do
234 [ -f "$1$i-busybox-install" ] || continue
235 mv "$1$i-busybox-install" "$1$i"
236 done < "$1$INSTALLED/$PACKAGE/files.list"
237 chmod 4755 "$1/bin/busybox"
239 touch $1/etc/daemons.conf
240 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
241 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
242 echo '# Domain name server options.' >> $1/etc/daemons.conf
243 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
244 echo '' >> $1/etc/daemons.conf
245 fi
246 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
247 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
248 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
249 echo '' >> $1/etc/daemons.conf
250 fi
251 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
252 }
254 pre_remove()
255 {
256 # We can not remove this package !
257 exit 1
258 }