wok-current view busybox/receipt @ rev 20043
ipxe: typo
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 30 11:23:20 2017 +0200 (2017-08-30) |
parents | 8f4649ae101b |
children | cec701c81209 |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.27.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 shutdown.u
47 scriptreplay.u
48 mkfs_vfat.u
49 ash.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 echo "=== Build busybox ==="
68 apply_bb_patchs &&
69 make oldconfig &&
70 make && make install || return 1
71 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
72 $src/_install/bin/busybox
73 mv busybox_unstripped.map busybox-glibc.map
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 busybox_unstripped.map busybox-pam.map
83 mv docs/busybox.1 docs/busybox.pam.1
85 # prepare busybox-static package
86 if [ -x /usr/bin/uclibc-i486-gcc ]; then
87 echo "=== Build busybox-uclibc ==="
88 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
89 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
90 make oldconfig && make || return 1
91 cp busybox busybox-static
92 mv busybox busybox-uclibc
93 mv busybox_unstripped.map busybox-uclibc.map
94 mv -f docs/busybox.1 docs/busybox.static.1
95 fi
97 if [ -x /usr/bin/musl-gcc ]; then
98 echo "=== Build busybox-musl ==="
99 # prepare busybox-musl package
100 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
101 sed -i 's|uclibc-i486-||' .config
102 make oldconfig && make CC=musl-gcc || return 1
103 mv busybox busybox-musl
104 mv busybox_unstripped.map busybox-musl.map
105 mv -f docs/busybox.1 docs/busybox.static.1
106 fi
108 if [ -x /usr/lib/diet/bin/diet ]; then
109 echo "=== Build busybox-diet ==="
110 # prepare busybox-diet package
111 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
112 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
113 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
114 mv busybox busybox-diet
115 mv busybox_unstripped.map busybox-diet.map
116 mv -f docs/busybox.1 docs/busybox.static.1
117 fi
119 # prepare ssfs-busybox package
120 echo "=== Build busybox-ssfs ==="
121 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
122 mkdir -p $rootfs/etc
123 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
124 make oldconfig && make busybox &&
125 make CONFIG_PREFIX=$rootfs install || return 1
126 mv busybox_unstripped.map busybox-ssfs.map
127 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
128 chown -R 0.0 $rootfs/etc
129 chmod 0600 $rootfs/etc/busybox.conf
130 chmod 4755 $rootfs/bin/busybox
132 # Compile translations
133 echo "=== Build translations ==="
134 make -C $stuff/po install
135 cp docs/busybox.base.1 docs/busybox.1
137 ;;
139 esac
140 }
142 # Cross compilation check.
143 testsuite()
144 {
145 readelf -h $src/_install/bin/busybox
146 }
148 # Keep e2fsprogs kmod & util-linux-mount files
149 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
150 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
151 /sbin/tune2fs"
153 # Rules to gen a SliTaz package suitable for Tazpkg.
154 genpkg_rules()
155 {
156 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
157 cp -a $src/_install/* $fs
158 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
159 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
160 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
161 cp -a $src/docs/cgi $install/usr/share/doc/busybox
162 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
163 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
164 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
165 $fs/var/lib/misc
167 # Busybox config files.
168 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
169 syslog.conf zcip.script
170 do
171 cp $stuff/$f $fs/etc
172 done
173 chown -R 0.0 $fs/etc
174 chmod 600 $fs/etc/busybox.conf
175 touch $fs/etc/resolv.conf
177 # Daemon scripts.
178 cp $stuff/daemon $fs/etc/init.d
179 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
180 for i in $DAEMON; do
181 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
182 ln -s daemon $fs/etc/init.d/$i
183 done
184 mkdir -p $fs/etc/modprobe.d
186 # Udhcpc stuff.
187 mkdir -p $fs/usr/share/udhcpc
188 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
189 chmod +x $fs/usr/share/udhcpc/default.script
191 # Httpd stuff.
192 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
193 cp -a $stuff/www $fs/var
195 # Update copyright year
196 grep -rl 'copy; 2' $fs/var/www | xargs \
197 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
199 # Remove kmod & util-linux-mount links
200 for link in $REMOVED_SYMLINKS; do
201 rm -f $fs$link
202 done
203 }
205 # GNU utils stuff.
206 pre_install()
207 {
208 local i
209 [ -s $1/etc/resolv.conf ] &&
210 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
211 answer=""
212 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
213 [ -f "$1$i" ] || continue
214 case "$i" in
215 /bin/busybox) continue ;;
216 *bin/*) ;;
217 *) continue ;;
218 esac
219 if [ -z "$answer" ]; then
220 echo -n "Keep installed GNU utilities ? "
221 read -t 30 answer # by default: keep
222 case "$answer" in
223 n*|N*) break;;
224 *) answer="Y";;
225 esac
226 fi
227 cp -a "$1$i" "$1$i-busybox-install"
228 done
229 }
231 post_install()
232 {
233 local i
234 [ -f $1/etc/resolv.conf-busybox-install ] &&
235 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
236 while read i ; do
237 [ -f "$1$i-busybox-install" ] || continue
238 mv "$1$i-busybox-install" "$1$i"
239 done < "$1$INSTALLED/$PACKAGE/files.list"
240 chmod 4755 "$1/bin/busybox"
242 touch $1/etc/daemons.conf
243 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
244 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
245 echo '# Domain name server options.' >> $1/etc/daemons.conf
246 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
247 echo '' >> $1/etc/daemons.conf
248 fi
249 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
250 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
251 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
252 echo '' >> $1/etc/daemons.conf
253 fi
254 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
255 for link in $REMOVED_SYMLINKS; do
256 [ -e $1$link ] || ln -s /bin/busybox $1$link
257 done
258 }
260 pre_remove()
261 {
262 # We can not remove this package !
263 exit 1
264 }