summaryrefslogtreecommitdiff
path: root/sci-libs/grib_api/grib_api-1.11.0.ebuild
blob: e1476a9132a9e70c35dc256d8414af8a4cc74037 (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=5

AUTOTOOLS_IN_SOURCE_BUILD=1

FORTRAN_NEEDED=fortran
FORTRAN_STANDARD="77 90"
PYTHON_COMPAT=( python2_7 )

inherit autotools-utils toolchain-funcs fortran-2 python-single-r1

PID=3473437

DESCRIPTION="Library for decoding WMO FM-92 GRIB messages"
HOMEPAGE="https://software.ecmwf.int/wiki/display/GRIB/Home"
SRC_URI="https://software.ecmwf.int/wiki/download/attachments/${PID}/${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

IUSE="doc examples fortran jpeg2k netcdf openmp png python static-libs threads perl"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="
	jpeg2k? (
		media-libs/openjpeg:0
		!!media-libs/jasper
	)
	netcdf? ( sci-libs/netcdf )
	png? ( media-libs/libpng:0= )
	python? (
		${PYTHON_DEPS}
		dev-python/numpy[${PYTHON_USEDEP}]
	)"
DEPEND="${RDEPEND}
	python? ( dev-lang/swig )"

pkg_setup() {
	if use openmp; then
		if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp; then
			ewarn "OpenMP is not available in your current selected gcc"
			die "need openmp capable gcc"
		fi
	fi
	fortran-2_pkg_setup
	use python && python-single-r1_pkg_setup
}

src_prepare() {
	# failing test
	sed -i \
		-e 's/\(${tools_dir}grib_ls -plevels tmp_rlls.grib1 | grep MISSING\)/#\1/' \
		tests/ls.sh
}

src_configure() {
	# perl module needs serious packaging work from upstream
	local myeconfargs=(
		--without-perl
		$(use_enable jpeg2k jpeg)
		$(use_enable fortran)
		$(use_enable openmp omp-packing)
		$(use_enable python)
		$(use_enable python numpy)
		$(use_enable threads pthread)
		$(
			use netcdf && \
				echo --with-netcdf="${EPREFIX}"/usr || \
				echo --with-netcdf=none
		)
		$(use_with png png-support)
	)
	autotools-utils_src_configure
}

src_install() {
	autotools-utils_src_install
	use doc && dohtml -r html/*
	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		emake clean
		doins -r *
	fi
	use python && python_optimize
}