wok-current annotate busybox/receipt @ rev 20029
Up mosh (1.3.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 20 09:44:00 2017 +0200 (2017-08-20) |
parents | 08bb2369e4d6 |
children | 8670baf3d84a |
rev | line source |
---|---|
pankso@0 | 1 # SliTaz package receipt. |
pankso@0 | 2 |
pankso@0 | 3 PACKAGE="busybox" |
pascal@19996 | 4 VERSION="1.27.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 \ |
pankso@12772 | 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 |
pankso@12926 | 27 # Busybox patches |
pascal@8237 | 28 apply_bb_patchs() |
slaxemulator@8159 | 29 { |
slaxemulator@8159 | 30 while read file; do |
slaxemulator@8159 | 31 [ -f done.$file ] && continue |
slaxemulator@8159 | 32 echo "Apply $file..." |
slaxemulator@9279 | 33 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1 |
slaxemulator@8159 | 34 touch done.$file |
slaxemulator@8159 | 35 done <<EOT |
slaxemulator@8159 | 36 tar.u |
slaxemulator@8159 | 37 stat.u |
slaxemulator@8159 | 38 ris.u |
slaxemulator@8159 | 39 zmodules.u |
slaxemulator@8159 | 40 cmdline.u |
gokhlayeh@12135 | 41 diff.u |
pascal@14748 | 42 diet.u |
pascal@15779 | 43 losetup.u |
pascal@17271 | 44 fbvnc.u |
pascal@17414 | 45 cpio.u |
pascal@18429 | 46 shutdown.u |
pascal@19622 | 47 scriptreplay.u |
pascal@19850 | 48 mkfs_vfat.u |
pascal@19996 | 49 ash.u |
slaxemulator@8159 | 50 EOT |
slaxemulator@9279 | 51 cp $stuff/$PACKAGE-${VERSION%.*}.config .config |
pascal@8237 | 52 } |
pascal@8237 | 53 |
pankso@0 | 54 # Rules to configure and make the package. |
pankso@0 | 55 compile_rules() |
pankso@0 | 56 { |
pankso@12755 | 57 case "$ARCH" in |
pankso@16528 | 58 arm*) |
pankso@12755 | 59 echo "cook: CROSS_COMPILE=$CROSS_COMPILE" |
pankso@12926 | 60 apply_bb_patchs && |
pankso@12926 | 61 cp $stuff/arm/$PACKAGE.config .config |
pankso@12926 | 62 make oldconfig && |
pankso@12926 | 63 make && make install || return 1 |
pankso@12755 | 64 chmod 4755 $src/_install/bin/busybox ;; |
pankso@12755 | 65 x86_64) echo "TODO" ;; |
pankso@12755 | 66 i?86) |
pascal@19610 | 67 echo "=== Build busybox ===" |
pankso@12926 | 68 apply_bb_patchs && |
pankso@12926 | 69 make oldconfig && |
pankso@12926 | 70 make && make install || return 1 |
pankso@12926 | 71 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \ |
pankso@12755 | 72 $src/_install/bin/busybox |
pascal@20029 | 73 mv busybox_unstripped.map busybox-glibc.map |
pascal@19268 | 74 mv docs/busybox.1 docs/busybox.base.1 |
pascal@11017 | 75 |
pankso@12755 | 76 # prepare busybox-pam package |
pascal@19610 | 77 echo "=== Build busybox-pam ===" |
pankso@12755 | 78 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config |
pankso@12755 | 79 make oldconfig && make || return 1 |
pankso@12755 | 80 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox |
pankso@12755 | 81 mv busybox busybox-pam |
pascal@20029 | 82 mv busybox_unstripped.map busybox-pam.map |
pascal@19268 | 83 mv docs/busybox.1 docs/busybox.pam.1 |
pascal@11017 | 84 |
pankso@12755 | 85 # prepare busybox-static package |
pascal@14748 | 86 if [ -x /usr/bin/uclibc-i486-gcc ]; then |
pascal@19610 | 87 echo "=== Build busybox-uclibc ===" |
pascal@14748 | 88 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@19610 | 89 sed -i 's/# CONFIG_ASH_INTERNAL_GLOB is not set/CONFIG_ASH_INTERNAL_GLOB=y/' .config |
pascal@14748 | 90 make oldconfig && make || return 1 |
pascal@14748 | 91 cp busybox busybox-static |
pascal@14748 | 92 mv busybox busybox-uclibc |
pascal@20029 | 93 mv busybox_unstripped.map busybox-uclibc.map |
pascal@19268 | 94 mv -f docs/busybox.1 docs/busybox.static.1 |
pascal@14748 | 95 fi |
pascal@14748 | 96 |
pascal@14748 | 97 if [ -x /usr/bin/musl-gcc ]; then |
pascal@19610 | 98 echo "=== Build busybox-musl ===" |
pascal@14748 | 99 # prepare busybox-musl package |
pascal@14748 | 100 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@15392 | 101 sed -i 's|uclibc-i486-||' .config |
pascal@14748 | 102 make oldconfig && make CC=musl-gcc || return 1 |
pascal@14748 | 103 mv busybox busybox-musl |
pascal@20029 | 104 mv busybox_unstripped.map busybox-musl.map |
pascal@19268 | 105 mv -f docs/busybox.1 docs/busybox.static.1 |
pascal@14748 | 106 fi |
pascal@14748 | 107 |
pascal@14748 | 108 if [ -x /usr/lib/diet/bin/diet ]; then |
pascal@19610 | 109 echo "=== Build busybox-diet ===" |
pascal@14748 | 110 # prepare busybox-diet package |
pascal@14748 | 111 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@14748 | 112 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config |
pascal@14749 | 113 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1 |
pascal@14748 | 114 mv busybox busybox-diet |
pascal@20029 | 115 mv busybox_unstripped.map busybox-diet.map |
pascal@19268 | 116 mv -f docs/busybox.1 docs/busybox.static.1 |
pascal@14748 | 117 fi |
pascal@11017 | 118 |
pankso@12755 | 119 # prepare ssfs-busybox package |
pascal@19610 | 120 echo "=== Build busybox-ssfs ===" |
pankso@12755 | 121 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs |
pankso@12755 | 122 mkdir -p $rootfs/etc |
pankso@12755 | 123 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config |
pankso@12755 | 124 make oldconfig && make busybox && |
pankso@12755 | 125 make CONFIG_PREFIX=$rootfs install || return 1 |
pascal@20029 | 126 mv busybox_unstripped.map busybox-ssfs.map |
pankso@12755 | 127 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf |
pankso@12755 | 128 chown -R 0.0 $rootfs/etc |
pankso@12755 | 129 chmod 0600 $rootfs/etc/busybox.conf |
al@19159 | 130 chmod 4755 $rootfs/bin/busybox |
al@19159 | 131 |
al@19159 | 132 # Compile translations |
pascal@19610 | 133 echo "=== Build translations ===" |
al@19159 | 134 make -C $stuff/po install |
pascal@19268 | 135 cp docs/busybox.base.1 docs/busybox.1 |
al@19159 | 136 |
al@19159 | 137 ;; |
al@19159 | 138 |
pankso@12755 | 139 esac |
pankso@12755 | 140 } |
pankso@12755 | 141 |
pankso@12755 | 142 # Cross compilation check. |
pankso@12755 | 143 testsuite() |
pankso@12755 | 144 { |
pankso@12755 | 145 readelf -h $src/_install/bin/busybox |
pankso@0 | 146 } |
pankso@0 | 147 |
pascal@19793 | 148 # Keep e2fsprogs kmod & util-linux-mount files |
pascal@19788 | 149 REMOVED_SYMLINKS="/bin/mount /bin/mountpoint /bin/umount /sbin/depmod \ |
pascal@19793 | 150 /sbin/insmod /sbin/modinfo /sbin/modprobe /sbin/rmmod /bin/lsattr /bin/chattr \ |
pascal@19793 | 151 /sbin/tune2fs" |
pascal@19788 | 152 |
pankso@0 | 153 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@0 | 154 genpkg_rules() |
pankso@0 | 155 { |
pascal@19282 | 156 mkdir -p $install/usr/share/man/man1 $install/usr/share/doc/busybox |
pascal@14872 | 157 cp -a $src/_install/* $fs |
pascal@19350 | 158 cp -a $src/docs/busybox.base.1 $install/usr/share/man/man1/busybox.1 |
pascal@19282 | 159 cp -a $src/docs/*.txt $install/usr/share/doc/busybox |
pascal@19282 | 160 cp -a $src/docs/*.htm* $install/usr/share/doc/busybox |
pascal@19282 | 161 cp -a $src/docs/cgi $install/usr/share/doc/busybox |
pascal@18182 | 162 [ -e $fs/sbin/ip ] && ln -s busybox $fs/bin/ip |
pascal@14872 | 163 rm -f $fs/bin/bbconfig $fs/usr/bin/ar |
pascal@18619 | 164 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \ |
pascal@18619 | 165 $fs/var/lib/misc |
pankso@12755 | 166 |
pascal@14872 | 167 # Busybox config files. |
pascal@14872 | 168 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \ |
pascal@14872 | 169 syslog.conf zcip.script |
pascal@14872 | 170 do |
pankso@10817 | 171 cp $stuff/$f $fs/etc |
pascal@14872 | 172 done |
pascal@14872 | 173 chown -R 0.0 $fs/etc |
pascal@14872 | 174 chmod 600 $fs/etc/busybox.conf |
pascal@14872 | 175 touch $fs/etc/resolv.conf |
pankso@10817 | 176 |
pascal@14872 | 177 # Daemon scripts. |
pascal@14872 | 178 cp $stuff/daemon $fs/etc/init.d |
pascal@14872 | 179 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip" |
pascal@14872 | 180 for i in $DAEMON; do |
pankso@12755 | 181 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config && |
pankso@10817 | 182 ln -s daemon $fs/etc/init.d/$i |
pascal@14872 | 183 done |
pascal@14872 | 184 mkdir -p $fs/etc/modprobe.d |
pankso@12755 | 185 |
pascal@14872 | 186 # Udhcpc stuff. |
pascal@14872 | 187 mkdir -p $fs/usr/share/udhcpc |
pascal@14872 | 188 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script |
pascal@14872 | 189 chmod +x $fs/usr/share/udhcpc/default.script |
pankso@10817 | 190 |
pascal@14872 | 191 # Httpd stuff. |
pascal@14872 | 192 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh |
pascal@14872 | 193 cp -a $stuff/www $fs/var |
pascal@18006 | 194 |
pascal@18006 | 195 # Update copyright year |
pascal@18007 | 196 grep -rl 'copy; 2' $fs/var/www | xargs \ |
pascal@18006 | 197 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/" |
pascal@18790 | 198 |
pascal@19785 | 199 # Remove kmod & util-linux-mount links |
pascal@19788 | 200 for link in $REMOVED_SYMLINKS; do |
pascal@18790 | 201 rm -f $fs$link |
pascal@19789 | 202 done |
pankso@0 | 203 } |
pankso@557 | 204 |
pankso@12755 | 205 # GNU utils stuff. |
pankso@557 | 206 pre_install() |
pankso@557 | 207 { |
pascal@5015 | 208 local i |
pascal@18846 | 209 [ -s $1/etc/resolv.conf ] && |
pascal@18816 | 210 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install |
pascal@5015 | 211 answer="" |
pascal@18730 | 212 for i in $(cat "$1$INSTALLED/$PACKAGE/files.list"); do |
pascal@18730 | 213 [ -f "$1$i" ] || continue |
pascal@5874 | 214 case "$i" in |
pankso@12755 | 215 /bin/busybox) continue ;; |
pankso@12755 | 216 *bin/*) ;; |
pankso@12755 | 217 *) continue ;; |
pascal@5874 | 218 esac |
pascal@5015 | 219 if [ -z "$answer" ]; then |
pascal@5015 | 220 echo -n "Keep installed GNU utilities ? " |
pascal@5711 | 221 read -t 30 answer # by default: keep |
pascal@5015 | 222 case "$answer" in |
pascal@5711 | 223 n*|N*) break;; |
pascal@5975 | 224 *) answer="Y";; |
pascal@5015 | 225 esac |
pascal@5015 | 226 fi |
pascal@18730 | 227 cp -a "$1$i" "$1$i-busybox-install" |
pascal@5924 | 228 done |
pankso@557 | 229 } |
pascal@983 | 230 |
pascal@983 | 231 post_install() |
pascal@983 | 232 { |
pascal@5015 | 233 local i |
pascal@18816 | 234 [ -f $1/etc/resolv.conf-busybox-install ] && |
pascal@18816 | 235 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf |
pascal@5015 | 236 while read i ; do |
pascal@18730 | 237 [ -f "$1$i-busybox-install" ] || continue |
pascal@18730 | 238 mv "$1$i-busybox-install" "$1$i" |
pascal@18730 | 239 done < "$1$INSTALLED/$PACKAGE/files.list" |
pascal@18730 | 240 chmod 4755 "$1/bin/busybox" |
pankso@10818 | 241 |
pascal@18816 | 242 touch $1/etc/daemons.conf |
pankso@10818 | 243 # /etc/daemons.conf (tftp + dnsd + httpd may not be present) |
pascal@18816 | 244 if ! grep -q ^DNSD_OPTIONS $1/etc/daemons.conf; then |
pascal@18816 | 245 echo '# Domain name server options.' >> $1/etc/daemons.conf |
pascal@18816 | 246 echo 'DNSD_OPTIONS="-d"' >> $1/etc/daemons.conf |
pascal@18816 | 247 echo '' >> $1/etc/daemons.conf |
pankso@10818 | 248 fi |
pascal@18816 | 249 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then |
pascal@18816 | 250 echo '# Tftp daemon options.' >> $1/etc/daemons.conf |
pascal@18816 | 251 echo 'TFTPD_OPTIONS="-r /boot"' >> $1/etc/daemons.conf |
pascal@18816 | 252 echo '' >> $1/etc/daemons.conf |
pankso@10818 | 253 fi |
pascal@18816 | 254 sed -i "s/copy; 20../copy; $(date +%Y)/" $1/var/www/httpd/404.html |
pascal@19788 | 255 for link in $REMOVED_SYMLINKS; do |
pascal@19788 | 256 [ -e $1$link ] || ln -s /bin/busybox $1$link |
pascal@19788 | 257 done |
pascal@5686 | 258 } |
pascal@8932 | 259 |
pascal@8932 | 260 pre_remove() |
pascal@8932 | 261 { |
pascal@8932 | 262 # We can not remove this package ! |
pascal@8932 | 263 exit 1 |
pascal@8932 | 264 } |