#!/bin/sh ################### url= src= pkgbase= vers= arch=i386 build=P1 pkg=`echo $pkgbase"-"$vers"-"$arch"-"$build".tgz"` DOCS="README ../PlamoBuild.$src" OPT_CONFIG='' ################### compress() { for i in $P/usr/lib $P/lib ; do echo "compressing $i" if [ -d $i ]; then ( cd $i for j in *.so* ; do echo "j:$j" if [ ! -L $j ]; then chk=`file $j | grep "not stripped"` if [ ! "$chk.x" = ".x" ]; then echo "stripping -g $j" strip -g $j fi fi done for j in *.a ; do chk=`file $j | grep "ar archive"` if [ ! "$chk.x" = "." ]; then echo "ranlib and stripping -g $j" ranlib $j strip -g $j fi done ) fi done for i in $P/usr/bin $P/usr/sbin $P/bin $P/sbin ; do echo "compressing $i" if [ -d $i ]; then ( cd $i for j in * ; do echo "j:$j" if [ ! -L $j ]; then chk=`file $j | grep "not stripped"` if [ ! "$chk.x" = ".x" ]; then echo "stripping $j" strip $j fi fi done ) fi done for i in 1 2 3 4 5 6 7 8 ; do if [ -d $P/usr/share/man/man$i ]; then ( cd $P/usr/share/man/man$i ; for j in *.$i ; do if [ -h $j ] ; then LN_TARGET=`ls -l $j | awk '{print $11}'` rm $j ln -sf $LN_TARGET.gz $j.gz else gzip $j fi done ) fi done if [ -d $P/usr/share/info ]; then if [ -f $P/usr/share/info/dir ]; then rm -f $P/usr/share/info/dir fi for i in $P/usr/share/info/* ; do gzip -f $i done fi } getopts() { if [ $# -eq 0 ]; then opt_config=1 opt_build=1 else for i in "$@" ; do case $i in config*) opt_config=1 ;; build|make) opt_build=1 ;; package*) opt_package=1 ;; install) opt_install=1 ;; esac done fi } P=`pwd`/work docdir=$P/usr/share/doc/$src mandir=$P/usr/share/man if [ $# -eq 0 ]; then opt_config=1 opt_build=1 opt_package=1 else for i in "$@" ; do case $i in config) opt_config=1 ;; build) opt_build=1 ;; package) opt_package=1 ;; esac done fi if [ "$opt_config" = "1" ]; then if [ -f Makefile ]; then make clean fi if [ -f config.log ]; then rm -rf config.cache config.log fi PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/X11R6/lib/pkgconfig ./configure --prefix=/usr --infodir='${prefix}'/share/info --mandir='${prefix}'/share/man $OPT_CONFIG fi if [ "$opt_build" = "1" ]; then make fi if [ "$opt_package" = "1" ]; then if [ -d $P ]; then rm -rf $P fi mkdir -p $P/usr make install DESTDIR=$P mkdir -p $docdir for i in ${DOCS} ; do cp $i $docdir/`basename $i` gzip -f $docdir/`basename $i` done compress cd $P /sbin/makepkg $pkg << EOF y EOF fi if [ "$opt_install" = "1" ]; then if [ -f /var/log/packages/$pkgbase ]; then sudo removepkg $pkgbase fi sudo installpkg $P/$pkg fi