summaryrefslogtreecommitdiff
path: root/sci-geosciences/gmt/gmt-6.3.0.ebuild
blob: 97ec47620ea14f29dbda06d805b2ae64500cf71e (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit bash-completion-r1 cmake

DESCRIPTION="Powerful map generator"
HOMEPAGE="https://www.generic-mapping-tools.org"
SRC_URI="https://github.com/GenericMappingTools/${PN}/releases/download/${PV}/${P}-src.tar.xz"

LICENSE="GPL-3+ gmttria? ( Artistic )"
SLOT="6"
KEYWORDS="~amd64 ~x86"
IUSE="blas +fftw ffmpeg +gdal geos gmttria lapack openmp pcre pcre2 threads zlib"

REQUIRED_USE="?? ( pcre pcre2 )"

DEPEND="
	app-text/ghostscript-gpl:=
	media-gfx/graphicsmagick:=
	net-misc/curl
	>=sci-libs/netcdf-4.1:=[hdf5]
	media-video/ffmpeg:=
	blas? ( virtual/blas )
	fftw? ( sci-libs/fftw:3.0= )
	gdal? ( sci-libs/gdal:= )
	geos? ( sci-libs/geos )
	lapack? ( virtual/lapack )
	pcre? ( dev-libs/libpcre:= )
	pcre2? ( dev-libs/libpcre2:= )
	zlib? ( sys-libs/zlib:= )
"
RDEPEND="${DEPEND}
	!sci-biology/probcons
	sci-geosciences/dcw-gmt
	sci-geosciences/gshhg-gmt
"

src_prepare() {
	cmake_src_prepare
	# Rename man pages to avoid a name conflict with gmt5
	pushd man_release || die
	local m c suffix newc
		for m in *.gz; do
			c=${m%%.*}
			suffix=${m#*.}
			if [[ "${c}" == "gmt"  ]]; then
				newc=gmt${SLOT}
			else
				newc=gmt${SLOT}_${c}
			fi
			mv "${c}.${suffix}" "${newc}.${suffix}" || die
		done
	popd || die
}

src_configure() {
	local mycmakeargs=(
		-DGMT_DATADIR="share/${P}"
		-DGMT_DOCDIR="share/doc/${PF}"
		-DGMT_MANDIR="share/man"
		-DLICENSE_RESTRICTED=$(usex gmttria no yes)
		-DGMT_ENABLE_OPENMP=$(usex openmp)
		-DGMT_USE_THREADS=$(usex threads)
		-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES=OFF # Install bash completions properly
		-DGMT_INSTALL_MODULE_LINKS=OFF # Don't install symlinks on gmt binary, they are conflicted with gmt5
		-DGMT_INSTALL_NAME_SUFFIX="${SLOT}"
		-DBASH_COMPLETION_DIR="$(get_bashcompdir)"
		$(cmake_use_find_package blas BLAS)
		$(cmake_use_find_package gdal GDAL)
		$(cmake_use_find_package geos GEOS)
		$(cmake_use_find_package fftw FFTW3)
		$(cmake_use_find_package lapack LAPACK)
		$(cmake_use_find_package pcre PCRE)
		$(cmake_use_find_package zlib ZLIB)
	)
	use pcre || mycmakeargs+=( $(cmake_use_find_package pcre2 PCRE2) )

	cmake_src_configure
}

src_install() {
	cmake_src_install
	docompress -x /usr/share/doc/${PF}/examples
	docompress -x /usr/share/doc/${PF}/tutorial

	# remove conflicting symlink
	rm "${ED}/usr/bin/gmt" || die
	rm "${ED}/usr/$(get_libdir)/libgmt.so" || die
	rm "${ED}/usr/$(get_libdir)/libpostscriptlight.so" || die

	# Decompress manuals
	find "${ED}/usr/share/man" -name "*.gz" -exec gunzip {} + || die
	# Rename bash completion file
	mv "${D}$(get_bashcompdir)/gmt_completion.bash" "${D}$(get_bashcompdir)/gmt${SLOT}" || die
}