summaryrefslogtreecommitdiff
blob: a7e01472873c75826a8a7e36694792c1fe0ffaac (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools

DESCRIPTION="Powerful map generator"
HOMEPAGE="https://gmt.soest.hawaii.edu/"
SRC_URI="mirror://gmt/${P}-src.tar.bz2
	gmttria? ( mirror://gmt/${P}-non-gpl-src.tar.bz2 )"

LICENSE="GPL-2+ gmttria? ( Artistic )"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="doc examples debug +gdal gmttria +gshhg htmldoc +metric mex +netcdf octave postscript tutorial"

# mex can use matlab too which i can't test
REQUIRED_USE="mex? ( octave )"

DEPEND="
	gdal? ( sci-libs/gdal:= )
	gshhg? ( sci-geosciences/gshhg-gmt )
	netcdf? ( sci-libs/netcdf:= )
	octave? ( sci-mathematics/octave:= )
"
RDEPEND="${DEPEND}
	!sci-biology/probcons
"

PATCHES=(
	"${FILESDIR}"/${PN}-4.5.9-no-strip.patch
	"${FILESDIR}"/${PN}-4.5.6-respect-ldflags.patch
)

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	local myconf=(
		--datadir=/usr/share/${P}
		--includedir=/usr/include/${P}
		--disable-update
		--disable-matlab
		--disable-xgrid
		--disable-debug
		$(use_enable gdal)
		$(use_enable netcdf)
		$(use_enable octave)
		$(use_enable debug devdebug)
		$(use_enable !metric US)
		$(use_enable postscript eps)
		$(use_enable mex)
		$(use_enable gmttria triangle)
		$(use_with gshhg gshhg-dir /usr/share/gshhg)
	)
	econf "${myconf[@]}"
}

src_compile() {
	emake -j1
}

src_install() {
	emake DESTDIR="${D}" -j1 install-all
	einstalldocs

	# Remove various documentation
	if ! use doc; then
		rm -rf "${ED}/usr/share/doc/${PF}/pdf" || die
	fi

	if use examples; then
		docompress -x /usr/share/doc/${PF}/examples
	else
		rm -r "${ED}/usr/share/doc/${PF}/examples" || die
	fi

	if ! use htmldoc; then
		rm -r "${ED}/usr/share/doc/${PF}/html" || die
	fi

	if use tutorial; then
		docompress -x /usr/share/doc/${PF}/tutorial
	else
		rm -r "${ED}/usr/share/doc/${PF}/tutorial" || die
	fi

	# remove static libs
	find "${ED}/usr/$(get_libdir)" -name '*.a' -delete || die
}