dev-qt/qtopengl: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / games-strategy / 0ad / 0ad-0.0.23_alpha.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 WX_GTK_VER="3.0"
7
8 PYTHON_COMPAT=( python2_7 )
9 PYTHON_REQ_USE="threads,ssl"
10
11 inherit eutils wxwidgets toolchain-funcs gnome2-utils python-any-r1
12
13 MY_P=0ad-${PV/_/-}
14 DESCRIPTION="A free, real-time strategy game"
15 HOMEPAGE="https://play0ad.com/"
16 SRC_URI="http://releases.wildfiregames.com/${MY_P}-unix-build.tar.xz"
17
18 LICENSE="GPL-2 LGPL-2.1 MIT CC-BY-SA-3.0 ZLIB"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="editor +lobby nvtt pch test"
22 RESTRICT="test"
23
24 RDEPEND="
25         dev-libs/boost:=
26         dev-libs/icu:=
27         dev-libs/libsodium
28         dev-libs/libxml2
29         dev-libs/nspr
30         ~games-strategy/0ad-data-${PV}
31         media-libs/libpng:0
32         media-libs/libsdl2[X,opengl,video]
33         media-libs/libvorbis
34         media-libs/openal
35         net-libs/enet:1.3
36         net-libs/miniupnpc:=
37         net-misc/curl
38         sys-libs/zlib
39         virtual/jpeg:0
40         virtual/opengl
41         x11-libs/libX11
42         x11-libs/libXcursor
43         editor? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] )
44         lobby? ( >=net-libs/gloox-1.0.20 )
45         nvtt? ( media-gfx/nvidia-texture-tools )"
46 DEPEND="${RDEPEND}
47         ${PYTHON_DEPS}
48         virtual/pkgconfig
49         test? ( dev-lang/perl )"
50
51 S="${WORKDIR}/${MY_P}"
52
53 pkg_setup() {
54         python-any-r1_pkg_setup
55         use editor && setup-wxwidgets
56 }
57
58 PATCHES=(
59         "${FILESDIR}"/${PN}-0.0.21_alpha-gentoo.patch
60 )
61
62 src_configure() {
63         local myconf=(
64                 --with-system-nvtt
65                 --with-system-miniupnpc
66                 --minimal-flags
67                 $(usex nvtt "" "--without-nvtt")
68                 $(usex pch "" "--without-pch")
69                 $(usex test "" "--without-tests")
70                 $(usex editor "--atlas" "")
71                 $(usex lobby "" "--without-lobby")
72                 --collada
73                 --bindir="/usr/bin"
74                 --libdir="/usr/$(get_libdir)"/${PN}
75                 --datadir="/usr/share/${PN}"
76                 )
77
78         # stock premake4 does not work, use the shipped one
79         emake -C "${S}"/build/premake/premake4/build/gmake.unix
80
81         # regenerate scripts.c so our patch applies
82         cd "${S}"/build/premake/premake4 || die
83         "${S}"/build/premake/premake4/bin/release/premake4 embed || die
84
85         # rebuild premake again... this is the most stupid build system
86         emake -C "${S}"/build/premake/premake4/build/gmake.unix clean
87         emake -C "${S}"/build/premake/premake4/build/gmake.unix
88
89         # run premake to create build scripts
90         cd "${S}"/build/premake || die
91         "${S}"/build/premake/premake4/bin/release/premake4 \
92                 --file="premake4.lua" \
93                 --outpath="../workspaces/gcc/" \
94                 --platform=$(usex amd64 "x64" "x32") \
95                 --os=linux \
96                 "${myconf[@]}" \
97                 gmake || die "Premake failed"
98 }
99
100 src_compile() {
101         tc-export AR
102
103         # build bundled and patched spidermonkey
104         cd libraries/source/spidermonkey || die
105         JOBS="${MAKEOPTS}" ./build.sh || die
106         cd "${S}" || die
107
108         # build 3rd party fcollada
109         emake -C libraries/source/fcollada/src
110
111         # build 0ad
112         emake -C build/workspaces/gcc verbose=1
113 }
114
115 src_test() {
116         cd binaries/system || die
117         ./test -libdir "${S}/binaries/system" || die "test phase failed"
118 }
119
120 src_install() {
121         newbin binaries/system/pyrogenesis 0ad
122         use editor && newbin binaries/system/ActorEditor 0ad-ActorEditor
123
124         insinto /usr/share/${PN}
125         doins -r binaries/data/l10n
126
127         exeinto /usr/$(get_libdir)/${PN}
128         doexe binaries/system/libCollada.so
129         doexe libraries/source/spidermonkey/lib/*.so
130         use editor && doexe binaries/system/libAtlasUI.so
131
132         dodoc binaries/system/readme.txt
133         doicon -s 128 build/resources/${PN}.png
134         make_desktop_entry ${PN}
135 }
136
137 pkg_preinst() {
138         gnome2_icon_savelist
139 }
140
141 pkg_postinst() {
142         gnome2_icon_cache_update
143 }
144
145 pkg_postrm() {
146         gnome2_icon_cache_update
147 }