wok annotate busybox/receipt @ rev 25348

updated tcllib (1.20 -> 1.21)
author Hans-G?nter Theisgen
date Mon Jul 25 13:13:47 2022 +0100 (2022-07-25)
parents a8546de77bcc
children 73f36875e5a7
rev   line source
pankso@0 1 # SliTaz package receipt.
pankso@0 2
pankso@0 3 PACKAGE="busybox"
pascal@23897 4 VERSION="1.31.1"
pankso@0 5 CATEGORY="base-system"
pankso@0 6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
pankso@289 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@14657 8 LICENSE="GPL2"
pankso@0 9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pankso@0 10 WEB_SITE="http://www.busybox.net/"
pankso@0 11 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
pankso@12772 12 HOST_ARCH="i486 arm"
pankso@0 13
pankso@12755 14 DEPENDS="slitaz-base-files glibc-base ncurses-common"
pascal@19350 15 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \
pascal@19622 16 musl-libc-dev dietlibc gettext-tools"
pankso@12926 17
pankso@12772 18 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
pascal@23902 19 /etc/resolv.conf /etc/httpd.conf"
pascal@14222 20 AUFS_NOT_RAMFS="uclibc-cross-compiler-i486 is not compatible with aufs+tmpfs 8("
pankso@12755 21
pankso@12926 22 # Handle cross compilation
pankso@12755 23 case "$ARCH" in
pankso@16528 24 arm*) BUILD_DEPENDS="bzip2" ;;
pankso@12755 25 esac
pankso@12755 26
pascal@24313 27 # What is the latest version available today?
pascal@22822 28 current_version()
pascal@22822 29 {
pascal@22822 30 wget -O - $WEB_SITE 2>/dev/null | \
pascal@22822 31 sed "/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|;q"
pascal@22822 32 }
pascal@22822 33
pankso@12926 34 # Busybox patches
pascal@8237 35 apply_bb_patchs()
slaxemulator@8159 36 {
pascal@20652 37 sed -i 's|march=|&i486 -mtune=|' arch/i386/Makefile
slaxemulator@8159 38 while read file; do
slaxemulator@8159 39 [ -f done.$file ] && continue
slaxemulator@8159 40 echo "Apply $file..."
slaxemulator@9279 41 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
pascal@23877 42 cp $stuff/$PACKAGE-${VERSION%.*}-$file done.$file
slaxemulator@8159 43 done <<EOT
slaxemulator@8159 44 tar.u
slaxemulator@8159 45 stat.u
slaxemulator@8159 46 ris.u
slaxemulator@8159 47 zmodules.u
slaxemulator@8159 48 cmdline.u
gokhlayeh@12135 49 diff.u
pascal@14748 50 diet.u
pascal@15779 51 losetup.u
pascal@17271 52 fbvnc.u
pascal@17414 53 cpio.u
pascal@18429 54 shutdown.u
pascal@19622 55 scriptreplay.u
pascal@19850 56 mkfs_vfat.u
pascal@23897 57 ash.u
slaxemulator@8159 58 EOT
slaxemulator@9279 59 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
pascal@23877 60 cp $stuff/$PACKAGE-${VERSION%.*}.config .
pascal@8237 61 }
pascal@8237 62
pankso@0 63 # Rules to configure and make the package.
pankso@0 64 compile_rules()
pankso@0 65 {
pankso@12755 66 case "$ARCH" in
pankso@16528 67 arm*)
pankso@12755 68 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
pankso@12926 69 apply_bb_patchs &&
pankso@12926 70 cp $stuff/arm/$PACKAGE.config .config
pascal@21763 71 make oldconfig | sed 's|ERROR|error|' &&
pankso@12926 72 make && make install || return 1
pankso@12755 73 chmod 4755 $src/_install/bin/busybox ;;
pankso@12755 74 x86_64) echo "TODO" ;;
pankso@12755 75 i?86)
pascal@19610 76 echo "=== Build busybox ==="
pascal@20212 77 sed -i 's|uname -m|echo i486|' Makefile
pankso@12926 78 apply_bb_patchs &&
pascal@21763 79 make oldconfig | sed 's|ERROR|error|' &&
pankso@12926 80 make && make install || return 1
pankso@12926 81 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
pankso@12755 82 $src/_install/bin/busybox
pascal@23877 83 cp busybox busybox-glibc
pascal@20029 84 mv busybox_unstripped.map busybox-glibc.map
pascal@19268 85 mv docs/busybox.1 docs/busybox.base.1
pascal@11017 86
pankso@12755 87 # prepare busybox-pam package
pascal@19610 88 echo "=== Build busybox-pam ==="
pankso@12755 89 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
pascal@21763 90 make oldconfig | sed 's|ERROR|error|' && make || return 1
pankso@12755 91 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
pankso@12755 92 mv busybox busybox-pam
pascal@20029 93 mv busybox_unstripped.map busybox-pam.map
pascal@19268 94 mv docs/busybox.1 docs/busybox.pam.1
pascal@11017 95
pankso@12755 96 # prepare busybox-static package
pascal@14748 97 if [ -x /usr/bin/uclibc-i486-gcc ]; then
pascal@19610 98 echo "=== Build busybox-uclibc ==="
pascal@14748 99 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
pascal@23877 100 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
pascal@19610 101 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config
pascal@23543 102 make oldconfig | sed 's|ERROR|error|' &&
pascal@23543 103 LDFLAGS="" make || return 1
pascal@14748 104 cp busybox busybox-static
pascal@14748 105 mv busybox busybox-uclibc
pascal@20029 106 mv busybox_unstripped.map busybox-uclibc.map
pascal@19268 107 mv -f docs/busybox.1 docs/busybox.static.1
pascal@14748 108 fi
pascal@14748 109
pascal@14748 110 if [ -x /usr/bin/musl-gcc ]; then
pascal@19610 111 echo "=== Build busybox-musl ==="
pascal@14748 112 # prepare busybox-musl package
pascal@14748 113 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
pascal@23877 114 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
pascal@15392 115 sed -i 's|uclibc-i486-||' .config
pascal@21763 116 make oldconfig | sed 's|ERROR|error|' &&
pascal@23515 117 if make CC=musl-gcc 2> musl-err.log ; then
pascal@23513 118 mv busybox busybox-musl
pascal@23513 119 mv busybox_unstripped.map busybox-musl.map
pascal@23513 120 mv -f docs/busybox.1 docs/busybox.static.1
pascal@23513 121 fi
pascal@14748 122 fi
pascal@14748 123
pascal@14748 124 if [ -x /usr/lib/diet/bin/diet ]; then
pascal@19610 125 echo "=== Build busybox-diet ==="
pascal@14748 126 # prepare busybox-diet package
pascal@14748 127 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
pascal@23877 128 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .
pascal@14748 129 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
pascal@21763 130 make oldconfig | sed 's|ERROR|error|' &&
pascal@23515 131 if make CC="/usr/lib/diet/bin/diet gcc" 2> diet-err.log ; then
pascal@23513 132 mv busybox busybox-diet
pascal@23513 133 mv busybox_unstripped.map busybox-diet.map
pascal@23513 134 mv -f docs/busybox.1 docs/busybox.static.1
pascal@23513 135 fi
pascal@14748 136 fi
pascal@11017 137
pankso@12755 138 # prepare ssfs-busybox package
pascal@19610 139 echo "=== Build busybox-ssfs ==="
pankso@12755 140 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
pankso@12755 141 mkdir -p $rootfs/etc
pankso@12755 142 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
pascal@23877 143 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .
pascal@21763 144 make oldconfig | sed 's|ERROR|error|' && make busybox &&
pankso@12755 145 make CONFIG_PREFIX=$rootfs install || return 1
pascal@20029 146 mv busybox_unstripped.map busybox-ssfs.map
pankso@12755 147 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
pankso@12755 148 chown -R 0.0 $rootfs/etc
pankso@12755 149 chmod 0600 $rootfs/etc/busybox.conf
al@19159 150 chmod 4755 $rootfs/bin/busybox
al@19159 151
al@19159 152 # Compile translations
pascal@19610 153 echo "=== Build translations ==="
al@19159 154 make -C $stuff/po install
pascal@19268 155 cp docs/busybox.base.1 docs/busybox.1
al@19159 156
al@19159 157 ;;
al@19159 158
pankso@12755 159 esac
pankso@12755 160 }
pankso@12755 161
pankso@12755 162 # Cross compilation check.
pankso@12755 163 testsuite()
pankso@12755 164 {
pankso@12755 165 readelf -h $src/_install/bin/busybox
pankso@0 166 }
pankso@0 167
pascal@19793 168 # Keep e2fsprogs kmod & util-linux-mount files
pascal@19788 169 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \
pascal@19793 170 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \
pascal@19793 171 /sbin/tune2fs"
pascal@19788 172
pankso@0 173 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@0 174 genpkg_rules()
pankso@0 175 {
pascal@19282 176 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox
pascal@14872 177 cp -a $src/_install/* $fs
pascal@19350 178 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1
pascal@19282 179 cp -a $src/docs/*.txt $install/usr/share/doc/busybox
pascal@19282 180 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox
pascal@19282 181 cp -a $src/docs/cgi $install/usr/share/doc/busybox
pascal@18182 182 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip
pascal@14872 183 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
pascal@18619 184 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
pascal@18619 185 $fs/var/lib/misc
pascal@21860 186 cp $stuff/command_not_found $fs/bin
pankso@12755 187
pascal@14872 188 # Busybox config files.
pascal@14872 189 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
pascal@14872 190 syslog.conf zcip.script
pascal@14872 191 do
pankso@10817 192 cp $stuff/$f $fs/etc
pascal@14872 193 done
pascal@14872 194 chown -R 0.0 $fs/etc
pascal@14872 195 chmod 600 $fs/etc/busybox.conf
pascal@14872 196 touch $fs/etc/resolv.conf
pankso@10817 197
pascal@14872 198 # Daemon scripts.
pascal@14872 199 cp $stuff/daemon $fs/etc/init.d
pascal@14872 200 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
pascal@14872 201 for i in $DAEMON; do
pankso@12755 202 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
pankso@10817 203 ln -s daemon $fs/etc/init.d/$i
pascal@14872 204 done
pascal@14872 205 mkdir -p $fs/etc/modprobe.d
pankso@12755 206
pascal@14872 207 # Udhcpc stuff.
pascal@14872 208 mkdir -p $fs/usr/share/udhcpc
pascal@14872 209 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
pascal@14872 210 chmod +x $fs/usr/share/udhcpc/default.script
pankso@10817 211
pascal@14872 212 # Httpd stuff.
pascal@14872 213 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
pascal@14872 214 cp -a $stuff/www $fs/var
pascal@18006 215
pascal@18006 216 # Update copyright year
pascal@18007 217 grep -rl 'copy; 2' $fs/var/www | xargs \
pascal@18006 218 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
pascal@18790 219
pascal@19785 220 # Remove kmod & util-linux-mount links
pascal@19788 221 for link in $REMOVED_SYMLINKS; do
pascal@18790 222 rm -f $fs$link
pascal@19789 223 done
pankso@0 224 }
pankso@557 225
pankso@12755 226 # GNU utils stuff.
pankso@557 227 pre_install()
pankso@557 228 {
pascal@5015 229 local i
pascal@18846 230 [ -s $1/etc/resolv.conf ] &&
pascal@18816 231 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
pascal@5015 232 answer=""
pascal@18730 233 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do
pascal@18730 234 [ -f "$1$i" ] || continue
pascal@5874 235 case "$i" in
pankso@12755 236 /bin/busybox) continue ;;
pankso@12755 237 *bin/*) ;;
pankso@12755 238 *) continue ;;
pascal@5874 239 esac
pascal@5015 240 if [ -z "$answer" ]; then
pascal@20319 241 echo
pascal@5015 242 echo -n "Keep installed GNU utilities ? "
pascal@5711 243 read -t 30 answer # by default: keep
pascal@5015 244 case "$answer" in
pascal@5711 245 n*|N*) break;;
pascal@5975 246 *) answer="Y";;
pascal@5015 247 esac
pascal@5015 248 fi
pascal@18730 249 cp -a "$1$i" "$1$i-busybox-install"
pascal@5924 250 done
pankso@557 251 }
pascal@983 252
pascal@983 253 post_install()
pascal@983 254 {
pascal@5015 255 local i
pascal@18816 256 [ -f $1/etc/resolv.conf-busybox-install ] &&
pascal@18816 257 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
pascal@5015 258 while read i ; do
pascal@18730 259 [ -f "$1$i-busybox-install" ] || continue
pascal@18730 260 mv "$1$i-busybox-install" "$1$i"
pascal@18730 261 done < "$1$INSTALLED/$PACKAGE/files.list"
pascal@18730 262 chmod 4755 "$1/bin/busybox"
pankso@10818 263
pascal@18816 264 touch $1/etc/daemons.conf
pankso@10818 265 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
pascal@18816 266 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then
pascal@18816 267 echo '# Domain name server options.' >> $1/etc/daemons.conf
pascal@18816 268 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf
pascal@18816 269 echo '' >> $1/etc/daemons.conf
pankso@10818 270 fi
pascal@18816 271 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
pascal@18816 272 echo '# Tftp daemon options.' >> $1/etc/daemons.conf
pascal@18816 273 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf
pascal@18816 274 echo '' >> $1/etc/daemons.conf
pankso@10818 275 fi
pascal@18816 276 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html
pascal@19788 277 for link in $REMOVED_SYMLINKS; do
pascal@19788 278 [ -e $1$link ] || ln -s /bin/busybox $1$link
pascal@19788 279 done
pascal@5686 280 }
pascal@8932 281
pascal@8932 282 pre_remove()
pascal@8932 283 {
pascal@8932 284 # We can not remove this package !
pascal@8932 285 exit 1
pascal@8932 286 }