wok-current view busybox/receipt @ rev 20256
Add tlp
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Mar 13 23:01:20 2018 +0100 (2018-03-13) |
parents | 3705d68ed8f3 |
children | 970c5ec9a60a |
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 httpd.u
51 df.u
52 arch.u
53 EOT
54 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
55 }
57 # Rules to configure and make the package.
58 compile_rules()
59 {
60 case "$ARCH" in
61 arm*)
62 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
63 apply_bb_patchs &&
64 cp $stuff/arm/$PACKAGE.config .config
65 make oldconfig &&
66 make && make install || return 1
67 chmod 4755 $src/_install/bin/busybox ;;
68 x86_64) echo "TODO" ;;
69 i?86)
70 echo "=== Build busybox ==="
71 sed -i 's|uname -m|echo i486|' Makefile
72 apply_bb_patchs &&
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 busybox_unstripped.map busybox-glibc.map
78 mv docs/busybox.1 docs/busybox.base.1
80 # prepare busybox-pam package
81 echo "=== Build 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 busybox_unstripped.map busybox-pam.map
87 mv docs/busybox.1 docs/busybox.pam.1
89 # prepare busybox-static package
90 if [ -x /usr/bin/uclibc-i486-gcc ]; then
91 echo "=== Build busybox-uclibc ==="
92 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
93 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
94 make oldconfig && make || return 1
95 cp busybox busybox-static
96 mv busybox busybox-uclibc
97 mv busybox_unstripped.map busybox-uclibc.map
98 mv -f docs/busybox.1 docs/busybox.static.1
99 fi
101 if [ -x /usr/bin/musl-gcc ]; then
102 echo "=== Build busybox-musl ==="
103 # prepare busybox-musl package
104 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
105 sed -i 's|uclibc-i486-||' .config
106 make oldconfig && make CC=musl-gcc || return 1
107 mv busybox busybox-musl
108 mv busybox_unstripped.map busybox-musl.map
109 mv -f docs/busybox.1 docs/busybox.static.1
110 fi
112 if [ -x /usr/lib/diet/bin/diet ]; then
113 echo "=== Build busybox-diet ==="
114 # prepare busybox-diet package
115 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
116 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
117 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
118 mv busybox busybox-diet
119 mv busybox_unstripped.map busybox-diet.map
120 mv -f docs/busybox.1 docs/busybox.static.1
121 fi
123 # prepare ssfs-busybox package
124 echo "=== Build busybox-ssfs ==="
125 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
126 mkdir -p $rootfs/etc
127 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
128 make oldconfig && make busybox &&
129 make CONFIG_PREFIX=$rootfs install || return 1
130 mv busybox_unstripped.map busybox-ssfs.map
131 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
132 chown -R 0.0 $rootfs/etc
133 chmod 0600 $rootfs/etc/busybox.conf
134 chmod 4755 $rootfs/bin/busybox
136 # Compile translations
137 echo "=== Build translations ==="
138 make -C $stuff/po install
139 cp docs/busybox.base.1 docs/busybox.1
141 ;;
143 esac
144 }
146 # Cross compilation check.
147 testsuite()
148 {
149 readelf -h $src/_install/bin/busybox
150 }
152 # Keep e2fsprogs kmod & util-linux-mount files
153 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
154 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
155 /sbin/tune2fs"
157 # Rules to gen a SliTaz package suitable for Tazpkg.
158 genpkg_rules()
159 {
160 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
161 cp -a $src/_install/* $fs
162 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
163 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
164 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
165 cp -a $src/docs/cgi $install/usr/share/doc/busybox
166 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
167 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
168 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
169 $fs/var/lib/misc
171 # Busybox config files.
172 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
173 syslog.conf zcip.script
174 do
175 cp $stuff/$f $fs/etc
176 done
177 chown -R 0.0 $fs/etc
178 chmod 600 $fs/etc/busybox.conf
179 touch $fs/etc/resolv.conf
181 # Daemon scripts.
182 cp $stuff/daemon $fs/etc/init.d
183 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
184 for i in $DAEMON; do
185 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
186 ln -s daemon $fs/etc/init.d/$i
187 done
188 mkdir -p $fs/etc/modprobe.d
190 # Udhcpc stuff.
191 mkdir -p $fs/usr/share/udhcpc
192 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
193 chmod +x $fs/usr/share/udhcpc/default.script
195 # Httpd stuff.
196 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
197 cp -a $stuff/www $fs/var
199 # Update copyright year
200 grep -rl 'copy; 2' $fs/var/www | xargs \
201 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
203 # Remove kmod & util-linux-mount links
204 for link in $REMOVED_SYMLINKS; do
205 rm -f $fs$link
206 done
207 }
209 # GNU utils stuff.
210 pre_install()
211 {
212 local i
213 [ -s $1/etc/resolv.conf ] &&
214 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
215 answer=""
216 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
217 [ -f "$1$i" ] || continue
218 case "$i" in
219 /bin/busybox) continue ;;
220 *bin/*) ;;
221 *) continue ;;
222 esac
223 if [ -z "$answer" ]; then
224 echo -n "Keep installed GNU utilities ? "
225 read -t 30 answer # by default: keep
226 case "$answer" in
227 n*|N*) break;;
228 *) answer="Y";;
229 esac
230 fi
231 cp -a "$1$i" "$1$i-busybox-install"
232 done
233 }
235 post_install()
236 {
237 local i
238 [ -f $1/etc/resolv.conf-busybox-install ] &&
239 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
240 while read i ; do
241 [ -f "$1$i-busybox-install" ] || continue
242 mv "$1$i-busybox-install" "$1$i"
243 done < "$1$INSTALLED/$PACKAGE/files.list"
244 chmod 4755 "$1/bin/busybox"
246 touch $1/etc/daemons.conf
247 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
248 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
249 echo '# Domain name server options.' >> $1/etc/daemons.conf
250 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
251 echo '' >> $1/etc/daemons.conf
252 fi
253 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
254 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
255 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
256 echo '' >> $1/etc/daemons.conf
257 fi
258 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
259 for link in $REMOVED_SYMLINKS; do
260 [ -e $1$link ] || ln -s /bin/busybox $1$link
261 done
262 }
264 pre_remove()
265 {
266 # We can not remove this package !
267 exit 1
268 }