summaryrefslogtreecommitdiff
blob: e94bed6c62d4e12fdb845ae0b92bb1cbeec3ef01 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit autotools toolchain-funcs eutils java-pkg-opt-2 java-ant-2

MYP="Healpix_${PV}"
MYPF=${MYP}_2015Oct08

DESCRIPTION="Hierarchical Equal Area isoLatitude Pixelization of a sphere"
HOMEPAGE="http://healpix.sourceforge.net/"
SRC_URI="mirror://sourceforge/healpix/${MYP}/${MYPF}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

# might add fortran in the future if requested
IUSE="cxx doc idl java openmp static-libs test"

RDEPEND="
	>=sci-libs/cfitsio-3
	idl? (
		dev-lang/gdl
		sci-astronomy/idlastro )
	java? ( >=virtual/jre-1.6:* )"

DEPEND="${RDEPEND}
	virtual/pkgconfig
	java? ( >=virtual/jdk-1.6:* test? ( dev-java/ant-junit4:0 ) )"

S="${WORKDIR}/${MYP}"

pkg_pretend() {
	if use cxx && use openmp && [[ $(tc-getCXX)$ == *g++* ]] && [[ ${MERGE_TYPE} != binary ]]; then
		tc-has-openmp || \
			die "You are using gcc but without OpenMP capabilities that you requested"
	fi
}

pkg_setup() {
	java-pkg-opt-2_pkg_setup
}

src_prepare() {
	pushd src/C/autotools > /dev/null
	eautoreconf
	popd > /dev/null
	# why was static-libtool-libs forced?
	if use cxx; then
		pushd src/cxx/autotools > /dev/null
		sed -i -e '/-static-libtool-libs/d' Makefile.am || die
		eautoreconf
		popd > /dev/null
	fi
	# duplicate of idlastro (in rdeps)
	rm -r src/idl/zzz_external/astron || die
	mv src/idl/zzz_external/README src/idl/README.external || die
	java-pkg-opt-2_src_prepare
	default
}

src_configure() {
	pushd src/C/autotools > /dev/null
	econf $(use_enable static-libs static)
	popd > /dev/null
	if use cxx; then
		pushd src/cxx/autotools > /dev/null
		econf \
			--disable-native-optimizations \
			$(use_enable openmp) \
			$(use_enable static-libs static)
		popd > /dev/null
	fi
}

src_compile() {
	pushd src/C/autotools > /dev/null
	emake
	popd > /dev/null
	if use cxx; then
		pushd src/cxx/autotools > /dev/null
		emake
		popd > /dev/null
	fi
	if use java; then
		pushd src/java > /dev/null
		eant dist-notest
		popd > /dev/null
	fi
}

src_test() {
	pushd src/C/autotools > /dev/null
	emake check
	popd > /dev/null
	if use cxx; then
		pushd src/cxx/autotools > /dev/null
		emake check
		popd > /dev/null
	fi
	if use java; then
		pushd src/java > /dev/null
		EANT_GENTOO_CLASSPATH="ant-junit4" ANT_TASKS="ant-junit4" eant test
		popd > /dev/null
	fi
}

src_install() {
	dodoc READ_Copyrights_Licenses.txt
	pushd src/C/autotools > /dev/null
	emake install DESTDIR="${D}"
	popd > /dev/null
	if use cxx; then
		pushd src/cxx/autotools > /dev/null
		emake install DESTDIR="${D}"
		docinto cxx
		dodoc ../CHANGES
		popd > /dev/null
	fi
	use static-libs || prune_libtool_files --all
	if use idl; then
		pushd src/idl > /dev/null
		insinto /usr/share/gnudatalanguage/healpix
		doins -r examples fits interfaces misc toolkit visu zzz_external
		doins HEALPix_startup
		docinto idl
		dodoc README.*
		popd > /dev/null
	fi
	if use java; then
		pushd src/java > /dev/null
		java-pkg_dojar dist/*.jar
		docinto java
		dodoc README CHANGES
		popd > /dev/null
	fi
	use doc && dodoc -r doc/html
}