wok view busybox/receipt @ rev 19875

linld: fix chdirname
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 31 12:51:11 2017 +0200 (2017-03-31)
parents e5b03a2e8b00
children e733e84558bd
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 bug9471.u
50 mkfs_vfat.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 docs/busybox.1 docs/busybox.base.1
76 # prepare busybox-pam package
77 echo "=== Build busybox-pam ==="
78 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
79 make oldconfig && make || return 1
80 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
81 mv busybox busybox-pam
82 mv docs/busybox.1 docs/busybox.pam.1
84 # prepare busybox-static package
85 if [ -x /usr/bin/uclibc-i486-gcc ]; then
86 echo "=== Build busybox-uclibc ==="
87 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
88 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
89 make oldconfig && make || return 1
90 cp busybox busybox-static
91 mv busybox busybox-uclibc
92 mv -f docs/busybox.1 docs/busybox.static.1
93 fi
95 if [ -x /usr/bin/musl-gcc ]; then
96 echo "=== Build busybox-musl ==="
97 # prepare busybox-musl package
98 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
99 sed -i 's|uclibc-i486-||' .config
100 make oldconfig && make CC=musl-gcc || return 1
101 mv busybox busybox-musl
102 mv -f docs/busybox.1 docs/busybox.static.1
103 fi
105 if [ -x /usr/lib/diet/bin/diet ]; then
106 echo "=== Build busybox-diet ==="
107 # prepare busybox-diet package
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 # prepare ssfs-busybox package
116 echo "=== Build busybox-ssfs ==="
117 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
118 mkdir -p $rootfs/etc
119 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
120 make oldconfig && make busybox &&
121 make CONFIG_PREFIX=$rootfs install || return 1
122 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
123 chown -R 0.0 $rootfs/etc
124 chmod 0600 $rootfs/etc/busybox.conf
125 chmod 4755 $rootfs/bin/busybox
127 # Compile translations
128 echo "=== Build translations ==="
129 make -C $stuff/po install
130 cp docs/busybox.base.1 docs/busybox.1
132 ;;
134 esac
135 }
137 # Cross compilation check.
138 testsuite()
139 {
140 readelf -h $src/_install/bin/busybox
141 }
143 # Keep e2fsprogs kmod & util-linux-mount files
144 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
145 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
146 /sbin/tune2fs"
148 # Rules to gen a SliTaz package suitable for Tazpkg.
149 genpkg_rules()
150 {
151 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
152 cp -a $src/_install/* $fs
153 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
154 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
155 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
156 cp -a $src/docs/cgi $install/usr/share/doc/busybox
157 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
158 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
159 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
160 $fs/var/lib/misc
162 # Busybox config files.
163 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
164 syslog.conf zcip.script
165 do
166 cp $stuff/$f $fs/etc
167 done
168 chown -R 0.0 $fs/etc
169 chmod 600 $fs/etc/busybox.conf
170 touch $fs/etc/resolv.conf
172 # Daemon scripts.
173 cp $stuff/daemon $fs/etc/init.d
174 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
175 for i in $DAEMON; do
176 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
177 ln -s daemon $fs/etc/init.d/$i
178 done
179 mkdir -p $fs/etc/modprobe.d
181 # Udhcpc stuff.
182 mkdir -p $fs/usr/share/udhcpc
183 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
184 chmod +x $fs/usr/share/udhcpc/default.script
186 # Httpd stuff.
187 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
188 cp -a $stuff/www $fs/var
190 # Update copyright year
191 grep -rl 'copy; 2' $fs/var/www | xargs \
192 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
194 # Remove kmod & util-linux-mount links
195 for link in $REMOVED_SYMLINKS; do
196 rm -f $fs$link
197 done
198 }
200 # GNU utils stuff.
201 pre_install()
202 {
203 local i
204 [ -s $1/etc/resolv.conf ] &&
205 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
206 answer=""
207 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
208 [ -f "$1$i" ] || continue
209 case "$i" in
210 /bin/busybox) continue ;;
211 *bin/*) ;;
212 *) continue ;;
213 esac
214 if [ -z "$answer" ]; then
215 echo -n "Keep installed GNU utilities ? "
216 read -t 30 answer # by default: keep
217 case "$answer" in
218 n*|N*) break;;
219 *) answer="Y";;
220 esac
221 fi
222 cp -a "$1$i" "$1$i-busybox-install"
223 done
224 }
226 post_install()
227 {
228 local i
229 [ -f $1/etc/resolv.conf-busybox-install ] &&
230 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
231 while read i ; do
232 [ -f "$1$i-busybox-install" ] || continue
233 mv "$1$i-busybox-install" "$1$i"
234 done < "$1$INSTALLED/$PACKAGE/files.list"
235 chmod 4755 "$1/bin/busybox"
237 touch $1/etc/daemons.conf
238 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
239 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
240 echo '# Domain name server options.' >> $1/etc/daemons.conf
241 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
242 echo '' >> $1/etc/daemons.conf
243 fi
244 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
245 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
246 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
247 echo '' >> $1/etc/daemons.conf
248 fi
249 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
250 for link in $REMOVED_SYMLINKS; do
251 [ -e $1$link ] || ln -s /bin/busybox $1$link
252 done
253 }
255 pre_remove()
256 {
257 # We can not remove this package !
258 exit 1
259 }