summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0b337a8f68afc92568627ffcd2cc19dac69986d5 (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
# Maintainer: Patrick Northon <northon_patrick3@yahoo.ca>

pkgbase=assaultcube
pkgname=(${pkgbase}-client ${pkgbase}-server ${pkgbase}-common)
pkgver=1.3.0.2
pkgrel=4
pkgdesc='A game based on the open-source AssaultCube first-person shooter (FPS)'
arch=('i686' 'x86_64')
url='https://assault.cubers.net/'
license=('ZLIB' 'custom')
depends=('zlib' 'gcc-libs')
makedepends=('mesa' 'clang' 'sdl2' 'sdl2_image' 'openal' 'libvorbis' 'libgl')
source=("$pkgbase-$pkgver.tar.gz::https://github.com/assaultcube/AC/archive/refs/tags/v${pkgver}.tar.gz"
        "${pkgbase}"
        "${pkgbase}-server"
        "${pkgbase}.desktop"
        "systemd-${pkgbase}-sysuser.conf"
        "systemd-${pkgbase}-server.service")
sha512sums=('8488c399036532859f7c83d094ac1443c52aa6367d106cc5889b80353ff1d501f7b8ae3b51e34b03215cc88dacc5f29488635047ce90291c601f8f7582498685'
            '6ecfb0320f8f63d3c220032a0e267bd81f89ed33d415991a83e7a662769eec6dcdf374fcf0d4f7e893c0dcd58598379d49cc52550b5907769fdbc6c428013d91'
            '363fbee6e2561677eb7bc1f9d77e1431758063f3ceaf86fd0878c0e376fb9921ad90285dc961b6afaf9b40fa545f9cbb659aaf039e134b8b4c85510916d1a4e2'
            'a611e3ce695f567be1b5d396bdc27d28db078c9c8a8bc56526537309d7db12ac507a6819a8f53bb871626d40a7e2b083dd8669ac1bcec279102a918114487467'
            '1506fd102d70b7cbe838f2e55725cd2f70c15174b119b077060f6e20041826fef3f6d6a18c4138a3d883162692258d2057f5511682048dfeaafc613e5c63f580'
            'b27d30c162344119acda03943dc93cc677c8373cd54e8aec14083dfbef42ecb15cedf6e9412e9530d4daa8ebb62b882de016f62ecbcdcc838af42a3f8f3b2b97')

_srcdir="AC-${pkgver}"

_cflags=${CLANG_CFLAGS:-$CFLAGS}
check_option 'lto' 'y' && _cflags+=' -flto=auto'
_cxxflags=${CLANG_CXXFLAGS:-$CXXFLAGS}
check_option 'lto' 'y' && _cxxflags+=' -flto=auto'

prepare() {
	cd "${_srcdir}"
	sed -i 's/libSDL-1.2/libSDL-2.0/' 'check_install.sh'
	sed -i 's|CUBE_OPTIONFILE=-Cconfig/servercmdline.txt|CUBE_OPTIONFILE=-C/etc/assaultcube/servercmdline.txt|' 'server.sh'
	sed -i 's|//#define PRODUCTION|#define PRODUCTION|' 'source/src/cube.h'
	rm -rf 'source/include'
	cd 'source/src'
	sed -i "s/CXXFLAGS= -O3/CXXFLAGS= ${_cxxflags}/" 'Makefile'
}

build() {
	cd "${_srcdir}/source/src"
	CC=clang CXX=clang++ CFLAGS="${_cflags}" CXXFLAGS="${_cxxflags}" make
	make install
}

package_assaultcube-common() {
	install -dm755 "${pkgdir}/usr/share/games/${pkgbase}"
	
	cp -r "${_srcdir}"/{config,docs,bot} "${pkgdir}/usr/share/games/${pkgbase}"
	
	rm "${pkgdir}/usr/share/games/${pkgbase}/config/servercmdline.txt"
	find "${pkgdir}/usr/share/games/${pkgbase}/docs" -type f -exec chmod -R 0644 '{}' \;
	find "${pkgdir}/usr/share/games/${pkgbase}/docs" -type d -exec chmod -R 0755 '{}' \;
	
	install -Dm644 "${_srcdir}"/{README.html,README.md,SECURITY.md,GOVERNANCE.md} -t "${pkgdir}/usr/share/games/${pkgbase}"
	install -Dm644 "${_srcdir}/docs/package_copyrights.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_assaultcube-client() {
	depends+=('assaultcube-common' 'sdl2' 'sdl2_image' 'openal' 'libvorbis' 'libgl')
	
	install -dm755 "${pkgdir}/usr/share/games/${pkgbase}"
	install -Dm755 "${_srcdir}"/{assaultcube.sh,check_install.sh,install_or_remove_menuitem.sh} \
		-t "${pkgdir}/usr/share/games/${pkgbase}"
	install -Dm755 "${_srcdir}/bin_unix"/*_client "${pkgdir}/usr/share/games/${pkgbase}/bin_unix/native_client"
	cp -r "${_srcdir}"/{demos,mods,packages} "${pkgdir}/usr/share/games/${pkgbase}"
	install -Dm644 "${_srcdir}/packages/misc/icon.png" "${pkgdir}/usr/share/pixmaps/${pkgbase}.png"
	install -Dm644 "${pkgbase}.desktop" -t "${pkgdir}/usr/share/applications"
	install -Dm755 "${pkgbase}" "${pkgdir}/usr/bin/${pkgbase}"
}

package_assaultcube-server() {
	depends+=('assaultcube-common' 'systemd')
	backup=('etc/assaultcube/servercmdline.txt')
	
	install -Dm755 "${pkgbase}-server" -t "${pkgdir}/usr/bin"
	install -Dm644 "${_srcdir}/config/servercmdline.txt" -t "${pkgdir}/etc/${pkgbase}"
	
	install -Dm755 "${_srcdir}/bin_unix"/*_server "${pkgdir}/usr/share/games/${pkgbase}/bin_unix/native_server"
	install -Dm755 "${_srcdir}"/{server.sh,server_wizard.sh} -t "${pkgdir}/usr/share/games/${pkgbase}"
	
	install -Dm644 "systemd-${pkgbase}-sysuser.conf" "${pkgdir}/usr/lib/sysusers.d/${pkgbase}.conf"
	install -Dm644 "systemd-${pkgbase}-server.service" "${pkgdir}/usr/lib/systemd/system/${pkgbase}-server.service"
}