75 lines
2 KiB
Bash
Executable file
75 lines
2 KiB
Bash
Executable file
#!/bin/sh -x
|
|
|
|
CWD=$(pwd)
|
|
PRGNAM=$(basename $CWD)
|
|
TAG=cyco
|
|
TMP=${TMP:-/tmp/cyco}
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
VERSION=${VERSION:-$(echo $PRGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
|
ARCH=${ARCH:-$(uname -m)}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-cyco}
|
|
|
|
PREFIX=/usr
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
fi
|
|
|
|
set -e
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* || exit 1
|
|
[ ! -e $PRGNAM-$VERSION ] && mv ${PRGNAM}_* $PRGNAM-$VERSION
|
|
|
|
cd $PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
# for some reason Slackware needs -ldl to explicitely be added
|
|
sed -i 's|-lsqlite3|-lsqlite3 -ldl|' Makefile tools/m2sh/Makefile
|
|
# hmmm, no.
|
|
sed -i 's|sudo ||g' Makefile
|
|
|
|
# launching tests hangs, so we don't run them -.-
|
|
make bin/mongrel2 PREFIX=$PREFIX
|
|
|
|
mkdir -p $PKG$PREFIX/bin
|
|
make install PREFIX=$PKG$PREFIX
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a LICENSE docs/ examples/ $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cd $PKG
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
mkdir -p $PKG/install
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
$PRGNAM: $PRGNAM (Web server)
|
|
$PRGNAM:
|
|
$PRGNAM: Mongrel2 is an application, language, and network architecture agnostic
|
|
$PRGNAM: web server that focuses on web applications over serving files using
|
|
$PRGNAM: modern browser technologies.
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: http://mongrel2.org
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|