wok view busybox/receipt @ rev 18757

syslinux: compress c32 modules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Dec 29 08:59:31 2015 +0100 (2015-12-29)
parents 994ab4549367
children 3d18330745fd
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
73 # prepare busybox-pam package
74 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
75 make oldconfig && make || return 1
76 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
77 mv busybox busybox-pam
79 # prepare busybox-static package
80 if [ -x /usr/bin/uclibc-i486-gcc ]; then
81 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
82 make oldconfig && make || return 1
83 cp busybox busybox-static
84 mv busybox busybox-uclibc
85 fi
87 if [ -x /usr/bin/musl-gcc ]; then
88 # prepare busybox-musl package
89 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
90 sed -i 's|uclibc-i486-||' .config
91 make oldconfig && make CC=musl-gcc || return 1
92 mv busybox busybox-musl
93 fi
95 if [ -x /usr/lib/diet/bin/diet ]; then
96 # prepare busybox-diet package
97 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
98 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
99 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
100 mv busybox busybox-diet
101 fi
103 # prepare ssfs-busybox package
104 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
105 mkdir -p $rootfs/etc
106 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
107 make oldconfig && make busybox &&
108 make CONFIG_PREFIX=$rootfs install || return 1
109 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
110 chown -R 0.0 $rootfs/etc
111 chmod 0600 $rootfs/etc/busybox.conf
112 chmod 4755 $rootfs/bin/busybox ;;
113 esac
114 }
116 # Cross compilation check.
117 testsuite()
118 {
119 readelf -h $src/_install/bin/busybox
120 }
122 # Rules to gen a SliTaz package suitable for Tazpkg.
123 genpkg_rules()
124 {
125 cp -a $src/_install/* $fs
126 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
127 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
128 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
129 $fs/var/lib/misc
131 # Busybox config files.
132 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
133 syslog.conf zcip.script
134 do
135 cp $stuff/$f $fs/etc
136 done
137 chown -R 0.0 $fs/etc
138 chmod 600 $fs/etc/busybox.conf
139 touch $fs/etc/resolv.conf
141 # Daemon scripts.
142 cp $stuff/daemon $fs/etc/init.d
143 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
144 for i in $DAEMON; do
145 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
146 ln -s daemon $fs/etc/init.d/$i
147 done
148 rm $fs/linuxrc
149 mkdir -p $fs/etc/modprobe.d
151 # Udhcpc stuff.
152 mkdir -p $fs/usr/share/udhcpc
153 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
154 chmod +x $fs/usr/share/udhcpc/default.script
156 # Httpd stuff.
157 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
158 cp -a $stuff/www $fs/var
160 # Update copyright year
161 grep -rl 'copy; 2' $fs/var/www | xargs \
162 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
163 }
165 # GNU utils stuff.
166 pre_install()
167 {
168 local i
169 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
170 answer=""
171 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
172 [ -f "$1$i" ] || continue
173 case "$i" in
174 /bin/busybox) continue ;;
175 *bin/*) ;;
176 *) continue ;;
177 esac
178 if [ -z "$answer" ]; then
179 echo -n "Keep installed GNU utilities ? "
180 read -t 30 answer # by default: keep
181 case "$answer" in
182 n*|N*) break;;
183 *) answer="Y";;
184 esac
185 fi
186 cp -a "$1$i" "$1$i-busybox-install"
187 done
188 }
190 post_install()
191 {
192 local i
193 [ -f /etc/resolv.conf-busybox-install ] &&
194 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
195 while read i ; do
196 [ -f "$1$i-busybox-install" ] || continue
197 mv "$1$i-busybox-install" "$1$i"
198 done < "$1$INSTALLED/$PACKAGE/files.list"
199 chmod 4755 "$1/bin/busybox"
201 touch $root/etc/daemons.conf
202 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
203 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
204 echo '# Domain name server options.' >> $root/etc/daemons.conf
205 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
206 echo '' >> $root/etc/daemons.conf
207 fi
208 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
209 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
210 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
211 echo '' >> $root/etc/daemons.conf
212 fi
213 sed -i "s/copy; 20../copy; $(date +%Y)/" $root/var/www/httpd/404.html
214 }
216 pre_remove()
217 {
218 # We can not remove this package !
219 exit 1
220 }