refactoring

This commit is contained in:
Gwenhael Le Moine 2010-04-14 14:54:38 +07:00
parent df352db86b
commit 3b40666c84

View file

@ -1,27 +1,26 @@
#!/bin/sh -x #!/bin/sh -x
# variables # variables
TMP=/tmp
CWD=$(pwd) CWD=$(pwd)
APP_NAME=$(basename $CWD) APP_NAME=$(basename $CWD)
PKG=$TMP/package-$APP_NAME
VERSION=1.11b VERSION=1.11b
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
ARCH=$(uname -m) ARCH=$(uname -m)
BUILD=1cyco BUILD=1
PACKAGER=cyco
TMP=/tmp/$PACKAGER
PKG=$TMP/pkg-$APP_NAME
PREFIX=/usr PREFIX=/usr
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
SLCKFLAGS="-O2"
case $ARCH in case $ARCH in
"x86_64") "x86_64")
SLCKFLAGS="-fPIC -O2" SLCKFLAGS="$SLCKFLAGS -fPIC"
;; ;;
*) *)
SLCKFLAGS="-O2"
esac esac
# nettoyage préalable # nettoyage préalable
@ -30,30 +29,25 @@ rm -fr $PKG $TMP/$APP_NAME-$VERSION
mkdir -p $PKG mkdir -p $PKG
# mise en place # mise en place
cd $TMP ( cd $TMP
[ ! -e $CWD/$APP_NAME-$VERSION.tar.?z* ] && \ [ ! -e $CWD/$APP_NAME-$VERSION.tar.?z* ] && \
wget -c http://mirror.cinquix.com/pub/savannah/eliot/releases/$APP_NAME-$VERSION.tar.gz \ wget -c http://mirror.cinquix.com/pub/savannah/eliot/releases/$APP_NAME-$VERSION.tar.gz \
-O $CWD/$APP_NAME-$VERSION.tar.gz -O $CWD/$APP_NAME-$VERSION.tar.gz
tar xf $CWD/$APP_NAME-$VERSION.tar.?z* tar xf $CWD/$APP_NAME-$VERSION.tar.?z*
cd $APP_NAME-$VERSION )
( cd $TMP/$APP_NAME-$VERSION
# configuration # configuration
CFLAGS=$SLCKFLAGS \ CFLAGS=$SLCKFLAGS \
CPPFLAGS=$SLCKFLAGS \ CPPFLAGS=$SLCKFLAGS \
./configure \ ./configure \
--prefix=$PREFIX \ --prefix=$PREFIX \
--mandir=$PREFIX/man \ --libdir=$PREFIX/lib$(echo $ARCH | grep -o 64)
--libdir=$PREFIX/lib$(echo $ARCH | grep -o 64) \
--infodir=$PREFIX/info
# just close your eyes and let's pretend these don't exist # just close your eyes and let's pretend these don't exist
case $ARCH in
"x86_64")
sed -i 's|/usr/lib[^6]|/usr/lib64 |g' $(find . -name Makefile)
;;
*)
esac
sed -i 's|-lreadline|-lncursesw -lreadline|g' $(find . -name Makefile) sed -i 's|-lreadline|-lncursesw -lreadline|g' $(find . -name Makefile)
echo "$ARCH" | grep -q 64 && \
sed -i 's|/usr/lib[^6]|/usr/lib64 |g' $(find . -name Makefile)
for m in qt/*.moc.cpp ; do for m in qt/*.moc.cpp ; do
mv $m $m.bkp ; mv $m $m.bkp ;
moc ${m%moc.cpp}h > $m ; moc ${m%moc.cpp}h > $m ;
@ -73,14 +67,15 @@ for d in $DICOS ; do
wget -c http://dl.sv.nongnu.org/releases/eliot/dict/$d -O $CWD/$d wget -c http://dl.sv.nongnu.org/releases/eliot/dict/$d -O $CWD/$d
cp $CWD/$d $PKG$PREFIX/share/$APP_NAME/ cp $CWD/$d $PKG$PREFIX/share/$APP_NAME/
done done
)
# correction # correction
cd $PKG chown -R root:root $PKG/*
chown -R root:root *
mkdir -p $PKG/usr/doc/$APP_NAME-$VERSION mkdir -p $PKG/usr/doc/$APP_NAME-$VERSION
cd $TMP/$APP_NAME-$VERSION ( cd $TMP/$APP_NAME-$VERSION
cp -R $DOCS $PKG/usr/doc/$APP_NAME-$VERSION cp -R $DOCS $PKG/usr/doc/$APP_NAME-$VERSION
)
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \; [ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*.info*" -exec gzip -9f {} \; [ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*.info*" -exec gzip -9f {} \;
@ -110,5 +105,6 @@ $APP_NAME:
EOF EOF
# empaquetage # empaquetage
cd $PKG ( cd $PKG
makepkg -l y -c n $TMP/$APP_NAME-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD.txz makepkg -l y -c n $TMP/$APP_NAME-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD.txz
)