summaryrefslogtreecommitdiff
path: root/sci-libs/gmsh/gmsh-4.14.1.ebuild
blob: 0f99c055f94d991ef91db0659d674487df770a66 (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
142
143
144
145
146
147
148
149
150
151
152
153
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )

inherit cmake desktop fortran-2 python-r1 toolchain-funcs xdg-utils

DESCRIPTION="Three-dimensional finite element mesh generator"
HOMEPAGE="https://gmsh.info https://gitlab.onelab.info/gmsh/gmsh"
SRC_URI="https://gmsh.info/src/${P}-source.tgz"
S="${WORKDIR}/${P}-source"

LICENSE="
	GPL-2+ free-noncomm
	alglib? ( MIT )
	gmm? ( LGPL-2.1+ )
	metis? ( Apache-2.0 )
	netgen? ( LGPL-2.1+ )
	voro? ( BSD )
"
SLOT="0"
KEYWORDS="~amd64 ~x86"
## cgns is not compiling ATM, maybe fix cgns lib first
IUSE="+alglib +blas cgns eigen examples +gmm gui jpeg med metis mpi mumps netgen opencascade petsc pdf png python shared slepc voro zlib"

REQUIRED_USE="
	^^ ( blas eigen )
	mumps? ( blas )
	slepc? ( petsc )
	python? ( shared ${PYTHON_REQUIRED_USE} )
"

RDEPEND="
	virtual/fortran
	gui? ( x11-libs/fltk:1=[xft(+)] )
	alglib? ( sci-libs/alglib:= )
	blas? (
		sci-libs/fftw:3.0
		virtual/blas
		virtual/lapack
	)
	cgns? (
		sci-libs/cgnslib
		sci-libs/hdf5:=[mpi=]
	)
	eigen? ( dev-cpp/eigen:= )
	gmm? ( sci-mathematics/gmm )
	jpeg? ( media-libs/libjpeg-turbo )
	med? (
		sci-libs/hdf5:=[mpi=]
		sci-libs/med[mpi=]
	)
	metis? ( >=sci-libs/metis-5.2.0 )
	mpi? ( virtual/mpi )
	mumps? ( sci-libs/mumps[mpi=] )
	opencascade? ( sci-libs/opencascade:* )
	pdf? ( app-text/poppler:= )
	png? ( media-libs/libpng:0 )
	petsc? ( sci-mathematics/petsc[mpi=] )
	python? ( ${PYTHON_DEPS} )
	slepc? ( sci-mathematics/slepc[mpi=] )
	voro? ( sci-libs/voro++ )
	zlib? ( virtual/zlib:= )
"

DEPEND="
	${RDEPEND}
	${PYTHON_DEPS}
	virtual/pkgconfig
	python? ( dev-lang/swig )
"

PATCHES=(
	"${FILESDIR}"/${PN}-4.9.5-opencascade.patch
	"${FILESDIR}"/${PN}-4.11.1-metis-5-2.patch
	"${FILESDIR}"/${PN}-4.14.1-alglib.patch # downstream; find it in include subdir
)

src_prepare() {
	# ensure we don't let automagic detect bundled libs
	# for pkgs supposed to be in system
	einfo "Cleanup bundled libs:"
	local contrib
	for contrib in ALGLIB eigen gmm metis Netgen voro++; do
		rm -rv contrib/${contrib} || die
	done

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=( -DENABLE_SYSTEM_CONTRIB="YES" )

	use blas && \
		mycmakeargs+=( -DCMAKE_Fortran_COMPILER=$(tc-getF77) )

	mycmakeargs+=(
		-DENABLE_ALGLIB="$(usex alglib)"
		-DENABLE_BLAS_LAPACK="$(usex blas)"
		-DENABLE_BUILD_DYNAMIC="$(usex shared)"
		-DENABLE_CGNS="$(usex cgns)"
		-DENABLE_EIGEN="$(usex eigen)"
		-DENABLE_FLTK="$(usex gui)"
		-DENABLE_GMM="$(usex gmm)"
		-DENABLE_GRAPHICS="$(usex gui)"
		-DENABLE_MED="$(usex med)"
		-DENABLE_MPI="$(usex mpi)"
		-DENABLE_METIS="$(usex metis)"
		-DENABLE_MUMPS="$(usex mumps)"
		-DENABLE_NETGEN="$(usex netgen)"
		-DENABLE_OCC="$(usex opencascade)"
		-DENABLE_PETSC="$(usex petsc)"
		-DENABLE_POPPLER="$(usex pdf)"
		-DENABLE_SLEPC="$(usex slepc)"
		-DENABLE_PRIVATE_API="$(usex shared)"
		-DENABLE_VOROPP="$(usex voro)"
		-DENABLE_WRAP_PYTHON="$(usex python)"
	)

	cmake_src_configure
}

src_install() {
	cmake_src_install

	if use examples ; then
		dodoc -r examples tutorials
		docompress -x /usr/share/doc/${PF}/{examples,tutorials}
	fi

	if use python; then
		python_foreach_impl python_domodule api/gmsh.py
	fi

	if use gui ; then
		newicon -s 64 "/${S}/utils/icons/gmsh-no-text.png" gmsh.png
		make_desktop_entry "/usr/bin/gmsh" "Gmsh ${PV}" "gmsh" "Science;Math"
	fi
}

pkg_postinst() {
	if use gui ; then
		xdg_icon_cache_update
	fi
}

pkg_postrm() {
	if use gui ; then
		xdg_icon_cache_update
	fi
}