dev-qt/qtopengl: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / games-strategy / wesnoth / wesnoth-1.14.9.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake toolchain-funcs user xdg
7
8 DESCRIPTION="Battle for Wesnoth - A fantasy turn-based strategy game"
9 HOMEPAGE="http://www.wesnoth.org
10         https://github.com/wesnoth/wesnoth"
11 SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 # uneven minor versions are development versions
16 if [[ $(( $(ver_cut 2) % 2 )) == 0 ]] ; then
17         KEYWORDS="~amd64 ~x86"
18 fi
19 IUSE="dbus dedicated doc fribidi libressl nls server"
20
21 RDEPEND="
22         >=dev-libs/boost-1.50:=[nls,threads,icu]
23         >=media-libs/libsdl2-2.0.4:0[joystick,video,X]
24         !dedicated? (
25                 dev-libs/glib:2
26                 !libressl? ( dev-libs/openssl:0= )
27                 libressl? ( dev-libs/libressl:0= )
28                 >=media-libs/fontconfig-2.4.1
29                 >=media-libs/sdl2-image-2.0.0[jpeg,png]
30                 >=media-libs/sdl2-mixer-2.0.0[vorbis]
31                 >=media-libs/sdl2-ttf-2.0.12
32                 media-libs/libvorbis
33                 >=x11-libs/pango-1.22.0
34                 >=x11-libs/cairo-1.10.0
35                 sys-libs/readline:0=
36                 dbus? ( sys-apps/dbus )
37                 fribidi? ( dev-libs/fribidi )
38         )"
39 DEPEND="${RDEPEND}
40         x11-libs/libX11
41 "
42 BDEPEND="
43         sys-devel/gettext
44         virtual/pkgconfig
45 "
46
47 pkg_setup() {
48         enewgroup ${PN}
49         enewuser ${PN} -1 /bin/bash -1 ${PN}
50 }
51
52 src_prepare() {
53         cmake_src_prepare
54
55         if ! use doc ; then
56                 sed -i \
57                         -e '/manual/d' \
58                         doc/CMakeLists.txt || die
59         fi
60
61         # respect LINGUAS (bug #483316)
62         if [[ ${LINGUAS+set} ]] ; then
63                 local lang langs=()
64                 for lang in $(cat po/LINGUAS) ; do
65                         has ${lang} ${LINGUAS} && langs+=( ${lang} )
66                 done
67                 echo "${langs[@]}" > po/LINGUAS || die
68         fi
69 }
70
71 src_configure() {
72         filter-flags -ftracer -fomit-frame-pointer
73         if [[ $(gcc-major-version) -eq 3 ]] ; then
74                 filter-flags -fstack-protector
75                 append-flags -fno-stack-protector
76         fi
77
78         # Work around eclass
79         append-flags -UNDEBUG
80
81         if use dedicated || use server ; then
82                 mycmakeargs=(
83                         -DENABLE_CAMPAIGN_SERVER="ON"
84                         -DENABLE_SERVER="ON"
85                         -DSERVER_UID="${PN}"
86                         -DSERVER_GID="${PN}"
87                         -DFIFO_DIR="/run/wesnothd"
88                         )
89         else
90                 mycmakeargs=(
91                         -DENABLE_CAMPAIGN_SERVER="OFF"
92                         -DENABLE_SERVER="OFF"
93                         )
94         fi
95         mycmakeargs+=(
96                 -Wno-dev
97                 -DENABLE_GAME="$(usex !dedicated)"
98                 -DENABLE_DESKTOP_ENTRY="$(usex !dedicated)"
99                 -DENABLE_NLS="$(usex nls)"
100                 -DENABLE_NOTIFICATIONS="$(usex dbus)"
101                 -DENABLE_FRIBIDI="$(usex fribidi)"
102                 -DENABLE_STRICT_COMPILATION="OFF"
103                 )
104         cmake_src_configure
105 }
106
107 src_install() {
108         local DOCS=( README.md changelog.md )
109         cmake_src_install
110         if use dedicated || use server; then
111                 rmdir "${ED}/run/wesnothd" || die
112                 newinitd "${FILESDIR}"/wesnothd.rc-r1 wesnothd
113         fi
114 }