#!/bin/bash # # author : K.R. Winko (imexius@gmail.com) # maintainer : K.R. Winko # latest update : October 12 2006 # status : testing # source location : http://claws.sylpheed.org/ # additional files : # # what package is going to be built # softname='sylpheed-claws' softversion='2.5.5' # # where could you get the source # srcurl="http://prdownloads.sourceforge.net/sylpheed-claws/sylpheed-claws-2.5.5.tar.gz" # # Zenwalk standard: CPU type and architecture, as well as the # version number of Zenwalk this package is made for (on?). # # arch='i486' -> the compiler uses only 80486 instructions # cpu='i686' -> the optimising is done for a PII and above CPU # packageversion='2z30' means: # 1 -> build 2 # z -> Zenwalk # 13 -> Zenwalk version 3.0 # arch='i486' cpu='i686' packageversion='2z30' # # where could you get the source # srcurl="http://prdownloads.sourceforge.net/sylpheed-claws/sylpheed-claws-2.5.5.tar.gz" # # building-computer dependent: the number of parallel 'jobs' of 'make' # # 'heavy' computer: 6 build-jobs at once # #numjobs='-j6' # # 'light' computer: 2 build-jobs at once # numjobs='-j2' # # parameters needed for the build process # buildir=$(pwd) package="$softname-$softversion-$arch-$packageversion" # # check pre-requisites for the build # if [ -d /etc/gtk ]; then echo "GTK found... ok" else echo "GTK+ is needed to compile Sylpheed-claws" exit 1 ; fi # # do package-specific settings # # # prepare the build result directory # dest="$buildir/$package" prefix=/usr # rm -rf $dest # mkdir -p $dest mkdir -p $dest/install mkdir -p $dest/$prefix/$softname mkdir -p $dest/$prefix/bin touch $dest/install/slack-desc mkdir -p $dest/usr/share/applications mkdir -p $dest/usr/doc # # # prepare the directory for the build-file and assorted other # user-build related things # destsrc="$dest/usr/src/$softname-$softversion" mkdir -p $destsrc # # make a slack-desc file # cat << EOF > $dest/install/slack-desc $softname: $softname ( $softversion ) $softname: $softname: A GTK+ based, lightweight and fast e-mail client $softname: and news reader. $softname: $softname: see also: http://claws.sylpheed.org/ $softname: $softname: $softname: $softname: $softname: Compiled by Imexius (imexius@gmail.com) EOF # # loop over expanded package source files # cd $buildir for file in \ $softname-$softversion.tar.* \ ; do ( if [ "$(echo $file | grep ".tar.bz2" )" ]; then srcdir="$(basename $file .tar.bz2)" rm -rf $srcdir tar jxvf $file cd $srcdir elif [ "$(echo $file | grep ".tar.gz" )" ]; then srcdir="$(basename $file .tar.gz)" rm -rf $srcdir tar zxvf $file cd $srcdir fi # # make the package-dependent directories # mkdir -p $dest/usr/doc/$srcdir # # set target permissions # chown -R root:root . 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 {} \; # # prepare the build-log-file # touch "$buildir/$softname-info.txt" # # # configure package for compilation # cat <<"EOF" >>"$buildir/$softname-info.txt" -- configure ----- EOF export CFLAGS="-O2 -march=$arch -mtune=$cpu" export CXXFLAGS="-O2 -march=$arch -mtune=$cpu" ./configure \ --prefix=$prefix \ 2>&1 | tee -a "$buildir/$softname-info.txt" # # make package # cat <<"EOF" >>"$buildir/$softname-info.txt" -- make ----- EOF make $numjobs \ 2>&1 | tee -a "$buildir/$softname-info.txt" # # install package to the target directory # cat <<"EOF" >>"$buildir/$softname-info.txt" -- make install ----- EOF make install DESTDIR=$dest \ 2>&1 | tee -a "$buildir/$softname-info.txt" # # do a normal install too, mostly needed for multiple and dependent packages # # make install # # add 'default' files # cp -a \ AUTHORS COPYING INSTALL NEWS README TODO \ $dest/usr/doc/$srcdir # # as per package rules: add the build-file itself # cp "$buildir/build-$softname.sh" \ "$destsrc/build-$softname.sh" chmod a+x "$destsrc/build-$softname.sh" # # generate an executable script that can be used to get the source # cat < "$destsrc/getsrc.sh" # # get the source(s) script # wget -c $srcurl EOF chmod a+x "$destsrc/getsrc.sh" # # # post-build processing: # - strip executables # - compress man-pages # ( 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 for mandir in $(find . -name man -type d) ; do if [ -d $mandir ]; then ( cd $mandir find . -type f -name "*.?" -exec gzip -9 {} \; ) fi done ) ) done # # real packaging work: # chown -R root:root $dest/usr/bin chown -R root:root $dest/$prefix/$softname # cd $dest makepkg -l y -c n $dest.tgz md5sum $dest.tgz >$dest.md5