wok-next view busybox/receipt @ rev 20236
linux-cloop: tiny patch
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Nov 06 10:18:18 2017 +0100 (2017-11-06) |
parents | d6dd7b81a69c |
children | 0e7893ac206d |
line source
1 # SliTaz package receipt v2.
3 PACKAGE="busybox"
4 VERSION="1.27.2"
5 CATEGORY="base-system"
6 SHORT_DESC="Tiny versions of 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 BUILD_DEPENDS_arm="bzip2"
16 BUILD_DEPENDS="patch bzip2 gettext perl pam-dev" # uclibc-cross-compiler-i486 musl-libc-dev dietlibc
17 #SPLIT="busybox-boot busybox-pam busybox-static ssfs-busybox"
18 SPLIT="busybox-pam ssfs-busybox"
20 # Rules to configure and make the package.
21 compile_rules() {
22 case "$ARCH" in
23 arm*)
24 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
25 cp $stuff/arm/$PACKAGE.config .config
26 make oldconfig &&
27 make && make install || return 1
28 chmod 4755 $src/_install/bin/busybox
29 ;;
30 x86_64)
31 echo "TODO"
32 ;;
33 i?86)
34 echo 'Making busybox'
35 cp $stuff/.config $src &&
36 make oldconfig &&
37 make &&
38 make install || return 1
39 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
40 $src/_install/bin/busybox
41 mv docs/busybox.1 docs/busybox.base.1
43 # prepare busybox-pam package
44 echo 'Making busybox-pam'
45 sed -i 's|# CONFIG_PAM is not set|CONFIG_PAM=y|' $src/.config
46 make oldconfig &&
47 make || return 1
48 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
49 mv busybox busybox-pam
50 mv docs/busybox.1 docs/busybox.pam.1
52 # prepare busybox-static package
53 if [ -n "$(/usr/bin/uclibc-i486-gcc --version 2>/dev/null)" ]; then
54 echo 'Making busybox-uclibc'
55 cp $stuff/.config-static $src/.config
56 sed -i 's|# CONFIG_ASH_INTERNAL_GLOB is not set|CONFIG_ASH_INTERNAL_GLOB=y|' $src/.config
57 make oldconfig &&
58 make || return 1
59 cp busybox busybox-static
60 mv busybox busybox-uclibc
61 mv -f docs/busybox.1 docs/busybox.static.1
62 fi
64 if [ -x '/usr/bin/musl-gcc' ]; then
65 echo 'Making busybox-musl'
66 # prepare busybox-musl package
67 cp $stuff/.config-static $src/.config
68 sed -i 's|uclibc-i486-||' $src/.config
69 make oldconfig &&
70 make CC=musl-gcc || return 1
71 mv busybox busybox-musl
72 mv -f docs/busybox.1 docs/busybox.static.1
73 fi
75 if [ -x '/usr/lib/diet/bin/diet' ]; then
76 echo 'Making busybox-diet'
77 # prepare busybox-diet package
78 cp $stuff/.config-static $src/.config
79 sed -i 's|uclibc-i486-||;
80 s|CFLAGS="|&-D_BSD_SOURCE |;
81 s|LDFLAGS="|&-Wl,--allow-multiple-definition |;
82 s|LDLIBS="|&compat rpc |' $src/.config
83 make oldconfig &&
84 make CC="/usr/lib/diet/bin/diet gcc" || return 1
85 mv busybox busybox-diet
86 mv -f docs/busybox.1 docs/busybox.static.1
87 fi
89 # prepare ssfs-busybox package
90 echo 'Making busybox-ssfs'
91 rootfs="$src/ssfs-busybox/usr/share/ssfs/rootfs"
92 mkdir -p $rootfs/etc
93 cp $stuff/.config-ssfs $src/.config
94 make oldconfig &&
95 make busybox &&
96 make CONFIG_PREFIX=$rootfs install || return 1
97 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
98 chown -R 0.0 $rootfs/etc
99 chmod 0600 $rootfs/etc/busybox.conf
100 chmod 4755 $rootfs/bin/busybox
102 echo 'Making translations'
103 make -C $stuff/po install
104 cp docs/busybox.base.1 docs/busybox.1
105 ;;
107 esac
109 cook_pick_manpages $src/docs/busybox.1
110 cook_pick_docs \
111 $src/docs/*.txt \
112 $src/docs/*.htm* \
113 $src/docs/cgi
114 }
116 # Cross compilation check.
117 testsuite() {
118 readelf -h $src/_install/bin/busybox
119 }
121 # Rules to gen a SliTaz package suitable for Tazpkg.
122 genpkg_rules() {
123 case $PACKAGE in
124 busybox)
125 DEPENDS="slitaz-base-files glibc-base ncurses"
126 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
127 /etc/resolv.conf /etc/httpd.conf"
128 cp -a $src/_install/* $fs
129 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
130 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
131 mkdir -p \
132 $fs/etc/init.d \
133 $fs/var/spool/cron/crontabs \
134 $fs/var/spool/lpd \
135 $fs/var/lib/misc \
136 $fs/etc/modprobe.d \
137 $fs/usr/share/udhcpc
139 # Busybox config files
140 cp -a $stuff/etc/* $fs/etc
141 chown -R 0.0 $fs/etc
142 chmod 600 $fs/etc/busybox.conf
144 # Daemon scripts
145 cp $stuff/daemon $fs/etc/init.d
146 for i in crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd \
147 telnetd tftpd udhcpd zcip; do
148 grep -qi "config_$i=y" $stuff/.config &&
149 ln -s daemon $fs/etc/init.d/$i
150 done
151 rm $fs/linuxrc
153 # Udhcpc stuff
154 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
155 chmod +x $fs/usr/share/udhcpc/default.script
157 # Httpd stuff (httphelper.sh found in slitaz-base-files package)
158 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
159 cp -r $stuff/www $fs/var
161 # Update copyright year
162 grep -rl 'YEAR' $fs/var/www | xargs sed -i "s|YEAR|$(date +%Y)|"
163 :
164 ;;
165 busybox-boot)
166 jslinux=false
167 CAT="base-system|for core-5in1/boot flavor"
168 DEPENDS="linux syslinux"
169 mkdir -p \
170 $fs/usr/share/boot/bin \
171 $fs/usr/share/boot/dev
173 CHOICE='static'
174 for i in uclibc musl diet; do
175 [ -x "$src/busybox-$i" ] || continue
176 [ -x "$src/busybox-$CHOICE" ] &&
177 [ $(stat -c %s $src/busybox-$i) -ge \
178 $(stat -c %s $src/busybox-$CHOICE) ] &&
179 continue
180 CHOICE="$i"
181 done
182 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/bin/busybox
184 chmod 4755 $fs/usr/share/boot/bin/busybox
185 mknod -m 660 $fs/usr/share/boot/dev/console c 5 1
186 mknod -m 771 $fs/usr/share/boot/dev/null c 1 3
187 mknod -m 660 $fs/usr/share/boot/dev/tty c 5 0
188 mknod -m 660 $fs/usr/share/boot/dev/tty1 c 4 1
189 if $jslinux; then
190 mknod -m 644 $fs/usr/share/boot/dev/clipboard c 10 231
191 mknod -m 660 $fs/usr/share/boot/dev/ttyS0 c 4 64
192 fi
194 cp $stuff/init $fs/usr/share/boot/init
195 $jslinux || sed -i '/jslinux/d' $fs/usr/share/boot/init
196 chmod +x $fs/usr/share/boot/init
198 ( cd $fs/usr/share/boot; find bin dev init | cpio -o -H newc > initrd )
199 rm -rf \
200 $fs/usr/share/boot/bin \
201 $fs/usr/share/boot/dev \
202 $fs/usr/share/boot/init
203 ;;
204 busybox-pam)
205 CAT="base-system|with PAM support"
206 DEPENDS="busybox pam"
207 CONFIG_FILES="/etc/pam.d"
208 PROVIDE="busybox:pam"
209 mkdir -p \
210 $fs/bin/ \
211 $fs/etc/pam.d/
212 cp -a $src/busybox-pam $fs/bin/busybox
213 cp $stuff/login $fs/etc/pam.d/
214 ;;
215 busybox-static)
216 CAT="base-system|static version"
217 DEPENDS=" "
218 mkdir -p $fs/usr/share/boot
220 CHOICE='static'
221 for i in uclibc musl diet; do
222 [ -x "$src/busybox-$i" ] || continue
223 [ -x "$src/busybox-$CHOICE" ] &&
224 [ $(stat -c %s $src/busybox-$i) -ge \
225 $(stat -c %s $src/busybox-$CHOICE) ] &&
226 continue
227 CHOICE="$i"
228 done
229 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/busybox-static
230 ;;
231 ssfs-busybox)
232 # NOTE: We install files in Ssfs data directory to always have ready
233 # to create chroot on the server and provide an easy way to update
234 # the vdisk. We don't do a static build, we need some shared lib in
235 # the chroot anyway. Busybox is configured to not use /usr and with
236 # a minimal set of applets.
238 CAT="base-system|for Ssfs virtual disk minimal chroot"
239 rootfs=$fs/usr/share/ssfs/rootfs
240 cp -a $src/ssfs-busybox/* $fs
241 ;;
242 esac
243 }
245 # GNU utils stuff.
246 pre_install_busybox() {
247 local i
248 [ -s $1/etc/resolv.conf ] &&
249 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
250 answer=''
251 for i in $(sed '/busybox$/d; /bin\//!d' "$1$INSTALLED/$PACKAGE/files.list"); do
252 [ -f "$1$i" ] || continue
253 if [ -z "$answer" ]; then
254 echo
255 confirm 'Keep installed GNU utilities?' y || break
256 answer='Y'
257 fi
258 cp -a "$1$i" "$1$i-busybox-install"
259 done
260 }
262 post_install_busybox() {
263 local i
264 [ -f $1/etc/resolv.conf-busybox-install ] &&
265 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
266 for i in $($1/bin/busybox --list-full); do
267 [ -f "$1/$i-busybox-install" ] || continue
268 mv "$1/$i-busybox-install" "$1/$i"
269 done
270 chmod 4755 "$1/bin/busybox"
272 touch "$1/etc/daemons.conf"
273 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
274 if ! grep -q ^DNSD_OPTIONS "$1/etc/daemons.conf"; then
275 cat >> "$1/etc/daemons.conf" <<EOF
276 # Domain name server options.
277 DNSD_OPTIONS="-d"
279 EOF
280 fi
281 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
282 cat >> "$1/etc/daemons.conf" <<EOF
283 # Tftp daemon options.
284 TFTPD_OPTIONS="-r /boot"
286 EOF
287 fi
288 }
290 # We can't remove this package!
291 pre_remove_busybox() {
292 exit 1
293 }
295 pre_remove_busybox_pam() {
296 # We install non-pam busybox to replace busybox-pam.
297 tazpkg get-install busybox --forced
299 # We remove /bin/busybox from the file.list of busybox-pam.
300 # This way, the non-pam busybox we just installed will not be
301 # removed.
302 sed '/\/bin\/busybox/d' \
303 -i /var/lib/tazpkg/installed/busybox-pam/files.list
304 }
306 post_install_busybox_pam() {
307 chmod 4755 "$1/bin/busybox"
308 }
310 post_install_busybox_static() {
311 chmod 4755 "$1/usr/share/boot/busybox-static"
312 }