wok-next view busybox/receipt @ rev 19626

Return code to make other versions of busybox (then being buggy, let's see now).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Feb 08 18:48:05 2017 +0200 (2017-02-08)
parents 18c4d15a72df
children 76f313c978cd
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 WEB_SITE="https://busybox.net/"
10 HOST_ARCH="i486 arm"
12 TARBALL="$PACKAGE-$VERSION.tar.bz2"
13 WGET_URL="${WEB_SITE}downloads/$TARBALL"
15 DEPENDS="slitaz-base-files glibc-base ncurses"
16 BUILD_DEPENDS="bzip2 gettext perl pam pam-dev uclibc-cross-compiler-i486 \
17 musl-libc-dev dietlibc"
19 SPLIT="busybox-boot busybox-pam busybox-static ssfs-busybox busybox-slish"
21 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
22 /etc/resolv.conf /etc/httpd.conf"
24 # Handle cross compilation
25 case "$ARCH" in
26 arm*) BUILD_DEPENDS="bzip2" ;;
27 esac
29 # Busybox patches
30 apply_bb_patches()
31 {
32 while read file; do
33 [ -f done.$file ] && continue
34 echo "Apply $file..."
35 patch -p1 < $stuff/${VERSION%.*}/$file || return 1
36 touch done.$file
37 done <<EOT
38 tar.u
39 stat.u
40 ris.u
41 zmodules.u
42 cmdline.u
43 diff.u
44 diet.u
45 losetup.u
46 fbvnc.u
47 cpio.u
48 ftpd.u
49 shutdown.u
50 scriptreplay.u
51 bug9471.u
52 EOT
53 cp $stuff/${VERSION%.*}/.config .
54 }
56 # Rules to configure and make the package.
57 compile_rules()
58 {
59 case "$ARCH" in
60 arm*)
61 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
62 apply_bb_patches &&
63 cp $stuff/arm/$PACKAGE.config .config
64 make oldconfig &&
65 make && make install || return 1
66 chmod 4755 $src/_install/bin/busybox
67 ;;
68 x86_64)
69 echo "TODO"
70 ;;
71 i?86)
72 echo 'Making busybox'
73 apply_bb_patches &&
74 make oldconfig &&
75 make && make install || return 1
76 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
77 $src/_install/bin/busybox
78 mv docs/busybox.1 docs/busybox.base.1
80 # prepare busybox-pam package
81 echo "Making busybox-pam"
82 sed -i 's|# CONFIG_PAM is not set|CONFIG_PAM=y|' .config
83 make oldconfig && make || return 1
84 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
85 mv busybox busybox-pam
86 mv docs/busybox.1 docs/busybox.pam.1
88 # prepare busybox-static package
89 if [ -x /usr/bin/uclibc-i486-gcc ]; then
90 echo "Making busybox-uclibc"
91 cp $stuff/${VERSION%.*}/.config-static .config
92 sed -i 's|# CONFIG_ASH_INTERNAL_GLOB is not set|CONFIG_ASH_INTERNAL_GLOB=y|' .config
93 make oldconfig && make || return 1
94 cp busybox busybox-static
95 mv busybox busybox-uclibc
96 mv -f docs/busybox.1 docs/busybox.static.1
97 fi
99 if [ -x /usr/bin/musl-gcc ]; then
100 echo "Making busybox-musl"
101 # prepare busybox-musl package
102 cp $stuff/${VERSION%.*}/.config-static .config
103 sed -i 's|uclibc-i486-||' .config
104 make oldconfig && make CC=musl-gcc || return 1
105 mv busybox busybox-musl
106 mv -f docs/busybox.1 docs/busybox.static.1
107 fi
109 if [ -x /usr/lib/diet/bin/diet ]; then
110 echo "Making busybox-diet"
111 # prepare busybox-diet package
112 cp $stuff/${VERSION%.*}/.config-static .config
113 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
114 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
115 mv busybox busybox-diet
116 mv -f docs/busybox.1 docs/busybox.static.1
117 fi
119 # prepare ssfs-busybox package
120 echo "Making busybox-ssfs"
121 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
122 mkdir -p $rootfs/etc
123 cp $stuff/${VERSION%.*}/.config-ssfs .config
124 make oldconfig && make busybox &&
125 make CONFIG_PREFIX=$rootfs install || return 1
126 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
127 chown -R 0.0 $rootfs/etc
128 chmod 0600 $rootfs/etc/busybox.conf
129 chmod 4755 $rootfs/bin/busybox
131 echo 'Making translations'
132 make -C $stuff/po install
133 cp docs/busybox.base.1 docs/busybox.1
134 ;;
136 esac
138 cook_pick_manpages $src/docs/busybox.1
140 mkdir -p $install/usr/share/doc/busybox
141 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
142 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
143 cp -a $src/docs/cgi $install/usr/share/doc/busybox
144 }
146 # Cross compilation check.
147 testsuite()
148 {
149 readelf -h $src/_install/bin/busybox
150 }
152 # Rules to gen a SliTaz package suitable for Tazpkg.
153 genpkg_rules()
154 {
155 cp -a $src/_install/* $fs
156 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
157 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
158 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
159 $fs/var/lib/misc
161 # Busybox config files.
162 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
163 syslog.conf zcip.script
164 do
165 cp $stuff/$f $fs/etc
166 done
167 chown -R 0.0 $fs/etc
168 chmod 600 $fs/etc/busybox.conf
169 touch $fs/etc/resolv.conf
171 # Daemon scripts.
172 cp $stuff/daemon $fs/etc/init.d
173 for i in crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd \
174 udhcpd zcip; do
175 grep -qi config_$i=y $stuff/${VERSION%.*}/.config &&
176 ln -s daemon $fs/etc/init.d/$i
177 done
178 rm $fs/linuxrc
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 'YEAR' $fs/var/www | xargs sed -i "s|YEAR|$(date +%Y)|"
192 :
193 }
195 # GNU utils stuff.
196 pre_install()
197 {
198 local i
199 [ -s $1/etc/resolv.conf ] &&
200 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
201 answer=""
202 for i in $(sed '/busybox$/d; /bin\//!d' "$1$INSTALLED/$PACKAGE/files.list"); do
203 [ -f "$1$i" ] || continue
204 if [ -z "$answer" ]; then
205 echo
206 confirm 'Keep installed GNU utilities?' y || break
207 answer='Y'
208 fi
209 cp -a "$1$i" "$1$i-busybox-install"
210 done
211 }
213 post_install()
214 {
215 local i
216 [ -f $1/etc/resolv.conf-busybox-install ] &&
217 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
218 for i in $($1/bin/busybox --list-full); do
219 [ -f "$1/$i-busybox-install" ] || continue
220 mv "$1/$i-busybox-install" "$1/$i"
221 done
222 chmod 4755 "$1/bin/busybox"
224 touch "$1/etc/daemons.conf"
225 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
226 if ! grep -q ^DNSD_OPTIONS "$1/etc/daemons.conf"; then
227 cat >> "$1/etc/daemons.conf" <<EOF
228 # Domain name server options.
229 DNSD_OPTIONS="-d"
231 EOF
232 fi
233 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
234 cat >> "$1/etc/daemons.conf" <<EOF
235 # Tftp daemon options.
236 TFTPD_OPTIONS="-r /boot"
238 EOF
239 fi
240 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
241 }
243 pre_remove()
244 {
245 # We can not remove this package!
246 exit 1
247 }