Ticket #5157: 0ad.SlackBuild

File 0ad.SlackBuild, 4.5 KB (added by Andy Alt, 6 years ago)

working, modded by ponce

Line 
1#!/bin/sh
2#
3# Slackware build script for 0.A.D.
4#
5# Copyright 2016-2017 Reedych <reedych@ya.ru>
6# Copyright 2010-2016 Erik W. Hanson, Minneapolis, MN, USA
7# All rights reserved.
8#
9# Redistribution and use of this script, with or without modification, is
10# permitted provided that the following conditions are met:
11#
12# 1. Redistributions of this script must retain the above copyright
13# notice, this list of conditions and the following disclaimer.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
16# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26PRGNAM=0ad
27VERSION=${VERSION:-0.0.23}
28RELEASE=${RELEASE:-alpha}
29BUILD=${BUILD:-1}
30TAG=${TAG:-_SBo}
31
32CWD=$(pwd)
33TMP=${TMP:-/tmp/SBo}
34PKG=$TMP/package-$PRGNAM
35OUTPUT=${OUTPUT:-/tmp}
36
37if [ -z "$ARCH" ]; then
38 case "$( uname -m )" in
39 i?86) ARCH=i586 ;;
40 arm*) ARCH=arm ;;
41 *) ARCH=$( uname -m ) ;;
42 esac
43fi
44
45if [ "$ARCH" = "i586" ]; then
46 SLKCFLAGS="-O2 -march=i586 -mtune=i686"
47 LIBDIRSUFFIX=""
48elif [ "$ARCH" = "i686" ]; then
49 SLKCFLAGS="-O2 -march=i686 -mtune=i686"
50 LIBDIRSUFFIX=""
51elif [ "$ARCH" = "x86_64" ]; then
52 SLKCFLAGS="-O2 -fPIC"
53 LIBDIRSUFFIX="64"
54else
55 SLKCFLAGS="-O2"
56 LIBDIRSUFFIX=""
57fi
58
59set -eu
60
61rm -rf $PKG
62mkdir -p $TMP $PKG $OUTPUT
63cd $TMP
64rm -rf $PRGNAM-$VERSION-$RELEASE
65tar xvf $CWD/$PRGNAM-$VERSION-$RELEASE-unix-build.tar.xz
66cd $PRGNAM-$VERSION-$RELEASE
67chown -R root:root .
68find -L . \
69 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
70 -o -perm 511 \) -exec chmod 755 {} \; -o \
71 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
72 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
73
74unset CPPFLAGS
75
76export CFLAGS="$SLKCFLAGS"
77export CXXFLAGS="$SLKCFLAGS -DU_USING_ICU_NAMESPACE=1"
78export LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}"
79export SDL2_CONFIG="/usr/bin/sdl2-config"
80
81# Fix boost names, include paths and remove isystem
82sed -i 's|-mt||g' build/premake/extern_libs5.lua
83sed -i 's|/usr/local/include|/usr/include|' build/premake/{extern_libs5.lua,premake5.lua}
84sed -i 's|-isystem |-I|' build/premake/premake5/{src/tools/gcc.lua,tests/tools/test_gcc.lua}
85
86# build/workspaces/update-workspaces.sh
87# have a root check, let's disable it.
88patch -p1 < $CWD/disable-root-check.patch
89
90build/workspaces/update-workspaces.sh \
91 --without-pch \
92 --bindir=/usr/games \
93 --datadir=/usr/share/games/0ad \
94 --libdir=/usr/lib${LIBDIRSUFFIX}/0ad \
95 --${ATLAS:-disable}-atlas
96
97sed -i 's|-isystem |-I|g' build/workspaces/gcc/*.make
98verbose=1 make CONFIG=Release -C build/workspaces/gcc
99
100mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/0ad
101cp binaries/system/*.so* $PKG/usr/lib${LIBDIRSUFFIX}/0ad
102chmod 0755 $PKG/usr/lib${LIBDIRSUFFIX}/0ad/*
103
104# install additional data - l10n, etc.
105mkdir -p $PKG/usr/share/games
106cp -r binaries/data $PKG/usr/share/games/0ad
107chmod 0755 $PKG/usr/share/games/0ad
108
109install -Dm 0755 binaries/system/pyrogenesis $PKG/usr/games/pyrogenesis
110
111[ -e binaries/system/ActorEditor ] && \
112install -Dm 0755 binaries/system/ActorEditor $PKG/usr/libexec/0ad/bin/ActorEditor
113
114install -Dm 0644 build/resources/0ad.desktop $PKG/usr/share/applications/0ad.desktop
115install -Dm 0644 build/resources/0ad.png $PKG/usr/share/pixmaps/0ad.png
116install -Dm 0755 build/resources/0ad.sh $PKG/usr/games/0ad
117
118sed -i "s,/usr/bin/,/usr/games/," $PKG/usr/games/0ad
119sed -i "s,/usr/bin/,/usr/games/," $PKG/usr/share/applications/0ad.desktop
120
121#find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
122# | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
123
124mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
125cp -a LICENSE.txt README.txt license_dbghelp.txt license_gpl-2.0.txt license_lgpl-2.1.txt \
126 $PKG/usr/doc/$PRGNAM-$VERSION
127cp binaries/system/readme.txt \
128 $PKG/usr/doc/$PRGNAM-$VERSION/README-options.txt
129cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
130
131mkdir -p $PKG/install
132cat $CWD/slack-desc > $PKG/install/slack-desc
133cat $CWD/doinst.sh > $PKG/install/doinst.sh
134
135cd $PKG
136/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}