wok-6.x annotate busybox/receipt @ rev 14749
busybox: diet -Os produce larger files...
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jun 16 15:34:51 2013 +0200 (2013-06-16) |
parents | fc08361a0da7 |
children | a4254bd509cd |
rev | line source |
---|---|
pankso@0 | 1 # SliTaz package receipt. |
pankso@0 | 2 |
pankso@0 | 3 PACKAGE="busybox" |
pascal@13905 | 4 VERSION="1.21.0" |
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@14748 | 15 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \ |
pascal@14748 | 16 musl-libc-dev dietlibc" |
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@12755 | 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 cd $src |
slaxemulator@8159 | 31 while read file; do |
slaxemulator@8159 | 32 [ -f done.$file ] && continue |
slaxemulator@8159 | 33 echo "Apply $file..." |
slaxemulator@9279 | 34 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1 |
slaxemulator@8159 | 35 touch done.$file |
slaxemulator@8159 | 36 done <<EOT |
slaxemulator@8159 | 37 tar.u |
slaxemulator@8159 | 38 stat.u |
slaxemulator@8159 | 39 ris.u |
slaxemulator@8159 | 40 zmodules.u |
slaxemulator@8159 | 41 printable.u |
slaxemulator@8159 | 42 cmdline.u |
gokhlayeh@12135 | 43 diff.u |
mojo@13725 | 44 nfs-segfault.u |
pascal@14221 | 45 xz.u |
pascal@14748 | 46 musl.u |
pascal@14748 | 47 diet.u |
slaxemulator@8159 | 48 EOT |
slaxemulator@9279 | 49 cp $stuff/$PACKAGE-${VERSION%.*}.config .config |
pascal@8237 | 50 } |
pascal@8237 | 51 |
pankso@0 | 52 # Rules to configure and make the package. |
pankso@0 | 53 compile_rules() |
pankso@0 | 54 { |
pankso@12755 | 55 case "$ARCH" in |
pankso@12755 | 56 arm) |
pankso@12755 | 57 echo "cook: CROSS_COMPILE=$CROSS_COMPILE" |
pankso@12926 | 58 apply_bb_patchs && |
pankso@12926 | 59 cp $stuff/arm/$PACKAGE.config .config |
pankso@12926 | 60 make oldconfig && |
pankso@12926 | 61 make && make install || return 1 |
pankso@12755 | 62 chmod 4755 $src/_install/bin/busybox ;; |
pankso@12755 | 63 x86_64) echo "TODO" ;; |
pankso@12755 | 64 i?86) |
pankso@12926 | 65 apply_bb_patchs && |
pankso@12926 | 66 make oldconfig && |
pankso@12926 | 67 make && make install || return 1 |
pankso@12926 | 68 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \ |
pankso@12755 | 69 $src/_install/bin/busybox |
pascal@11017 | 70 |
pankso@12755 | 71 # prepare busybox-pam package |
pankso@12755 | 72 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config |
pankso@12755 | 73 make oldconfig && make || return 1 |
pankso@12755 | 74 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox |
pankso@12755 | 75 mv busybox busybox-pam |
pascal@11017 | 76 |
pankso@12755 | 77 # prepare busybox-static package |
pascal@14748 | 78 if [ -x /usr/bin/uclibc-i486-gcc ]; then |
pascal@14748 | 79 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@14748 | 80 make oldconfig && make || return 1 |
pascal@14748 | 81 cp busybox busybox-static |
pascal@14748 | 82 mv busybox busybox-uclibc |
pascal@14748 | 83 fi |
pascal@14748 | 84 |
pascal@14748 | 85 if [ -x /usr/bin/musl-gcc ]; then |
pascal@14748 | 86 # prepare busybox-musl package |
pascal@14748 | 87 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@14748 | 88 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D__musl__ |' .config |
pascal@14748 | 89 make oldconfig && make CC=musl-gcc || return 1 |
pascal@14748 | 90 mv busybox busybox-musl |
pascal@14748 | 91 fi |
pascal@14748 | 92 |
pascal@14748 | 93 if [ -x /usr/lib/diet/bin/diet ]; then |
pascal@14748 | 94 # prepare busybox-diet package |
pascal@14748 | 95 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config |
pascal@14748 | 96 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config |
pascal@14749 | 97 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1 |
pascal@14748 | 98 mv busybox busybox-diet |
pascal@14748 | 99 fi |
pascal@11017 | 100 |
pankso@12755 | 101 # prepare ssfs-busybox package |
pankso@12755 | 102 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs |
pankso@12755 | 103 mkdir -p $rootfs/etc |
pankso@12755 | 104 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config |
pankso@12755 | 105 make oldconfig && make busybox && |
pankso@12755 | 106 make CONFIG_PREFIX=$rootfs install || return 1 |
pankso@12755 | 107 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf |
pankso@12755 | 108 chown -R 0.0 $rootfs/etc |
pankso@12755 | 109 chmod 0600 $rootfs/etc/busybox.conf |
pankso@12755 | 110 chmod 4755 $rootfs/bin/busybox ;; |
pankso@12755 | 111 esac |
pankso@12755 | 112 } |
pankso@12755 | 113 |
pankso@12755 | 114 # Cross compilation check. |
pankso@12755 | 115 testsuite() |
pankso@12755 | 116 { |
pankso@12755 | 117 readelf -h $src/_install/bin/busybox |
pankso@0 | 118 } |
pankso@0 | 119 |
pankso@0 | 120 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@0 | 121 genpkg_rules() |
pankso@0 | 122 { |
pankso@0 | 123 cp -a $src/_install/* $fs |
pascal@7755 | 124 rm -f $fs/bin/bbconfig $fs/usr/bin/ar |
mojo@14441 | 125 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs |
pankso@12755 | 126 |
pascal@514 | 127 # Busybox config files. |
pascal@13186 | 128 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \ |
pascal@13186 | 129 syslog.conf zcip.script |
pankso@10817 | 130 do |
pankso@10817 | 131 cp $stuff/$f $fs/etc |
pankso@10817 | 132 done |
pankso@10817 | 133 chown -R 0.0 $fs/etc |
pankso@0 | 134 chmod 600 $fs/etc/busybox.conf |
pascal@847 | 135 touch $fs/etc/resolv.conf |
pankso@10817 | 136 |
pascal@12460 | 137 # Daemon scripts. |
slaxemulator@9279 | 138 cp $stuff/daemon $fs/etc/init.d |
slaxemulator@9279 | 139 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip" |
slaxemulator@9279 | 140 for i in $DAEMON; do |
pankso@12755 | 141 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config && |
pankso@10817 | 142 ln -s daemon $fs/etc/init.d/$i |
pascal@5308 | 143 done |
pascal@1703 | 144 rm $fs/linuxrc |
pascal@1299 | 145 mkdir -p $fs/etc/modprobe.d |
pankso@12755 | 146 |
pankso@0 | 147 # Udhcpc stuff. |
pankso@0 | 148 mkdir -p $fs/usr/share/udhcpc |
slaxemulator@9279 | 149 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script |
pankso@0 | 150 chmod +x $fs/usr/share/udhcpc/default.script |
pankso@10817 | 151 |
pascal@5684 | 152 # Httpd stuff. |
pascal@13481 | 153 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh |
pankso@10817 | 154 cp -a $stuff/www $fs/var |
pankso@0 | 155 } |
pankso@557 | 156 |
pankso@12755 | 157 # GNU utils stuff. |
pankso@557 | 158 pre_install() |
pankso@557 | 159 { |
pascal@5015 | 160 local i |
pascal@983 | 161 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install |
pascal@5015 | 162 answer="" |
pascal@5924 | 163 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do |
pascal@5863 | 164 [ -f $1$i ] || continue |
pascal@5874 | 165 case "$i" in |
pankso@12755 | 166 /bin/busybox) continue ;; |
pankso@12755 | 167 *bin/*) ;; |
pankso@12755 | 168 *) continue ;; |
pascal@5874 | 169 esac |
pascal@5015 | 170 if [ -z "$answer" ]; then |
pascal@5015 | 171 echo -n "Keep installed GNU utilities ? " |
pascal@5711 | 172 read -t 30 answer # by default: keep |
pascal@5015 | 173 case "$answer" in |
pascal@5711 | 174 n*|N*) break;; |
pascal@5975 | 175 *) answer="Y";; |
pascal@5015 | 176 esac |
pascal@5015 | 177 fi |
pascal@5863 | 178 cp -a $1$i $1$i-busybox-install |
pascal@5924 | 179 done |
pankso@557 | 180 } |
pascal@983 | 181 |
pascal@983 | 182 post_install() |
pascal@983 | 183 { |
pascal@5015 | 184 local i |
pascal@5924 | 185 [ -f /etc/resolv.conf-busybox-install ] && |
pascal@983 | 186 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf |
pascal@5015 | 187 while read i ; do |
pascal@5863 | 188 [ -f $1$i-busybox-install ] || continue |
pascal@5749 | 189 mv $1$i-busybox-install $1$i |
pascal@5015 | 190 done < $1$INSTALLED/$PACKAGE/files.list |
pascal@5749 | 191 chmod 4755 $1/bin/busybox |
pankso@10818 | 192 |
pankso@10818 | 193 # /etc/daemons.conf (tftp + dnsd + httpd may not be present) |
pankso@10818 | 194 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then |
pankso@10818 | 195 echo '# Domain name server options.' >> $root/etc/daemons.conf |
pankso@10818 | 196 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf |
pankso@10818 | 197 echo '' >> $root/etc/daemons.conf |
pankso@10818 | 198 fi |
pankso@10818 | 199 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then |
pankso@10818 | 200 echo '# Tftp daemon options.' >> $root/etc/daemons.conf |
pankso@10818 | 201 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf |
pankso@10818 | 202 echo '' >> $root/etc/daemons.conf |
pankso@10818 | 203 fi |
pankso@10818 | 204 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then |
pankso@10818 | 205 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf |
pankso@10818 | 206 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf |
pankso@10818 | 207 echo '' >> $root/etc/daemons.conf |
pankso@10818 | 208 fi |
pascal@5686 | 209 } |
pascal@8932 | 210 |
pascal@8932 | 211 pre_remove() |
pascal@8932 | 212 { |
pascal@8932 | 213 # We can not remove this package ! |
pascal@8932 | 214 exit 1 |
pascal@8932 | 215 } |