blob: ca0be0265bc5bef47cb678b5f663be20511ed025 (
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
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop flag-o-matic toolchain-funcs wrapper xdg
DESCRIPTION="Sauerbraten is a FOSS game engine (Cube 2) with freeware game data (Sauerbraten)"
HOMEPAGE="http://sauerbraten.org/"
SRC_URI="https://downloads.sourceforge.net/sauerbraten/sauerbraten/2020_11_29/sauerbraten_${PV//./_}_linux.tar.bz2"
S="${WORKDIR}"/${PN}
LICENSE="ZLIB freedist"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug dedicated server"
DEPEND="
>=net-libs/enet-1.3.6:1.3
sys-libs/zlib
!dedicated? (
media-libs/libsdl2[X,opengl]
media-libs/sdl2-image
media-libs/sdl2-mixer
virtual/opengl
virtual/glu
x11-libs/libX11
)
"
RDEPEND="
${DEPEND}
acct-group/sauerbraten
dedicated? ( acct-user/sauerbraten )
"
BDEPEND="virtual/pkgconfig"
PATCHES=(
# Respect CXXFLAGS, LDFLAGS
"${FILESDIR}"/${PN}-2020.12.27-respect-FLAGS-don-t-strip-symbols.patch
# Patch Makefile to use system enet instead of bundled
"${FILESDIR}"/${PN}-2020.12.27-unbundle-enet.patch
# Don't use freetype-config, it's obsolete
"${FILESDIR}"/${PN}-2020.12.27-use-pkg-config-for-freetype2.patch
# More sensible ways of including SDL_mixer and SDL_image. Game doesn't build w/o this.
"${FILESDIR}"/${PN}-2020.12.29-includefix.patch
)
src_prepare() {
rm -rf sauerbraten_unix bin_unix src/{include,lib,vcpp} || die
default
# Fix links so they point to the correct directory
sed -i -e 's:docs/::' README.html || die
}
src_compile() {
tc-export CXX PKG_CONFIG
if use debug ; then
append-cppflags -D_DEBUG
fi
emake -C src \
master \
$(usex dedicated "server" "$(usex server "server client" "client")")
}
src_install() {
local LIBEXECDIR="/usr/lib"
local DATADIR="/usr/share/${PN}"
local STATEDIR="/var/lib/${PN}"
if ! use dedicated ; then
# Install the game data
insinto "${DATADIR}"
doins -r data packages
# Install the client executable
exeinto "${LIBEXECDIR}"
doexe src/sauer_client
# Install the client wrapper
make_wrapper "${PN}-client" "${LIBEXECDIR}/sauer_client -q\$HOME/.${PN} -r" "${DATADIR}"
# Create menu entry
newicon -s 256 data/cube.png ${PN}.png
make_desktop_entry "${PN}-client" "Cube 2: Sauerbraten"
fi
# Install the server config files
insinto "${STATEDIR}"
doins server-init.cfg
# Install the server executables
exeinto "${LIBEXECDIR}"
doexe src/sauer_master
if use dedicated || use server ; then
doexe src/sauer_server
fi
make_wrapper "${PN}-server" \
"${LIBEXECDIR}/sauer_server -k${DATADIR} -q${STATEDIR}"
make_wrapper "${PN}-master" \
"${LIBEXECDIR}/sauer_master ${STATEDIR}"
# Install the server init script
cp "${FILESDIR}"/${PN}.init "${T}" || die
sed -i \
-e "s:%SYSCONFDIR%:${STATEDIR}:g" \
-e "s:%LIBEXECDIR%:${LIBEXECDIR}:g" \
-e "s:%/var/lib/%:/var/run:g" \
"${T}"/${PN}.init || die
newinitd "${T}"/${PN}.init ${PN}
cp "${FILESDIR}"/${PN}.conf "${T}" || die
sed -i \
-e "s:%SYSCONFDIR%:${STATEDIR}:g" \
-e "s:%LIBEXECDIR%:${LIBEXECDIR}:g" \
-e "s:%GAMES_USER_DED%:sauerbraten:g" \
-e "s:%GAMES_GROUP%:sauerbraten:g" \
"${T}"/${PN}.conf || die
newconfd "${T}"/${PN}.conf ${PN}
dodoc src/*.txt docs/dev/*.txt
docinto html
dodoc -r README.html docs/*
}
pkg_postinst() {
xdg_pkg_postinst
elog "If you plan to use map editor feature copy all map data from ${DATADIR}"
elog "to corresponding folder in your HOME/.${PN}"
}
|