Tool per la pacchettizzazione
Inviato: sab 18 ott 2008, 10:39
esiste un tool o uno script che genera pacchetti in automatico partendo dai sorgenti?
Se vuoi un "tool automatico", ma sarei anche io per gli slackbuild, guarda slacktrackhuvber ha scritto:esiste un tool o uno script che genera pacchetti in automatico partendo dai sorgenti?
Basta segnalarlo in ARCH, ma attento.tigerwalk ha scritto:Scusate se approfitto della discussione, sto dando un'occhiata a diversi slackbuild. Il mio target è di compilare i programmi per ARCH=i686. Il problema è che sono completamente a digiuno...!
Ad esempio, volendo ricompilare ddrescue per la mia ARCH, basta segnalarlo nella $ARCH oppure va inserita qualche altra opzione nello slackbuild originale?
Grazie.
Codice: Seleziona tutto
#!/bin/sh
# Heavily based on the Slackware 10.0 SlackBuild
#
CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package
NAME=ddrescue
VERSION=1.8
ARCH=${ARCH:-i686}
BUILD=1tw
#
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 [ ! -d $TMP ]; then
mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
mkdir -p $PKG
fi
#
#echo "| Start SlackBuild $NAME-$VERSION |"
#
mkdir -p $PKG
cd $TMP
#tar xzvf $CWD/$NAME-$VERSION.tar.gz
tar xjvf $CWD/$NAME-$VERSION.tar.bz2
#
cd $NAME-$VERSION
#zcat $CWD/$NAME.diff.gz | patch -p1 -E --backup --verbose
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
chown -R root.root .
#
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr \
--disable-static \
--mandir=/usr/man \
--program-prefix= \
--program-suffix= \
--disable-debug \
--enable-color \
--enable-multibuffer \
--enable-nanorc \
--build=$CHOST-slackware-linux
#sed -i "s|-O2|-O2 -march=i486 -mtune=i686|g" Makefile
#sed -i "s|/usr/local|/usr|g" Makefile
#
make -j3 || exit 1
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a \
AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \
$PKG/usr/doc/$NAME-$VERSION
#
cd $PKG
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
#
#gzip -9 $PKG/usr/man/*/*
find $PKG/usr/man -type f -exec gzip -9 {} \;
#gzip -9 $PKG/usr/info/*
#
#chown -R root.bin $PKG/usr/bin
#
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
#
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n ../$NAME-$VERSION-$ARCH-$BUILD.tgz
mv $TMP/$NAME-$VERSION-$ARCH-$BUILD.tgz $CWD
#
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/$NAME-$VERSION
rm -rf $PKG
fi
Codice: Seleziona tutto
#!/bin/sh
# Slackware 12.1 SlackBuild
# http://ftp.gnu.org/gnu/ddrescue/
set -e # così ti esce se c'è un errore, so che molti non amano questo comando, ma in uno slackbuild lo ritengo essenziale
CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-ddrescue
NAME=ddrescue
VERSION=1.8
ARCH=i686
BUILD=2mtx
SOURCE=http://ftp.gnu.org/gnu/ddrescue/$NAME-$VERSION.tar.bz2
if [ ! -e $NAME-$VERSION.tar.bz2 ]; then
wget -c $SOURCE
fi
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
mkdir -p $PKG
fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"
elif [ "$ARCH" = "athlon64" ]; then
SLKCFLAGS="-O2 -march=athlon64 -pipe"
elif [ "$ARCH" = "athlonxp" ]; then
SLKCFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
fi
cd $TMP
tar xvjf $CWD/$NAME-$VERSION.tar.bz2
cd $NAME-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
CFLAGS="${SLKCFLAGS}" \
CXXFLAGS="${SLKCFLAGS}" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--infodir=/usr/info
make -j2
make install-strip DESTDIR=$PKG
( cd $PKG
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
find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null
)
if [ ! -d $PKG/usr/doc/$NAME-$VERSION ]; then
mkdir -p $PKG/usr/doc/$NAME-$VERSION
fi
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README $PKG/usr/doc/$NAME-$VERSION
rm $PKG/usr/info/dir
if [ -d $PKG/usr/info ]; then
find $PKG/usr/info -type f -name "*.info" -exec gzip -9f {} \;
fi
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP
fi