aboutsummaryrefslogtreecommitdiff
blob: 01663bcd6d4bbd50c587250999a4bb269f6abe6d (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CMAKE_MAKEFILE_GENERATOR="emake"
FORTRAN_STANDARD=2003
VIRTUALX_REQUIRED="test"

inherit cmake fortran-2 virtualx

DESCRIPTION="A GTK+ binding to build Graphical User Interfaces in Fortran"
HOMEPAGE="https://github.com/vmagnin/gtk-fortran"
SRC_URI="https://github.com/vmagnin/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="4"
KEYWORDS="~amd64 ~x86"

IUSE="examples high-level plplot static-libs test"
REQUIRED_USE="plplot? ( high-level )"
RESTRICT="!test? ( test )"

RDEPEND="
	gui-libs/gtk:4
	plplot? ( >=sci-libs/plplot-5.15.0[cairo,fortran] )
"
DEPEND="${RDEPEND}"
BDEPEND="
	virtual/fortran
	virtual/pkgconfig
"

DOCS=( "README.md" "README-high-level.md" "CHANGELOG.md" )

pkg_setup() {
	fortran-2_pkg_setup
}

src_prepare() {
	default
	# Fix library installation path, disable 'sketcher' build, pass LDFLAGS
	sed -i -e "s:CMAKE_INSTALL_LIBDIR lib:CMAKE_INSTALL_LIBDIR $(get_libdir):" \
		-e "s:    add_subdirectory(sketcher)::" \
		-e 's:"-rdynamic":"-rdynamic '"${LDFLAGS}"'":' CMakeLists.txt || die

	cmake_src_prepare
}

src_configure() {
	mycmakeargs+=(
		-DEXCLUDE_PLPLOT=$(usex plplot false true)
		-DNO_BUILD_HL=$(usex high-level false true)
		-DINSTALL_EXAMPLES=$(usex examples)
		-DNO_BUILD_EXAMPLES=true
	)
	cmake_src_configure
}

src_test() {
	virtx cmake_src_test
}

src_install() {
	cmake_src_install

	# Remove static library here as it's used to build additional tools
	if use !static-libs ; then
		rm "${ED}/usr/$(get_libdir)/libgtk-${SLOT}-fortran.a" || die
	fi
}