Merge remote-tracking branch 'github/pr/550'.
[gentoo.git] / games-strategy / wesnoth / wesnoth-1.12.5.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit cmake-utils eutils multilib toolchain-funcs flag-o-matic games
7
8 DESCRIPTION="Battle for Wesnoth - A fantasy turn-based strategy game"
9 HOMEPAGE="http://www.wesnoth.org/"
10 SRC_URI="mirror://sourceforge/wesnoth/${P}.tar.bz2"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
15 IUSE="dbus dedicated doc fribidi nls server"
16
17 RDEPEND=">=media-libs/libsdl-1.2.7:0[joystick,video,X]
18         media-libs/sdl-net
19         !dedicated? (
20                 >=media-libs/sdl-ttf-2.0.8
21                 >=media-libs/sdl-mixer-1.2[vorbis]
22                 >=media-libs/sdl-image-1.2[jpeg,png]
23                 fribidi? ( dev-libs/fribidi )
24                 dbus? ( sys-apps/dbus )
25                 sys-libs/zlib
26                 x11-libs/pango
27                 dev-lang/lua:0
28                 media-libs/fontconfig
29         )
30         >=dev-libs/boost-1.48:=[nls,threads]
31         virtual/libintl"
32 DEPEND="${RDEPEND}
33         virtual/pkgconfig
34         sys-devel/gettext"
35
36 src_prepare() {
37         if use dedicated || use server ; then
38                 sed \
39                         -e "s:GAMES_BINDIR:${GAMES_BINDIR}:" \
40                         -e "s:GAMES_STATEDIR:${GAMES_STATEDIR}:" \
41                         -e "s/GAMES_USER_DED/${GAMES_USER_DED}/" \
42                         -e "s/GAMES_GROUP/${GAMES_GROUP}/" "${FILESDIR}"/wesnothd.rc \
43                         > "${T}"/wesnothd || die
44         fi
45         if ! use doc ; then
46                 sed -i \
47                         -e '/manual/d' \
48                         doc/CMakeLists.txt || die
49         fi
50         # bug #472994
51         mv icons/wesnoth-icon-Mac.png icons/wesnoth-icon.png || die
52         mv icons/map-editor-icon-Mac.png icons/wesnoth_editor-icon.png || die
53
54         # respect LINGUAS (bug #483316)
55         if [[ ${LINGUAS+set} ]] ; then
56                 local langs
57                 for lang in $(cat po/LINGUAS)
58                 do
59                         has $lang $LINGUAS && langs+="$lang "
60                 done
61                 echo "$langs" > po/LINGUAS || die
62         fi
63 }
64
65 src_configure() {
66         filter-flags -ftracer -fomit-frame-pointer
67         if [[ $(gcc-major-version) -eq 3 ]] ; then
68                 filter-flags -fstack-protector
69                 append-flags -fno-stack-protector
70         fi
71         # Work around eclass
72         append-flags -UNDEBUG
73         if use dedicated || use server ; then
74                 mycmakeargs=(
75                         "-DENABLE_CAMPAIGN_SERVER=TRUE"
76                         "-DENABLE_SERVER=TRUE"
77                         "-DSERVER_UID=${GAMES_USER_DED}"
78                         "-DSERVER_GID=${GAMES_GROUP}"
79                         "-DFIFO_DIR=${GAMES_STATEDIR}/run/wesnothd"
80                         )
81         else
82                 mycmakeargs=(
83                         $(cmake-utils_use_enable fribidi FRIBIDI)
84                         "-DENABLE_CAMPAIGN_SERVER=FALSE"
85                         "-DENABLE_SERVER=FALSE"
86                         )
87         fi
88         mycmakeargs+=(
89                 $(cmake-utils_use_enable !dedicated GAME)
90                 $(cmake-utils_use_enable !dedicated ENABLE_DESKTOP_ENTRY)
91                 $(cmake-utils_use_enable nls NLS)
92                 $(cmake-utils_use_enable dbus NOTIFICATIONS)
93                 "-DCMAKE_VERBOSE_MAKEFILE=TRUE"
94                 "-DENABLE_STRICT_COMPILATION=FALSE"
95                 "-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}"
96                 "-DDATAROOTDIR=${GAMES_DATADIR}"
97                 "-DBINDIR=${GAMES_BINDIR}"
98                 "-DICONDIR=/usr/share/pixmaps"
99                 "-DDESKTOPDIR=/usr/share/applications"
100                 "-DLOCALEDIR=/usr/share/locale"
101                 "-DMANDIR=/usr/share/man"
102                 "-DDOCDIR=/usr/share/doc/${PF}"
103                 )
104         cmake-utils_src_configure
105 }
106
107 src_compile() {
108         cmake-utils_src_compile
109 }
110
111 src_install() {
112         DOCS="README.md changelog players_changelog" cmake-utils_src_install
113         if use dedicated || use server; then
114                 keepdir "${GAMES_STATEDIR}/run/wesnothd"
115                 doinitd "${T}"/wesnothd
116         fi
117         prepgamesdirs
118 }