summaryrefslogtreecommitdiff
blob: 47be73600f49fc37c98d052fdee729dcbedf1e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# By Eroen, 2013
# Distributed under the terms of the ISC license
# $Header: $

EAPI=5

inherit eutils flag-o-matic versionator games cmake-utils
[[ $(get_version_component_range $(get_version_component_count)) == *999? ]] && inherit git-2

DESCRIPTION="Unofficial open source engine reimplementation of the game Morrowind"
HOMEPAGE="https://openmw.org/"
LICENSE="GPL-3 MIT BitstreamVera DaedricFont OFL-1.1"
SLOT="0"
KEYWORDS=""
IUSE="test +tr1"

if [[ $(get_version_component_range $(get_version_component_count)) == *999? ]]; then
	S="${WORKDIR}"/${PN}
	EGIT_REPO_URI="git://github.com/zinnschlag/openmw.git"
	if [[ $(get_version_component_count) -ge 4 ]]; then
		EGIT_BRANCH=openmw$(get_version_component_range 2)
	fi
else
	SRC_URI="https://openmw.googlecode.com/files/${P}.tar.gz"
	S="${WORKDIR}"/${PN}-${P}
fi

HDEPEND=""
LIBDEPEND="app-arch/unshield
	dev-games/ogre[boost,cg,freeimage,opengl,threads,zip]
	dev-games/mygui
	dev-libs/boost:=[threads]
	media-libs/libsdl2
	media-libs/openal
	sci-physics/bullet
	virtual/ffmpeg
	dev-qt/qtcore
	dev-qt/qtgui
	dev-qt/qtxmlpatterns"
DEPEND="${LIBDEPEND}
	test? ( dev-cpp/gmock[tr1=]
	    dev-cpp/gtest[tr1=] )"
[[ ${EAPI} == *-hdepend ]] || DEPEND+=" ${HDEPEND}"
RDEPEND="${LIBDEPEND}"

pkg_setup() {
	if use test && ! use tr1; then
		append-cflags -DGTEST_USE_OWN_TR1_TUPLE=1
		append-cxxflags -DGTEST_USE_OWN_TR1_TUPLE=1
	fi
}

src_prepare() {
	epatch_user
}

src_configure() {
	mycmakeargs=(
		-DCMAKE_INSTALL_PREFIX="${GAMES_PREFIX}"
		-DDATAROOTDIR="${GAMES_DATADIR_BASE}"
		-DDATADIR="${GAMES_DATADIR}/${PN}"
		-DSYSCONFDIR="${GAMES_SYSCONFDIR}"/${PN}
		-DBUILD_BSATOOL=ON
		$(cmake-utils_use_build test UNITTESTS)
		)
	cmake-utils_src_configure
}

src_test() {
	pushd "${BUILD_DIR}" > /dev/null
	./openmw_test_suite || die
	popd > /dev/null
}

src_install() {
	cmake-utils_src_install
	rm -r "${D}"/usr/share/licenses
	sed -e "s:resources=resources:resources=${GAMES_DATADIR}/${PN}/resources:" \
		-i "${D}/${GAMES_SYSCONFDIR}"/${PN}/openmw.cfg || die
	prepgamesdirs
	# /etc/openmw/ is hardcoded, but we set SYSCONFDIR for games.eclass
	mv -t "${D}"/etc "${D}/${GAMES_SYSCONFDIR}"/${PN} || die
	rmdir "${D}/${GAMES_SYSCONFDIR}" || die
}