dev-qt/qtopengl: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / games-strategy / 0ad / 0ad-0.0.23b_alpha.ebuild
1 # Copyright 1999-2019 Gentoo Authors
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         "${FILESDIR}"/${PN}-0.0.23b-header_includes_fix.patch
61 )
62
63 src_configure() {
64         local myconf=(
65                 --with-system-nvtt
66                 --with-system-miniupnpc
67                 --minimal-flags
68                 $(usex nvtt "" "--without-nvtt")
69                 $(usex pch "" "--without-pch")
70                 $(usex test "" "--without-tests")
71                 $(usex editor "--atlas" "")
72                 $(usex lobby "" "--without-lobby")
73                 --collada
74                 --bindir="/usr/bin"
75                 --libdir="/usr/$(get_libdir)"/${PN}
76                 --datadir="/usr/share/${PN}"
77                 )
78
79         # stock premake4 does not work, use the shipped one
80         emake -C "${S}"/build/premake/premake4/build/gmake.unix
81
82         # regenerate scripts.c so our patch applies
83         cd "${S}"/build/premake/premake4 || die
84         "${S}"/build/premake/premake4/bin/release/premake4 embed || die
85
86         # rebuild premake again... this is the most stupid build system
87         emake -C "${S}"/build/premake/premake4/build/gmake.unix clean
88         emake -C "${S}"/build/premake/premake4/build/gmake.unix
89
90         # run premake to create build scripts
91         cd "${S}"/build/premake || die
92         "${S}"/build/premake/premake4/bin/release/premake4 \
93                 --file="premake4.lua" \
94                 --outpath="../workspaces/gcc/" \
95                 --platform=$(usex amd64 "x64" "x32") \
96                 --os=linux \
97                 "${myconf[@]}" \
98                 gmake || die "Premake failed"
99 }
100
101 src_compile() {
102         tc-export AR
103
104         # build bundled and patched spidermonkey
105         cd libraries/source/spidermonkey || die
106         JOBS="${MAKEOPTS}" ./build.sh || die
107         cd "${S}" || die
108
109         # build 3rd party fcollada
110         emake -C libraries/source/fcollada/src
111
112         # build 0ad
113         emake -C build/workspaces/gcc verbose=1
114 }
115
116 src_test() {
117         cd binaries/system || die
118         ./test -libdir "${S}/binaries/system" || die "test phase failed"
119 }
120
121 src_install() {
122         newbin binaries/system/pyrogenesis 0ad
123         use editor && newbin binaries/system/ActorEditor 0ad-ActorEditor
124
125         insinto /usr/share/${PN}
126         doins -r binaries/data/l10n
127
128         exeinto /usr/$(get_libdir)/${PN}
129         doexe binaries/system/libCollada.so
130         doexe libraries/source/spidermonkey/lib/*.so
131         use editor && doexe binaries/system/libAtlasUI.so
132
133         dodoc binaries/system/readme.txt
134         doicon -s 128 build/resources/${PN}.png
135         make_desktop_entry ${PN}
136 }
137
138 pkg_preinst() {
139         gnome2_icon_savelist
140 }
141
142 pkg_postinst() {
143         gnome2_icon_cache_update
144 }
145
146 pkg_postrm() {
147         gnome2_icon_cache_update
148 }