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