wok-next view busybox/receipt @ rev 21727

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