#!/bin/sh # slackbuild - Dani - dani@slacky.it # Heavily based on the Slackware 12.2 SlackBuild NICE=10 function set_perm { echo -e -n "\nAdjusting permission in $1..."; chown -R root:root $1 &> /dev/null if [ $? != 0 ]; then echo -e "Failed.\n"; exit 1 fi find $1 -perm 664 -exec chmod 644 {} \; find $1 -perm 600 -exec chmod 644 {} \; find $1 -perm 444 -exec chmod 644 {} \; find $1 -perm 400 -exec chmod 644 {} \; find $1 -perm 440 -exec chmod 644 {} \; find $1 -perm 777 -exec chmod 755 {} \; find $1 -perm 775 -exec chmod 755 {} \; find $1 -perm 511 -exec chmod 755 {} \; find $1 -perm 711 -exec chmod 755 {} \; find $1 -perm 555 -exec chmod 755 {} \; echo "Done."; } function strip_files { echo -n "Stripping files in $1..."; find $1 | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find $1 | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find $1 | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null echo "Done."; } NAME=w3m VERSION=0.5.2 ARCH=${ARCH:-i486} CHOST=${CHOST:-i486} BUILD=3dd CWD=`pwd` PKG=/tmp/$NAME-build TGZ=$PKG/TGZ if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi if [ ! -e $CWD/$NAME-$VERSION.tar.gz ]; then wget http://downloads.sourceforge.net/w3m/$NAME-$VERSION.tar.gz || exit 1 fi echo -n "Removing old files..." rm -rf $PKG if [ $? != 0 ]; then echo -n "Failed.\n"; exit 1; fi mkdir -p $TGZ echo -e "Done.\n"; cd $PKG tar xzvf $CWD/$NAME-$VERSION.tar.gz || exit 1 cd $NAME-$VERSION || exit 1 set_perm `pwd`; mkdir -p $TGZ/usr/doc/$NAME-$VERSION cp -avf ABOUT-NLS ChangeLog NEWS README TODO \ doc/* \ $TGZ/usr/doc/$NAME-$VERSION rm $TGZ/usr/doc/$NAME-$VERSION/w3m.1 CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/man \ --infodir=/usr/info \ --localstatedir=/var \ --enable-keymap=lynx \ --with-browser=/usr/bin/firefox \ --with-termlib=ncurses \ --program-prefix= \ --program-suffix= \ --build=$CHOST-slackware-linux || exit 1 echo -e "\nPress Enter.\n"; read nice -n$NICE make -j2 || exit 1 make install DESTDIR=$TGZ set_perm $TGZ; strip_files $TGZ; gzip -9 $TGZ/usr/man/man?/*.? mkdir -p $TGZ/install cat $CWD/slack-desc > $TGZ/install/slack-desc cat $CWD/slack-desc > $TGZ/usr/doc/$NAME-$VERSION/slack-desc cat $CWD/$NAME.SlackBuild > $TGZ/usr/doc/$NAME-$VERSION/$NAME.SlackBuild cd $TGZ echo "Making slack-required..."; requiredbuilder -v -y -s $CWD $TGZ makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz if [ "$1" = "-clean" ]; then echo -n "Cleaning..." rm -rf $PKG echo -e "Done.\n"; fi exit 0;