summaryrefslogtreecommitdiff
blob: 9180265d2dd961d6ae465caaa030d46e2411af3b (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
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/openjpeg/openjpeg-9999.ebuild,v 1.3 2013/06/08 10:36:47 xmw Exp $

EAPI=5
inherit cmake-utils eutils multilib subversion

DESCRIPTION="An open-source JPEG 2000 library"
HOMEPAGE="http://code.google.com/p/openjpeg/"
ESVN_REPO_URI="http://openjpeg.googlecode.com/svn/trunk/"

LICENSE="BSD-2"
SLOT="2"
KEYWORDS=""
IUSE="doc static-libs test +vanilla"

RDEPEND="media-libs/lcms:2=[static-libs?]
	media-libs/libpng:0=[static-libs?]
	media-libs/tiff:0=[static-libs?]
	sys-libs/zlib:=[static-libs?]"
DEPEND="${RDEPEND}
	doc? ( app-doc/doxygen )"

DOCS=( AUTHORS NEWS README THANKS )

RESTRICT="test" #409263

src_prepare() {
	epatch \
		"${FILESDIR}"/${P}-build.patch \
		"${FILESDIR}"/${PN}-2.0.0-pkgconfig-static.patch
	if ! use vanilla ; then
		epatch "${FILESDIR}"/${P}-mupdf.patch
	fi
}

src_configure() {
	local mycmakeargs=(
		-DOPENJPEG_INSTALL_LIB_DIR="$(get_libdir)"
		$(cmake-utils_use_build doc)
		$(cmake-utils_use_build test TESTING)
		)

	cmake-utils_src_configure

	if use static-libs ; then
		mycmakeargs=(
			-DOPENJPEG_INSTALL_LIB_DIR="$(get_libdir)"
			$(cmake-utils_use_build test TESTING)
			-DBUILD_SHARED_LIBS=OFF
			)
		BUILD_DIR=${BUILD_DIR}_static cmake-utils_src_configure
	fi
}

src_compile() {
	cmake-utils_src_compile

	if use static-libs ; then
		BUILD_DIR=${BUILD_DIR}_static cmake-utils_src_compile
	fi
}

src_install() {
	if use static-libs ; then
		BUILD_DIR=${BUILD_DIR}_static cmake-utils_src_install
		#static bins overwritten by shared install
	fi

	cmake-utils_src_install
}