wok-next view busybox/receipt @ rev 17041

slitaz-configs-base: /home may not exist (cookiso case)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Aug 19 13:06:45 2014 +0200 (2014-08-19)
parents 79c239d4e13f
children 5189478b714a
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.22.1"
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 cd $src
31 while read file; do
32 [ -f done.$file ] && continue
33 echo "Apply $file..."
34 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
35 touch done.$file
36 done <<EOT
37 tar.u
38 stat.u
39 ris.u
40 zmodules.u
41 printable.u
42 cmdline.u
43 diff.u
44 diet.u
45 losetup.u
46 fatattr.u
47 dpkg_deb-xz.u
48 EOT
49 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
50 }
52 # Rules to configure and make the package.
53 compile_rules()
54 {
55 case "$ARCH" in
56 arm*)
57 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
58 apply_bb_patchs &&
59 cp $stuff/arm/$PACKAGE.config .config
60 make oldconfig &&
61 make && make install || return 1
62 chmod 4755 $src/_install/bin/busybox ;;
63 x86_64) echo "TODO" ;;
64 i?86)
65 apply_bb_patchs &&
66 make oldconfig &&
67 make && make install || return 1
68 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
69 $src/_install/bin/busybox
71 # prepare busybox-pam package
72 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
73 make oldconfig && make || return 1
74 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
75 mv busybox busybox-pam
77 # prepare busybox-static package
78 if [ -x /usr/bin/uclibc-i486-gcc ]; then
79 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
80 make oldconfig && make || return 1
81 cp busybox busybox-static
82 mv busybox busybox-uclibc
83 fi
85 if [ -x /usr/bin/musl-gcc ]; then
86 # prepare busybox-musl package
87 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
88 sed -i 's|uclibc-i486-||' .config
89 make oldconfig && make CC=musl-gcc || return 1
90 mv busybox busybox-musl
91 fi
93 if [ -x /usr/lib/diet/bin/diet ]; then
94 # prepare busybox-diet package
95 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
96 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
97 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
98 mv busybox busybox-diet
99 fi
101 # prepare ssfs-busybox package
102 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
103 mkdir -p $rootfs/etc
104 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
105 make oldconfig && make busybox &&
106 make CONFIG_PREFIX=$rootfs install || return 1
107 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
108 chown -R 0.0 $rootfs/etc
109 chmod 0600 $rootfs/etc/busybox.conf
110 chmod 4755 $rootfs/bin/busybox ;;
111 esac
112 }
114 # Cross compilation check.
115 testsuite()
116 {
117 readelf -h $src/_install/bin/busybox
118 }
120 # Rules to gen a SliTaz package suitable for Tazpkg.
121 genpkg_rules()
122 {
123 cp -a $src/_install/* $fs
124 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
125 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd
127 # Busybox config files.
128 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
129 syslog.conf zcip.script
130 do
131 cp $stuff/$f $fs/etc
132 done
133 chown -R 0.0 $fs/etc
134 chmod 600 $fs/etc/busybox.conf
135 touch $fs/etc/resolv.conf
137 # Daemon scripts.
138 cp $stuff/daemon $fs/etc/init.d
139 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
140 for i in $DAEMON; do
141 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
142 ln -s daemon $fs/etc/init.d/$i
143 done
144 rm $fs/linuxrc
145 mkdir -p $fs/etc/modprobe.d
147 # Udhcpc stuff.
148 mkdir -p $fs/usr/share/udhcpc
149 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
150 chmod +x $fs/usr/share/udhcpc/default.script
152 # Httpd stuff.
153 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
154 cp -a $stuff/www $fs/var
155 }
157 # GNU utils stuff.
158 pre_install()
159 {
160 local i
161 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
162 answer=""
163 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
164 [ -f $1$i ] || continue
165 case "$i" in
166 /bin/busybox) continue ;;
167 *bin/*) ;;
168 *) continue ;;
169 esac
170 if [ -z "$answer" ]; then
171 echo -n "Keep installed GNU utilities ? "
172 read -t 30 answer # by default: keep
173 case "$answer" in
174 n*|N*) break;;
175 *) answer="Y";;
176 esac
177 fi
178 cp -a $1$i $1$i-busybox-install
179 done
180 }
182 post_install()
183 {
184 local i
185 [ -f /etc/resolv.conf-busybox-install ] &&
186 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
187 while read i ; do
188 [ -f $1$i-busybox-install ] || continue
189 mv $1$i-busybox-install $1$i
190 done < $1$INSTALLED/$PACKAGE/files.list
191 chmod 4755 $1/bin/busybox
193 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
194 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
195 echo '# Domain name server options.' >> $root/etc/daemons.conf
196 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
197 echo '' >> $root/etc/daemons.conf
198 fi
199 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
200 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
201 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
202 echo '' >> $root/etc/daemons.conf
203 fi
204 }
206 pre_remove()
207 {
208 # We can not remove this package !
209 exit 1
210 }