100 lines
2.6 KiB
Bash
100 lines
2.6 KiB
Bash
#!/bin/bash
|
||
|
||
# Slackware build script for GNet
|
||
# Written by Menno Duursma <druiloor@zonnet.nl>
|
||
# Modified by Robby Workman <rworkman@slackbuilds.org>
|
||
# Maintained by Ozan Türkyılmaz <ozan.turkyilmaz@gmail.com>
|
||
|
||
# This program is free software. It comes without any warranty, to
|
||
# the extent permitted by applicable law. You can redistribute it
|
||
# and/or modify it under the terms of the Do What The Fuck You Want
|
||
# To Public License, Version 2, as published by Sam Hocevar. See
|
||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
||
|
||
cd $(dirname $0) ; CWD=$(pwd)
|
||
|
||
PRGNAM=gnet
|
||
VERSION=${VERSION:-2.0.8}
|
||
BUILD=${BUILD:-2}
|
||
TAG=${TAG:-_SBo}
|
||
PKGTYPE=${PKGTYPE:-tgz}
|
||
|
||
if [ -z "$ARCH" ]; then
|
||
case "$( uname -m )" in
|
||
i?86) ARCH=i586 ;;
|
||
arm*) ARCH=arm ;;
|
||
*) ARCH=$( uname -m ) ;;
|
||
esac
|
||
fi
|
||
|
||
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
||
# the name of the created package would be, and then exit. This information
|
||
# could be useful to other scripts.
|
||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||
exit 0
|
||
fi
|
||
|
||
TMP=${TMP:-/tmp/SBo}
|
||
PKG=$TMP/package-$PRGNAM
|
||
OUTPUT=${OUTPUT:-/tmp}
|
||
|
||
if [ "$ARCH" = "i586" ]; then
|
||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||
LIBDIRSUFFIX=""
|
||
elif [ "$ARCH" = "i686" ]; then
|
||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||
LIBDIRSUFFIX=""
|
||
elif [ "$ARCH" = "x86_64" ]; then
|
||
SLKCFLAGS="-O2 -fPIC"
|
||
LIBDIRSUFFIX="64"
|
||
else
|
||
SLKCFLAGS="-O2"
|
||
LIBDIRSUFFIX=""
|
||
fi
|
||
|
||
set -e
|
||
|
||
rm -rf $PKG
|
||
mkdir -p $TMP $PKG $OUTPUT
|
||
cd $TMP
|
||
rm -rf $PRGNAM-$VERSION
|
||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||
cd $PRGNAM-$VERSION
|
||
chown -R root:root .
|
||
find . -type d -exec chmod 755 {} \;
|
||
find . -type f -exec chmod a-s,go-w {} \;
|
||
|
||
# Create target documentation dir first
|
||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||
|
||
# Build
|
||
CFLAGS="$SLKCFLAGS" \
|
||
CXXFLAGS="$SLKCFLAGS" \
|
||
./configure \
|
||
--prefix=/usr \
|
||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||
--disable-static \
|
||
--with-html-dir=/usr/doc/$PRGNAM-$VERSION \
|
||
--build=$ARCH-slackware-linux
|
||
|
||
# doc/README says to do the following ... errs on gtk-doc for me though
|
||
#make distcheck
|
||
make LDFLAGS="-lglib-2.0"
|
||
make install DESTDIR=$PKG
|
||
|
||
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||
|
||
cp -a [A-Z]* ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION
|
||
mv $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION/html
|
||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||
|
||
rm -f $PKG/usr/lib*/*.la
|
||
|
||
mkdir -p $PKG/install
|
||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||
|
||
cd $PKG
|
||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|