wok-next view busybox/receipt @ rev 19853
Up cookutils, slitaz-configs, slitaz-tools, slitaz-tools-boxes, terminus-font.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Sep 02 16:37:59 2017 +0300 (2017-09-02) |
parents | 0b2945245647 |
children | 2ef4101ba8f7 |
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 musl-libc-dev dietlibc"
18 SPLIT="busybox-boot busybox-pam busybox-static ssfs-busybox busybox-slish"
20 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
21 /etc/resolv.conf /etc/httpd.conf"
23 # Handle cross compilation
24 case "$ARCH" in
25 arm*) BUILD_DEPENDS="bzip2" ;;
26 esac
28 # Busybox patches
29 apply_bb_patches()
30 {
31 while read file; do
32 [ -f done.$file ] && continue
33 echo "Apply $file..."
34 patch -p1 < $stuff/${VERSION%.*}/$file || return 1
35 touch done.$file
36 done <<EOT
37 tar.u
38 stat.u
39 ris.u
40 zmodules.u
41 cmdline.u
42 diff.u
43 diet.u
44 losetup.u
45 fbvnc.u
46 cpio.u
47 ftpd.u
48 shutdown.u
49 scriptreplay.u
50 bug9471.u
51 EOT
52 cp $stuff/${VERSION%.*}/.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_patches &&
62 cp $stuff/arm/$PACKAGE.config .config
63 make oldconfig &&
64 make && make install || return 1
65 chmod 4755 $src/_install/bin/busybox
66 ;;
67 x86_64)
68 echo "TODO"
69 ;;
70 i?86)
71 echo 'Making busybox'
72 apply_bb_patches &&
73 make oldconfig &&
74 make && make install || return 1
75 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
76 $src/_install/bin/busybox
77 mv docs/busybox.1 docs/busybox.base.1
79 # prepare busybox-pam package
80 echo "Making busybox-pam"
81 sed -i 's|# CONFIG_PAM is not set|CONFIG_PAM=y|' .config
82 make oldconfig && make || return 1
83 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
84 mv busybox busybox-pam
85 mv docs/busybox.1 docs/busybox.pam.1
87 # prepare busybox-static package
88 if [ -n "$(/usr/bin/uclibc-i486-gcc --version 2>/dev/null)" ]; then
89 echo "Making busybox-uclibc"
90 cp $stuff/${VERSION%.*}/.config-static .config
91 sed -i 's|# CONFIG_ASH_INTERNAL_GLOB is not set|CONFIG_ASH_INTERNAL_GLOB=y|' .config
92 make oldconfig && make || return 1
93 cp busybox busybox-static
94 mv busybox busybox-uclibc
95 mv -f docs/busybox.1 docs/busybox.static.1
96 fi
98 if [ -x /usr/bin/musl-gcc ]; then
99 echo "Making busybox-musl"
100 # prepare busybox-musl package
101 cp $stuff/${VERSION%.*}/.config-static .config
102 sed -i 's|uclibc-i486-||' .config
103 make oldconfig && make CC=musl-gcc || return 1
104 mv busybox busybox-musl
105 mv -f docs/busybox.1 docs/busybox.static.1
106 fi
108 if [ -x /usr/lib/diet/bin/diet ]; then
109 echo "Making busybox-diet"
110 # prepare busybox-diet package
111 cp $stuff/${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 -f docs/busybox.1 docs/busybox.static.1
116 fi
118 # prepare ssfs-busybox package
119 echo "Making busybox-ssfs"
120 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
121 mkdir -p $rootfs/etc
122 cp $stuff/${VERSION%.*}/.config-ssfs .config
123 make oldconfig && make busybox &&
124 make CONFIG_PREFIX=$rootfs install || return 1
125 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
126 chown -R 0.0 $rootfs/etc
127 chmod 0600 $rootfs/etc/busybox.conf
128 chmod 4755 $rootfs/bin/busybox
130 echo 'Making translations'
131 make -C $stuff/po install
132 cp docs/busybox.base.1 docs/busybox.1
133 ;;
135 esac
137 cook_pick_manpages $src/docs/busybox.1
139 mkdir -p $install/usr/share/doc/busybox
140 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
141 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
142 cp -a $src/docs/cgi $install/usr/share/doc/busybox
143 }
145 # Cross compilation check.
146 testsuite()
147 {
148 readelf -h $src/_install/bin/busybox
149 }
151 # Rules to gen a SliTaz package suitable for Tazpkg.
152 genpkg_rules()
153 {
154 cp -a $src/_install/* $fs
155 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
156 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
157 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
158 $fs/var/lib/misc
160 # Busybox config files.
161 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
162 syslog.conf zcip.script
163 do
164 cp $stuff/$f $fs/etc
165 done
166 chown -R 0.0 $fs/etc
167 chmod 600 $fs/etc/busybox.conf
168 touch $fs/etc/resolv.conf
170 # Daemon scripts.
171 cp $stuff/daemon $fs/etc/init.d
172 for i in crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd \
173 udhcpd zcip; do
174 grep -qi config_$i=y $stuff/${VERSION%.*}/.config &&
175 ln -s daemon $fs/etc/init.d/$i
176 done
177 rm $fs/linuxrc
178 mkdir -p $fs/etc/modprobe.d
180 # Udhcpc stuff.
181 mkdir -p $fs/usr/share/udhcpc
182 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
183 chmod +x $fs/usr/share/udhcpc/default.script
185 # Httpd stuff.
186 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
187 cp -a $stuff/www $fs/var
189 # Update copyright year
190 grep -rl 'YEAR' $fs/var/www | xargs sed -i "s|YEAR|$(date +%Y)|"
191 :
192 }
194 # GNU utils stuff.
195 pre_install()
196 {
197 local i
198 [ -s $1/etc/resolv.conf ] &&
199 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
200 answer=""
201 for i in $(sed '/busybox$/d; /bin\//!d' "$1$INSTALLED/$PACKAGE/files.list"); do
202 [ -f "$1$i" ] || continue
203 if [ -z "$answer" ]; then
204 echo
205 confirm 'Keep installed GNU utilities?' y || break
206 answer='Y'
207 fi
208 cp -a "$1$i" "$1$i-busybox-install"
209 done
210 }
212 post_install()
213 {
214 local i
215 [ -f $1/etc/resolv.conf-busybox-install ] &&
216 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
217 for i in $($1/bin/busybox --list-full); do
218 [ -f "$1/$i-busybox-install" ] || continue
219 mv "$1/$i-busybox-install" "$1/$i"
220 done
221 chmod 4755 "$1/bin/busybox"
223 touch "$1/etc/daemons.conf"
224 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
225 if ! grep -q ^DNSD_OPTIONS "$1/etc/daemons.conf"; then
226 cat >> "$1/etc/daemons.conf" <<EOF
227 # Domain name server options.
228 DNSD_OPTIONS="-d"
230 EOF
231 fi
232 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
233 cat >> "$1/etc/daemons.conf" <<EOF
234 # Tftp daemon options.
235 TFTPD_OPTIONS="-r /boot"
237 EOF
238 fi
239 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
240 }
242 pre_remove()
243 {
244 # We can not remove this package!
245 exit 1
246 }