aboutsummaryrefslogtreecommitdiff
blob: 866edeb20c02239b79ebb758ee0323f51623462d (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

AUTOTOOLS_AUTORECONF=true
FORTRAN_NEEDED=fortran
FORTRAN_STANDARD=2003
PYTHON_COMPAT=( python2_7 ) # python 3 supported by github master

inherit eutils autotools-utils python-single-r1 java-pkg-opt-2 fortran-2

DESCRIPTION="A library for X-ray matter interaction cross sections for X-ray fluorescence applications"
HOMEPAGE="https://github.com/tschoonj/xraylib"
SRC_URI="https://github.com/tschoonj/xraylib/archive/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
IUSE="examples fortran java lua perl python"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="
	java? ( >=virtual/jre-1.4:* )
	lua? ( dev-lang/lua:0 )
	perl? ( dev-lang/perl )
	python? ( ${PYTHON_DEPS} )"

DEPEND="${RDEPEND}
	java? ( >=virtual/jdk-1.4:* )"

S="${WORKDIR}/${PN}-${P}"

DOCS=(AUTHORS BUGS Changelog README TODO)

pkg_setup() {
	fortran-2_pkg_setup
	java-pkg-opt-2_pkg_setup
	use python && python-single-r1_pkg_setup
}

src_prepare() {
	java-pkg-opt-2_src_prepare
	autotools-utils_src_prepare
}

src_configure() {
	local myeconfargs=(
		--disable-idl
		$(use_enable fortran fortran2003)
		$(use_enable java)
		$(use_enable lua)
		$(use_enable perl)
		$(use_enable python)
		$(use_enable python python-integration)
	)
	autotools-utils_src_configure
}

src_compile() {
	# see https://github.com/tschoonj/xraylib/issues/11
	if use fortran || use java; then
		MAKEOPTS+=" -j1"
	fi
	autotools-utils_src_compile
}

src_install() {
	autotools-utils_src_install

	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		doins example/*.c example/*.cpp
		use java && doins example/*.java
		use lua && doins example/*.lua
		use perl && doins example/*.pl
		use python && doins example/*.py
		docompress -x /usr/share/doc/${PF}/examples # Don't compress examples
	fi

	use java && java-pkg_regso /usr/share/xraylib/java/libxraylib.so
}