metis-5.2.1-r2.ebuild 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cmake
  5. DESCRIPTION="A package for unstructured serial graph partitioning"
  6. HOMEPAGE="https://github.com/KarypisLab/METIS"
  7. SRC_URI="https://github.com/KarypisLab/METIS/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
  8. S="${WORKDIR}/METIS-${PV}"
  9. LICENSE="Apache-2.0"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~x86 ~amd64-linux"
  12. IUSE="doc double-precision examples int64 openmp static-libs"
  13. DEPEND="sci-libs/gklib"
  14. RDEPEND="${DEPEND}"
  15. PATCHES=(
  16. "${FILESDIR}"/${P}-multilib.patch
  17. "${FILESDIR}"/${P}-respect-user-flags.patch
  18. # https://github.com/KarypisLab/METIS/pull/52 Bug 905822
  19. "${FILESDIR}"/${P}-add-gklib-as-required.patch
  20. )
  21. src_prepare() {
  22. local idxwidth realwidth
  23. if use int64; then
  24. idxwidth="#define IDXTYPEWIDTH 64"
  25. else
  26. idxwidth="#define IDXTYPEWIDTH 32"
  27. fi
  28. if use double-precision; then
  29. realwidth="#define REALTYPEWIDTH 64"
  30. else
  31. realwidth="#define REALTYPEWIDTH 32"
  32. fi
  33. cmake_src_prepare
  34. # From Makefile
  35. mkdir -p build/xinclude || die
  36. echo ${idxwidth} > build/xinclude/metis.h || die
  37. echo ${realwidth} >> build/xinclude/metis.h || die
  38. cat include/metis.h >> build/xinclude/metis.h || die
  39. cp include/CMakeLists.txt build/xinclude || die
  40. }
  41. src_configure() {
  42. local mycmakeargs=(
  43. -DGKLIB_PATH="${S}"/GKlib
  44. -DSHARED="$(usex static-libs OFF ON)"
  45. -DOPENMP="$(usex openmp)"
  46. )
  47. cmake_src_configure
  48. }
  49. src_test() {
  50. cd graphs || die
  51. local PATH="${BUILD_DIR}"/programs/:${PATH}
  52. ndmetis mdual.graph || die
  53. mpmetis metis.mesh 2 || die
  54. gpmetis test.mgraph 4 || die
  55. gpmetis copter2.graph 4 || die
  56. graphchk 4elt.graph || die
  57. }
  58. src_install() {
  59. cmake_src_install
  60. use doc && dodoc manual/manual.pdf
  61. if use examples; then
  62. docinto examples
  63. dodoc -r programs graphs
  64. fi
  65. cat >> "${T}"/metis.pc <<- EOF || die
  66. prefix=${EPREFIX}/usr
  67. exec_prefix=\${prefix}
  68. libdir=\${exec_prefix}/$(get_libdir)
  69. includedir=\${prefix}/include
  70. Name: METIS
  71. Description: Software for partioning unstructured graphes and meshes
  72. Version: ${PV}
  73. Cflags: -I\${includedir}
  74. Libs: -L\${libdir} -lmetis -lGKlib
  75. EOF
  76. insinto /usr/$(get_libdir)/pkgconfig
  77. doins "${T}"/metis.pc
  78. }