wok-next annotate busybox/receipt @ rev 20519

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