1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 # EAPI=7 uses ninja generator by default but it's incompatible with USE=fortran
7 # https://github.com/Kitware/ninja/tree/features-for-fortran#readme
8 CMAKE_MAKEFILE_GENERATOR=emake
10 FORTRAN_NEEDED=fortran
12 # NOTE:The build for multiple python versions should be possible but
13 # complicated for the build system
14 PYTHON_COMPAT=( python3_{6,7} )
16 inherit cmake fortran-2 python-single-r1
18 DESCRIPTION="A library to store and exchange meshed data or computation results"
19 HOMEPAGE="https://www.salome-platform.org/user-section/about/med"
20 SRC_URI="https://files.salome-platform.org/Salome/other/${P}.tar.gz"
24 KEYWORDS="~amd64 ~x86"
25 IUSE="doc fortran mpi python test"
27 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
29 RESTRICT="!test? ( test ) python? ( test )"
31 # dev-lang/tk is needed for wish-based xmdump utility
35 >=sci-libs/hdf5-1.10.2:=[fortran?,mpi?]
36 mpi? ( virtual/mpi[fortran=] )
37 python? ( ${PYTHON_DEPS} )
40 BDEPEND="python? ( >=dev-lang/swig-3.0.8 )"
43 "${FILESDIR}/${PN}-3.3.1-cmake-fortran.patch"
44 "${FILESDIR}/${PN}-3.3.1-disable-python-compile.patch" # managed by function of python eclass
45 "${FILESDIR}/${P}-cmakelist.patch"
46 "${FILESDIR}/${P}-installdoc.patch"
49 DOCS=( AUTHORS ChangeLog NEWS README TODO )
52 use python && python-single-r1_pkg_setup
53 use fortran && fortran-2_pkg_setup
58 # fixes for correct libdir name
59 local pysite=$(python_get_sitedir)
60 pysite="${pysite##/usr/}"
62 -e 's@SET(_install_dir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/med)@SET(_install_dir '${pysite}'/med)@' \
63 -i ./python/CMakeLists.txt || die "sed on ./python/CMakeLists.txt failed"
65 for cm in ./src/CMakeLists.txt ./tools/medimport/CMakeLists.txt
67 sed -i -e "s@INSTALL(TARGETS \(.*\) DESTINATION lib)@INSTALL(TARGETS \1 DESTINATION $(get_libdir))@" \
68 "${cm}" || die "sed on ${cm} failed"
76 # as indicated in the CMakeLists.txt, the shipped documentation is generated by a custom doxygen,
77 # so let's avoid rebuilding it because it will be different
78 -DMEDFILE_BUILD_DOC=OFF
79 -DMEDFILE_BUILD_FORTRAN=$(usex fortran)
80 -DMEDFILE_BUILD_PYTHON=$(usex python)
81 -DMEDFILE_BUILD_SHARED_LIBS=ON
82 -DMEDFILE_BUILD_STATIC_LIBS=OFF
83 -DMEDFILE_BUILD_TESTS=$(usex test)
84 -DMEDFILE_DOC_DIRECTORY="${EPREFIX}"/usr/share/doc/${PF}/html # custom var created by patches
85 -DMEDFILE_INSTALL_DOC=$(usex doc)
86 -DMEDFILE_USE_MPI=$(usex mpi)
94 # we don't need old 2.3.6 include files
95 rm -r "${ED}"/usr/include/2.3.6 || die "failed to delete obsolete include dir"
97 # the optimization done in CMakeLists.txt has been disabled so
98 # we need to do it manually
99 use python && python_optimize
101 # Prevent test executables being installed
103 rm -r "${ED}"/usr/bin/testc || die "failed to delete C test executables"
105 rm -r "${ED}"/usr/bin/testf || die "failed to delete fortran test executables"
108 rm -r "${ED}"/usr/bin/testpy || die "failed to delete python test executables"
114 # override parallel mode only for tests
115 local myctestargs=( "-j 1" )