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 |
|
---|
26 | PRGNAM=0ad
|
---|
27 | VERSION=${VERSION:-0.0.23}
|
---|
28 | RELEASE=${RELEASE:-alpha}
|
---|
29 | BUILD=${BUILD:-1}
|
---|
30 | TAG=${TAG:-_SBo}
|
---|
31 |
|
---|
32 | CWD=$(pwd)
|
---|
33 | TMP=${TMP:-/tmp/SBo}
|
---|
34 | PKG=$TMP/package-$PRGNAM
|
---|
35 | OUTPUT=${OUTPUT:-/tmp}
|
---|
36 |
|
---|
37 | if [ -z "$ARCH" ]; then
|
---|
38 | case "$( uname -m )" in
|
---|
39 | i?86) ARCH=i586 ;;
|
---|
40 | arm*) ARCH=arm ;;
|
---|
41 | *) ARCH=$( uname -m ) ;;
|
---|
42 | esac
|
---|
43 | fi
|
---|
44 |
|
---|
45 | if [ "$ARCH" = "i586" ]; then
|
---|
46 | SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
---|
47 | LIBDIRSUFFIX=""
|
---|
48 | elif [ "$ARCH" = "i686" ]; then
|
---|
49 | SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
---|
50 | LIBDIRSUFFIX=""
|
---|
51 | elif [ "$ARCH" = "x86_64" ]; then
|
---|
52 | SLKCFLAGS="-O2 -fPIC"
|
---|
53 | LIBDIRSUFFIX="64"
|
---|
54 | else
|
---|
55 | SLKCFLAGS="-O2"
|
---|
56 | LIBDIRSUFFIX=""
|
---|
57 | fi
|
---|
58 |
|
---|
59 | set -eu
|
---|
60 |
|
---|
61 | rm -rf $PKG
|
---|
62 | mkdir -p $TMP $PKG $OUTPUT
|
---|
63 | cd $TMP
|
---|
64 | rm -rf $PRGNAM-$VERSION-$RELEASE
|
---|
65 | tar xvf $CWD/$PRGNAM-$VERSION-$RELEASE-unix-build.tar.xz
|
---|
66 | cd $PRGNAM-$VERSION-$RELEASE
|
---|
67 | chown -R root:root .
|
---|
68 | find -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 |
|
---|
74 | unset CPPFLAGS
|
---|
75 |
|
---|
76 | export CFLAGS="$SLKCFLAGS"
|
---|
77 | export CXXFLAGS="$SLKCFLAGS -DU_USING_ICU_NAMESPACE=1"
|
---|
78 | export LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}"
|
---|
79 | export SDL2_CONFIG="/usr/bin/sdl2-config"
|
---|
80 |
|
---|
81 | # Fix boost names, include paths and remove isystem
|
---|
82 | sed -i 's|-mt||g' build/premake/extern_libs5.lua
|
---|
83 | sed -i 's|/usr/local/include|/usr/include|' build/premake/{extern_libs5.lua,premake5.lua}
|
---|
84 | sed -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.
|
---|
88 | patch -p1 < $CWD/disable-root-check.patch
|
---|
89 |
|
---|
90 | build/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 |
|
---|
97 | sed -i 's|-isystem |-I|g' build/workspaces/gcc/*.make
|
---|
98 | verbose=1 make CONFIG=Release -C build/workspaces/gcc
|
---|
99 |
|
---|
100 | mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/0ad
|
---|
101 | cp binaries/system/*.so* $PKG/usr/lib${LIBDIRSUFFIX}/0ad
|
---|
102 | chmod 0755 $PKG/usr/lib${LIBDIRSUFFIX}/0ad/*
|
---|
103 |
|
---|
104 | # install additional data - l10n, etc.
|
---|
105 | mkdir -p $PKG/usr/share/games
|
---|
106 | cp -r binaries/data $PKG/usr/share/games/0ad
|
---|
107 | chmod 0755 $PKG/usr/share/games/0ad
|
---|
108 |
|
---|
109 | install -Dm 0755 binaries/system/pyrogenesis $PKG/usr/games/pyrogenesis
|
---|
110 |
|
---|
111 | [ -e binaries/system/ActorEditor ] && \
|
---|
112 | install -Dm 0755 binaries/system/ActorEditor $PKG/usr/libexec/0ad/bin/ActorEditor
|
---|
113 |
|
---|
114 | install -Dm 0644 build/resources/0ad.desktop $PKG/usr/share/applications/0ad.desktop
|
---|
115 | install -Dm 0644 build/resources/0ad.png $PKG/usr/share/pixmaps/0ad.png
|
---|
116 | install -Dm 0755 build/resources/0ad.sh $PKG/usr/games/0ad
|
---|
117 |
|
---|
118 | sed -i "s,/usr/bin/,/usr/games/," $PKG/usr/games/0ad
|
---|
119 | sed -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 |
|
---|
124 | mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
---|
125 | cp -a LICENSE.txt README.txt license_dbghelp.txt license_gpl-2.0.txt license_lgpl-2.1.txt \
|
---|
126 | $PKG/usr/doc/$PRGNAM-$VERSION
|
---|
127 | cp binaries/system/readme.txt \
|
---|
128 | $PKG/usr/doc/$PRGNAM-$VERSION/README-options.txt
|
---|
129 | cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
---|
130 |
|
---|
131 | mkdir -p $PKG/install
|
---|
132 | cat $CWD/slack-desc > $PKG/install/slack-desc
|
---|
133 | cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
---|
134 |
|
---|
135 | cd $PKG
|
---|
136 | /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
---|