5ce65187a04cd980bfe0090652d0a003e0fb6417
[gentoo.git] / games-emulation / pcsx2 / pcsx2-1.4.0.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 PLOCALES="ar_SA ca_ES cs_CZ de_DE es_ES fi_FI fr_FR hr_HR hu_HU id_ID it_IT ja_JP ko_KR ms_MY nb_NO pl_PL pt_BR ru_RU sv_SE th_TH tr_TR zh_CN zh_TW"
6 MY_PV="${PV/_/-}"
7
8 inherit cmake-utils l10n multilib toolchain-funcs wxwidgets
9
10 DESCRIPTION="A PlayStation 2 emulator"
11 HOMEPAGE="https://www.pcsx2.net"
12 SRC_URI="https://github.com/PCSX2/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS="-* ~amd64 ~x86"
17 IUSE=""
18
19 RDEPEND="
20         app-arch/bzip2[abi_x86_32(-)]
21         app-arch/xz-utils[abi_x86_32(-)]
22         dev-libs/libaio[abi_x86_32(-)]
23         media-libs/alsa-lib[abi_x86_32(-)]
24         media-libs/libpng:=[abi_x86_32(-)]
25         media-libs/libsdl[abi_x86_32(-),joystick,sound]
26         media-libs/libsoundtouch[abi_x86_32(-)]
27         media-libs/portaudio[abi_x86_32(-)]
28         >=sys-libs/zlib-1.2.4[abi_x86_32(-)]
29         virtual/jpeg:62[abi_x86_32(-)]
30         virtual/opengl[abi_x86_32(-)]
31         x11-libs/gtk+:2[abi_x86_32(-)]
32         x11-libs/libICE[abi_x86_32(-)]
33         x11-libs/libX11[abi_x86_32(-)]
34         x11-libs/libXext[abi_x86_32(-)]
35         x11-libs/wxGTK:3.0[abi_x86_32(-),X]
36 "
37 # Ensure no incompatible headers from eselect-opengl are installed, bug #510730
38 DEPEND="${RDEPEND}
39         >=app-eselect/eselect-opengl-1.3.1
40         dev-cpp/pngpp
41         >=dev-cpp/sparsehash-1.5
42 "
43
44 S="${WORKDIR}/${PN}-${MY_PV}"
45
46 PATCHES=( "${FILESDIR}"/${P}-gcc5.patch )
47
48 clean_locale() {
49         rm -R "${S}"/locales/"${1}" || die
50 }
51
52 pkg_setup() {
53         if [[ ${MERGE_TYPE} != binary && $(tc-getCC) == *gcc* ]]; then
54                 if [[ $(gcc-major-version) -lt 4 || $(gcc-major-version) == 4 && $(gcc-minor-version) -lt 8 ]] ; then
55                         die "${PN} does not compile with gcc less than 4.8"
56                 fi
57         fi
58 }
59
60 src_prepare() {
61         cmake-utils_src_prepare
62         l10n_for_each_disabled_locale_do clean_locale
63 }
64
65 src_configure() {
66         multilib_toolchain_setup x86
67
68         # pcsx2 build scripts will force CMAKE_BUILD_TYPE=Devel
69         # if it something other than "Devel|Debug|Release"
70         local CMAKE_BUILD_TYPE="Release"
71
72         if use amd64; then
73                 # Passing correct CMAKE_TOOLCHAIN_FILE for amd64
74                 # https://github.com/PCSX2/pcsx2/pull/422
75                 local MYCMAKEARGS=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake)
76         fi
77
78         local mycmakeargs=(
79                 -DARCH_FLAG=
80                 -DDISABLE_BUILD_DATE=TRUE
81                 -DDISABLE_PCSX2_WRAPPER=TRUE
82                 -DEXTRA_PLUGINS=FALSE
83                 -DOPTIMIZATION_FLAG=
84                 -DPACKAGE_MODE=TRUE
85                 -DXDG_STD=TRUE
86
87                 -DCMAKE_INSTALL_PREFIX=/usr
88                 -DCMAKE_LIBRARY_PATH="/usr/$(get_libdir)/${PN}"
89                 -DDOC_DIR=/usr/share/doc/"${PF}"
90                 -DEGL_API=FALSE
91                 -DGTK3_API=FALSE
92                 -DPLUGIN_DIR="/usr/$(get_libdir)/${PN}"
93                 # wxGTK must be built against same sdl version
94                 -DSDL2_API=FALSE
95                 -DWX28_API=FALSE
96         )
97
98         WX_GTK_VER="3.0" need-wxwidgets unicode
99         cmake-utils_src_configure
100 }
101
102 src_install() {
103         # Upstream issue: https://github.com/PCSX2/pcsx2/issues/417
104         QA_TEXTRELS="usr/$(get_libdir)/pcsx2/*"
105
106         cmake-utils_src_install
107 }