summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c3b017e4a0dcf1644d9d54416497c4184517776a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# ET:Legacy should be cross-compiled in 32 bit for compatibility reason with existing 32 bit only mods.
# This package requires multilib-devel and [multilib] enabled
# This package requires 32 bits gfx and sound drivers
# Other optional deps: '(lib32-)ncurses' '(lib32-)jansson'

pkgbase=etlegacy32-git
pkgname=('etlegacy32-git' 'etlegacy32-mod-git')
pkgver=2.81.1.60.g3359b5f21
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.etlegacy.com/"
license=('GPL3')
depends=('lib32-libpng' 'lib32-alsa-lib' 'lib32-freetype2' 'lib32-glew' 'lib32-openal' 'lib32-sdl2' 'lib32-sqlite' 'lib32-libpulse' 'lib32-cjson')
makedepends=('git' 'cmake' 'zip' 'lib32-libjpeg-turbo' 'lib32-libtheora' 'lib32-libvorbis' 'lib32-lua' 'lib32-minizip' 'lib32-curl' )
options=(!strip)
source=('git+https://github.com/etlegacy/etlegacy.git')
md5sums=('SKIP')
_gitname=etlegacy

pkgver() {
    cd "$srcdir/$_gitname"
    git describe --always | sed -r 's/^v//;s/-/./g;'
}

prepare() {
    # cleanup disabled as it removes custom hud menus
    # [[ -e "$HOME/.etlegacy/legacy" ]] && cd $HOME/.etlegacy/legacy && rm -f *.so && rm -f *.dat
    cd "$srcdir/$_gitname"
    rm -rf CMakeFiles include legacy glsl
    rm -f etl etlded *.so *.a *.cmake CMakeCache.txt install_manifest.txt
}

build() {
    cd "$srcdir/$_gitname"

    # build type and path
    cmakeopts+=(
        "-D CMAKE_BUILD_TYPE=Release"
        "-D CMAKE_INSTALL_PREFIX=/usr"
        "-D INSTALL_DEFAULT_BASEDIR=/usr/lib/etlegacy"
        "-D INSTALL_DEFAULT_BINDIR=bin"
        "-D INSTALL_DEFAULT_MODDIR=lib/etlegacy"
    )

    # arch && cross-compilation
    if [[ "$CARCH" == "i686" ]]; then
        cmakeopts+=(
            "-D CMAKE_LIBRARY_PATH=/usr/lib"
            "-D CMAKE_INCLUDE_PATH=/usr/include"
            "-D CMAKE_PREFIX_PATH=/usr/lib/cmake"
            "-D CROSS_COMPILE32=0"
        )
    else
        cmakeopts+=(
            "-D CMAKE_LIBRARY_PATH=/usr/lib32"
            "-D CMAKE_INCLUDE_PATH=/usr/include"
            "-D CMAKE_PREFIX_PATH=/usr/lib32/cmake"
            "-D CROSS_COMPILE32=1"
        )
    fi

    # options
    cmakeopts+=(
        "-D BUNDLED_LIBS=0"
        "-D FEATURE_AUTOUPDATE=0"
        "-D FEATURE_OMNIBOT=1"
        "-D INSTALL_OMNIBOT=0"
    )

    echo "OPTS" ${cmakeopts[@]}
    cmake ${cmakeopts[@]} .
    make
}

package_etlegacy32-git() {
    pkgdesc="Wolfenstein: Enemy Territory 2.60b compatible client/server (etlegacy engine, 32 bit)"
    depends=('etlegacy32-mod-git')
    depends_i686=('etlegacy32-mod-git' 'alsa-lib' 'curl' 'freetype2' 'gcc-libs' 'glew' 'libjpeg-turbo' 'libtheora' 'libvorbis' 'lua' 'minizip' 'openal' 'sdl2' 'sqlite' 'cjson')
    depends_x86_64=('etlegacy32-mod-git' 'lib32-alsa-lib' 'lib32-curl' 'lib32-freetype2' 'lib32-gcc-libs' 'lib32-glew' 'lib32-libjpeg-turbo' 'lib32-libtheora' 'lib32-libvorbis' 'lib32-lua' 'lib32-minizip' 'lib32-openal' 'lib32-sdl2' 'lib32-sqlite' 'lib32-cjson')
    provides=('etlegacy32' 'etlegacy')
    conflicts=('etlegacy32' 'etlegacy')
    backup=('etc/xdg/etlegacy/etmain/etl_server.cfg'
            'etc/xdg/etlegacy/etmain/legacy.cfg'
            'etc/xdg/etlegacy/etmain/campaigncycle.cfg'
            'etc/xdg/etlegacy/etmain/lmscycle.cfg'
            'etc/xdg/etlegacy/etmain/mapvotecycle.cfg'
            'etc/xdg/etlegacy/etmain/objectivecycle.cfg')
    install=etlegacy.install

    cd "$srcdir/$_gitname"

    # engine
    make DESTDIR="$pkgdir/" install

    # mod
    rm -rf $pkgdir/usr/lib/$_gitname/legacy

    # assets
    ln -s /usr/share/enemy-territory/etmain/{pak0,pak1,pak2}.pk3 $pkgdir/usr/lib/$_gitname/etmain/

    # doc
    mkdir -p $pkgdir/usr/share/doc/$_gitname
#    mv $pkgdir/usr/lib/$_gitname/INSTALL.txt $pkgdir/usr/share/doc/$_gitname/
    install -m 644 docs/game/anticheat.html $pkgdir/usr/share/doc/$_gitname/

    # license
    mkdir -p $pkgdir/usr/share/licenses/$_gitname
#    mv $pkgdir/usr/lib/$_gitname/COPYING.txt $pkgdir/usr/share/licenses/$_gitname/

    # systemd
    mkdir -p $pkgdir/etc/xdg/$_gitname/etmain
    mkdir -p $pkgdir/usr/lib/systemd/system
    install -m 644 misc/etlegacy.conf $pkgdir/etc/xdg/$_gitname/
    sed -i 's/@BIN_DESCRIBE@/(32 bit)/g' misc/etlegacy.service.in
    sed -i 's/@BIN_SUFFIX@/.i386/g' misc/etlegacy.service.in
    install -m 644 misc/etlegacy.service.in $pkgdir/usr/lib/systemd/system/etlegacy-x86.service

    # config
    mv $pkgdir/usr/lib/$_gitname/etmain/*.cfg $pkgdir/etc/xdg/$_gitname/etmain/
    ln -s /etc/xdg/$_gitname/etmain/{etl_server,legacy,{campaign,lms,mapvote,objective}cycle}.cfg $pkgdir/usr/lib/$_gitname/etmain/

    # server
    mkdir -p $pkgdir/var/lib/$_gitname-server
    ln -s /etc/xdg/$_gitname/etmain $pkgdir/var/lib/$_gitname-server/
}

package_etlegacy32-mod-git() {
    pkgdesc="Wolfenstein: Enemy Territory 2.60b compatible client/server (etlegacy mod, 32 bit)"
    depends=('enemy-territory-data' 'geoip-database')
    optdepends=('etlegacy-omnibot: artificial intelligence (AI) controlled opponent')
    provides=('etlegacy32-mod' 'etlegacy-mod')
    conflicts=('etlegacy32-mod' 'etlegacy-mod')

    cd "$srcdir/$_gitname"

    # mod
    mkdir -p $pkgdir/usr/lib/$_gitname/legacy
    install legacy/{*.pk3,qagame.*.so} -t $pkgdir/usr/lib/$_gitname/legacy

    # geoip
    ln -s /usr/share/GeoIP/GeoIP.dat $pkgdir/usr/lib/$_gitname/legacy
}

# vim:set ts=4 sw=2 et: