mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-24 10:02:29 +01:00
a376d6c58b
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
165 lines
5.7 KiB
Bash
165 lines
5.7 KiB
Bash
#!/bin/sh
|
|
|
|
# Slackware build script for unvanquished
|
|
|
|
# Copyright 2014-2016 Dimitris Zlatanidis Orestiada, Greece
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use of this script, with or without modification, is
|
|
# permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
SRCNAM=Unvanquished
|
|
PRGNAM=$(echo ${SRCNAM,,})
|
|
VERSION=${VERSION:-0.50.0}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo}
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
case "$( uname -m )" in
|
|
i?86) ARCH=i586 ;;
|
|
arm*) ARCH=arm ;;
|
|
*) ARCH=$( uname -m ) ;;
|
|
esac
|
|
fi
|
|
|
|
CWD=$(pwd)
|
|
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
|
|
|
|
EXT_DEPS="linux32-4"
|
|
if [ "$ARCH" = "x86_64" ]; then
|
|
EXT_DEPS="linux64-4"
|
|
fi
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $SRCNAM-$VERSION
|
|
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz || tar xvf $CWD/v$VERSION.tar.gz
|
|
cd $SRCNAM-$VERSION
|
|
cd daemon/external_deps
|
|
tar xvf $CWD/$EXT_DEPS.tar.bz2
|
|
cd -
|
|
chown -R root:root .
|
|
find -L . \
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
|
|
|
if [ "$ARCH" = "x86_64" ]; then
|
|
sed -i -e 's/Unvanquished/unvanquished/g' -e \
|
|
's/\/lib/\/lib64/g' -e 's/share\//share\/games\//g' archlinux/unvanquished.sh
|
|
sed -i -e 's/\/lib/\/lib64/g' -e 's/share\//share\/games\//g' archlinux/unvanquished-tty.sh
|
|
sed -i -e 's/\/usr\/lib/\/usr\/lib64/g' -e \
|
|
's/share\//share\/games\//g' archlinux/unvanquished.conf
|
|
sed -i -e 's/\/lib/\/lib64/g' -e 's/conf.d\///g' archlinux/unvanquished.service
|
|
else
|
|
sed -i -e 's/Unvanquished/unvanquished/g' -e \
|
|
's/share\//share\/games\//g' archlinux/unvanquished.sh
|
|
sed -i 's/share\//share\/games\//g' archlinux/unvanquished-tty.sh
|
|
sed -i 's/share\//share\/games\//g' archlinux/unvanquished.conf
|
|
sed -i 's/conf.d\///g' archlinux/unvanquished.service
|
|
fi
|
|
|
|
# Fix avoid download automatically dependencies
|
|
patch -p1 < $CWD/cmakelists.patch
|
|
|
|
mkdir -p build
|
|
cd build
|
|
cmake \
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DBUILD_CGAME=OFF \
|
|
-DBUILD_SGAME=OFF \
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
make
|
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
mkdir -p $PKG/usr/bin \
|
|
$PKG/etc/$PRGNAM/config \
|
|
$PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM \
|
|
$PKG/usr/lib${LIBDIRSUFFIX}/systemd/system \
|
|
$PKG/usr/share/games/$PRGNAM/pkg \
|
|
$PKG/var/lib/unvanquished-server/config
|
|
|
|
# Install contents
|
|
install -D -m0755 daemon $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
install -D -m0755 daemon-tty $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
install -D -m0755 daemonded $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
install -D -m0755 irt_core-x86*.nexe $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
install -D -m0755 nacl_helper_bootstrap $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
install -D -m0755 nacl_loader $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
|
|
|
|
cd ..
|
|
# Install server configurations
|
|
install -D -m0644 debian/configfiles/server.cfg $PKG/etc/$PRGNAM/config/server.cfg
|
|
install -D -m0644 debian/configfiles/maprotation.cfg $PKG/etc/$PRGNAM/config/maprotation.cfg
|
|
|
|
# Install starters
|
|
install -D -m0755 archlinux/$PRGNAM.sh $PKG/usr/bin/$PRGNAM
|
|
install -D -m0755 archlinux/$PRGNAM-tty.sh $PKG/usr/bin/$PRGNAM-tty
|
|
install -D -m0644 archlinux/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
|
|
install -D -m0644 archlinux/$PRGNAM.service \
|
|
$PKG/usr/lib${LIBDIRSUFFIX}/systemd/system/$PRGNAM.service
|
|
|
|
# Setup server home directory
|
|
ln -sf $PKG/etc/$PRGNAM/config/server.cfg \
|
|
$PKG/var/lib/$PRGNAM-server/config/server.cfg
|
|
ln -sf $PKG/etc/$PRGNAM/config/maprotation.cfg \
|
|
$PKG/var/lib/$PRGNAM-server/config/maprotation.cfg
|
|
|
|
# Copy the data-game
|
|
mkdir -p $PKG/usr/share/games/$PRGNAM/pkg
|
|
cp -a $CWD/$PRGNAM\_$VERSION.pk3 $PKG/usr/share/games/$PRGNAM/pkg
|
|
|
|
mkdir -p $PKG/usr/share/applications
|
|
install -D -m644 $CWD/$PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
mkdir -p $PKG/usr/share/pixmaps/
|
|
install -D -m644 debian/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a GPL.txt README.md COPYING.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
mkdir -p $PKG/install
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|