# # strip-exec: Try to build the smallest executable possible from the current # source. # # # Slack 3.4 standard gcc -- change if you need to, but gcc 2.7.2.3 typically # generates much smaller code than egcs/pgcc # CC="gcc -V2.7.2.3 -bi486-unknown-linux-gnulibc1" CFLAGS="-O2 -D__OPTIMIZE_SIZE__ -m486" SECTIONS=".note.ABI-tag .gnu.version .rel.got .dtors .comment .note" EXEC=betaftpd rm -f *.s # # Warning # echo "***" echo "*** WARNING: This script is intended for advanced users only, and" echo "*** is highly experimental. It will most likely fail -- please do" echo "*** not complain if it does." echo "***" # # Compile # make distclean CC="$CC" CFLAGS="$CFLAGS" ./configure --enable-dcache make assembly-files # # -malign-* doesn't remove _all_ .align occurrences :-) # for FILE in *.s; do echo "Removing alignment from $FILE..." grep -v .align < $FILE > `basename $FILE .s`2.s mv `basename $FILE .s`2.s $FILE done make betaftpd-from-assembly-files strip --strip-all $EXEC for SECTION in $SECTIONS; do echo Stripping $SECTION... strip --remove-section=$SECTION $EXEC done upx --best betaftpd ls -l betaftpd