summaryrefslogtreecommitdiff
blob: 2978d51245b0df432d77381561d44ef91c28d988 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit eutils cmake-utils

DESCRIPTION="Stream based read/write library for COLLADA files"
HOMEPAGE="http://www.opencollada.org/"
SRC_URI="https://github.com/KhronosGroup/OpenCOLLADA/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"

KEYWORDS="~amd64 ~ppc64 ~x86"

IUSE="expat static-libs"

# This is still needed to have so version numbers
MY_SOVERSION="1.6"

RDEPEND="dev-libs/libpcre
	dev-libs/zziplib
	media-libs/lib3ds
	sys-libs/zlib
	expat? ( dev-libs/expat )
	!expat? ( dev-libs/libxml2 )"
DEPEND="${RDEPEND}
	virtual/pkgconfig"

S="${WORKDIR}"/OpenCOLLADA-${PV}
# This is needed or you get an error on install
BUILD_DIR="${S}"/build

PATCHES=(
	"${FILESDIR}"/${PN}-0_p864-expat.patch
	"${FILESDIR}"/${PN}-1.2.2-soversion.patch
	"${FILESDIR}"/${PN}-1.2.2-no-undefined.patch
	"${FILESDIR}"/${PN}-1.2.2-libdir.patch
)

src_prepare() {
	edos2unix CMakeLists.txt

	default

	# Remove bundled depends that have portage equivalents
	rm -rv Externals/{expat,lib3ds,LibXML,pcre,zlib,zziplib} || die

	# Remove unused build systems
	rm -v Makefile scripts/{unixbuild.sh,vcproj2cmake.rb} || die
	find "${S}" -name SConscript -delete || die
}

src_configure() {
	local mycmakeargs=(
		-DUSE_SHARED=ON
		-DUSE_STATIC=$(usex static-libs ON OFF)
		-DUSE_EXPAT=$(usex expat ON OFF)
		-DUSE_LIBXML=$(usex !expat ON OFF)
		-Dsoversion=${MY_SOVERSION}
	)

	cmake-utils_src_configure
}

src_install() {
	cmake-utils_src_install

	echo "LDPATH=/usr/$(get_libdir)/opencollada" > "${T}"/99${PN} || die "echo failed"
	doenvd "${T}"/99${PN}

	dobin build/bin/OpenCOLLADAValidator
}