#!/bin/bash # packager : Frederic Boulet bipbiponlinux~AT~gmail.com # homepage : http://dockapps.org/file.php/id/347 # source location : http://dockapps.org/download.php/id/777/wmlenovo-0.1.4.tgz # last revised : 15.9.2009 # dep : softname='wmlenovo' softversion='0.1.4' packageversion='1fb' arch='i486' cpu='i686' # log ;) ( # parameters needed for the build process buildir=$(pwd) srcpkg="$buildir/$softname-$softversion.tgz" src="$buildir/$softname" package="$softname-$softversion-$arch-$packageversion" dest="$buildir/$package" source=http://dockapps.org/download.php/id/777/$softname-$softversion.tgz # prepare the build result directory rm -rf $dest mkdir -p $dest mkdir -p $dest/install mkdir -p $dest/$prefix/bin mkdir -p $dest/etc mkdir -p $dest/usr/doc mkdir -p $dest/usr/src/$softname-$softversion # Slack-desc cat < $dest/install/slack-desc |-----handy-ruler------------------------------------------------------| wmlenovo: wmlenovo (Dock apps for IBM lenovo) wmlenovo: wmlenovo: Small dock application for monitoring battery state, CPU, GPU and wmlenovo: motherboard temperatures, cpu and fan speed on Lenovo (IBM) laptops. wmlenovo: Require ACPI and thinkpad_acpi. The application based on wmbatteries. wmlenovo: wmlenovo: wmlenovo: wmlenovo: wmlenovo: wmlenovo: EOF # check if source is present if [ -f $softname-$softversion.tgz ]; then echo "Source file already here, no need to download"; else echo "Downloading source" wget -c --no-check-certificate $source fi # extract the source code cd $buildir tar xvf $srcpkg cd $src # build export CFLAGS="-O2 -march=$arch -mtune=$cpu" export CXXFLAGS="-O2 -march=$arch -mtune=$cpu" ./configure \ --program-prefix="" \ --program-suffix="" \ --prefix="/usr" \ --sysconfdir="/etc" \ --localstatedir="/var" \ --mandir="/usr/man" \ --infodir="/usr/info" \ --localedir="/usr/share/locale" \ --enable-static="no" \ --enable-shared="yes" \ --enable-wallpaper="yes" \ --build=$arch-slackware-linux || exit make make install DESTDIR=$dest # add 'default' files mkdir -p $dest/usr/doc/$softname-$softversion cp -a \ NEWS AUTHORS COPYING INSTALL TODO THANKS ChangeLog README\ $dest/usr/doc/$softname-$softversion # strip executables ( cd $dest find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # compress man pages ( cd $dest/usr/man find . -name "*.?" | xargs gzip -9 ) # SalixBuild cp $buildir/build-$softname.sh $dest/usr/src/$softname-$softversion # set target permissions chown -R root:root $dest cd $dest find . -perm 664 -exec chmod 644 {} \; find . -perm 600 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; find . -perm 400 -exec chmod 644 {} \; find . -perm 440 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; # real packaging work: cd $dest makepkg -l y -c n $dest.txz # computes the md5sum signature for the package cd $buildir md5sum $package.txz > $package.md5 # .dep cd $buildir echo -e "libX11,libXau,libXdmcp,libXext,libXpm,libxcb" > $package.dep # src file echo http://zenwalk.pinguix.com/user-accounts/bip/divers/salix/xap/wmlenovo/build-wmlenovo.sh > $package.src echo $source >> $package.src # erase rm -rf $src rm -rf $dest # log ;) ) 2>&1 | tee "$softname-$softversion-build.log"