math/metis: switch to PETSc fork

Upstream disapeared, and 2 forks are available, KarypisLab on GitHub and
the PETSc one. ATM PETSc seems more active.

Also enable OPENMP by default where it is available.

Remark: manual.pdf and the graph directory are no more available.
This commit is contained in:
Thierry Thomas 2025-04-18 16:27:56 +02:00
parent 35d35c737f
commit ae4da54035
7 changed files with 64 additions and 47 deletions

View file

@ -1,26 +1,32 @@
PORTNAME= metis
PORTVERSION= 5.1.0
PORTREVISION= 9
DISTVERSION= 5.1.0-p13
PORTEPOCH= 1
CATEGORIES= math
MASTER_SITES= http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/
MASTER_SITES= https://bitbucket.org/petsc/pkg-metis/get/
DISTNAME= ${LGCOMMIT}
MAINTAINER= ports@FreeBSD.org
COMMENT= Package for unstructured graph partitioning
WWW= http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
WWW= https://bitbucket.org/petsc/pkg-metis
LICENSE= APACHE20
USES= cmake:noninja compiler:c11
# Keep cmake:insource to be used by math/parmetis
USES= cmake:insource,noninja compiler:c11 tar:bzip2
CONFLICTS= metis-edf metis4-4*
PORTDOCS= manual.pdf
SHCOMMIT= 08c3082720ff
LGCOMMIT= ${SHCOMMIT}9114b8e3cbaa4484a26739cd7d2d
WRKSRC= ${WRKDIR}/petsc-pkg-metis-${SHCOMMIT}
BINS= cmpfillin gpmetis graphchk m2gmetis mpmetis ndmetis
SHLIB_MAJOR?= 2
OPTIONS_DEFINE= DOCS OPENMP SHARED STATIC
OPTIONS_DEFINE= OPENMP SHARED STATIC
OPTIONS_DEFAULT= SHARED STATIC
OPTIONS_DEFAULT_amd64= OPENMP
OPTIONS_DEFAULT_i386= OPENMP
OPTIONS_DEFAULT_powerpc64= OPENMP
OPTIONS_DEFAULT_powerpc64le= OPENMP
OPTIONS_SUB= yes
OPENMP_DESC= multithreading via OpenMP
@ -31,41 +37,43 @@ OPENMP_CMAKE_BOOL= OPENMP
SHARED_USE= LDCONFIG=yes
CMAKE_ARGS_SHARED= -DSHARED=1 -DSHLIB_MAJOR="${SHLIB_MAJOR}"
CMAKE_ARGS_SHARED= -DSHARED=1 -DSHLIB_MAJOR:STRING="${SHLIB_MAJOR}" \
-DMETIS_INSTALL:BOOL=1
ALL_TARGET_SHARED= all
WRKSRC_SHARED= ${WRKSRC}_SHARED
INSTALL_WRKSRC_SHARED= ${WRKSRC_SHARED}
CMAKE_SOURCE_PATH_SHARED=${WRKSRC_SHARED}
ALL_TARGET_STATIC= metis
WRKSRC_STATIC= ${WRKSRC}
INSTALL_WRKSRC_STATIC= ${WRKSRC_STATIC}/libmetis
CMAKE_SOURCE_PATH_STATIC=${WRKSRC_STATIC}
CFLAGS+= -fpic
.include <bsd.port.options.mk>
pre-configure:
@${REINPLACE_CMD} -e "/^# Add compiler flags/,/^$$/d" \
-e "/^check_include_file(execinfo.h/d" \
${WRKSRC}/GKlib/GKlibSystem.cmake
@${REINPLACE_CMD} -e "\|/home/karypis/|d" \
${WRKSRC}/programs/CMakeLists.txt
.if ${ARCH:M*64*}
@${REINPLACE_CMD} -e \
's|IDXTYPEWIDTH 32|IDXTYPEWIDTH 64|' \
${WRKSRC}/include/metis.h
CFLAGS+= -DMETIS_USE_LONGINDEX
.endif
pre-configure:
${REINPLACE_CMD} -e "/^# Add compiler flags/,/^$$/d" \
-e "/^check_include_file(execinfo.h/d" \
${WRKSRC}/GKlib/GKlibSystem.cmake
pre-configure-SHARED-on:
@${CP} -R ${WRKSRC} ${WRKSRC_SHARED}
${CP} -R ${WRKSRC} ${WRKSRC_SHARED}
${REINPLACE_CMD} -e '/programs/s|#add_subdir|add_subdir|' \
${WRKSRC_SHARED}/CMakeLists.txt
do-configure:
.for o in SHARED STATIC
.if ${PORT_OPTIONS:M${o}}
@${PRINTF} "\n\nConfiguring ${o}:\n\n\n"
@cd ${WRKSRC_${o}}; ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} \
cd ${WRKSRC_${o}}; ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} \
${CMAKE_ARGS:C|${CFLAGS}|& ${${o}_FLAGS}|g} ${CMAKE_ARGS_${o}} \
-DGKLIB_PATH="${WRKSRC_${o}}/GKlib" ${CMAKE_SOURCE_PATH}
-DGKLIB_PATH="${WRKSRC_${o}}/GKlib" ${CMAKE_SOURCE_PATH_${o}}
.endif
.endfor
@ -73,32 +81,32 @@ do-build:
.for o in SHARED STATIC
.if ${PORT_OPTIONS:M${o}}
@${PRINTF} "\n\nBuilding ${o}:\n\n\n"
@cd ${WRKSRC_${o}}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
cd ${WRKSRC_${o}}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
${MAKE_ARGS} ${ALL_TARGET_${o}}
.endif
.endfor
.if ${PORT_OPTIONS:MSHARED}
@cd ${WRKSRC_SHARED}/programs; ${STRIP_CMD} ${BINS}
@cd ${WRKSRC_SHARED}/libmetis; ${STRIP_CMD} libmetis.so.*
cd ${WRKSRC_SHARED}/programs; ${STRIP_CMD} ${BINS}
cd ${WRKSRC_SHARED}/libmetis; ${STRIP_CMD} libmetis.so.*
.endif
.if ${PORT_OPTIONS:MSTATIC}
@cd ${WRKSRC_STATIC}/libmetis; ${STRIP_CMD} libmetis.a
cd ${WRKSRC_STATIC}/libmetis; ${STRIP_CMD} libmetis.a
.endif
check regression-test test: build
.if defined(MAINTAINER_MODE)
# No more graph directory, to be taken from an original tarball
# e.g. https://people.freebsd.org/~thierry/metis-5.1.0.tar.gz
test: build
cd ${WRKSRC_SHARED}/graphs ; ../programs/gpmetis ./4elt.graph 5
.endif
do-install:
.for o in SHARED STATIC
.if ${PORT_OPTIONS:M${o}}
@${PRINTF} "\n\nInstalling ${o}:\n\n\n"
@cd ${INSTALL_WRKSRC_${o}}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
cd ${INSTALL_WRKSRC_${o}}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
${MAKE_ARGS} install
.endif
.endfor
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/manual/manual.pdf ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View file

@ -1,2 +1,3 @@
SHA256 (metis-5.1.0.tar.gz) = 76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2
SIZE (metis-5.1.0.tar.gz) = 4984968
TIMESTAMP = 1744964577
SHA256 (08c3082720ff9114b8e3cbaa4484a26739cd7d2d.tar.bz2) = a696531699f690598c1983d95b064ead5532535e603f27166e29e5376d545ece
SIZE (08c3082720ff9114b8e3cbaa4484a26739cd7d2d.tar.bz2) = 232485

View file

@ -1,8 +1,8 @@
--- CMakeLists.txt.orig 2013-03-30 16:24:45 UTC
--- CMakeLists.txt.orig 2025-03-31 19:34:42 UTC
+++ CMakeLists.txt
@@ -25,3 +25,5 @@ include_directories(include)
@@ -22,3 +22,5 @@ add_subdirectory("libmetis")
add_subdirectory("include")
add_subdirectory("libmetis")
add_subdirectory("programs")
#add_subdirectory("programs")
+# Borrowed from metis-edf
+add_subdirectory("GKlib")

View file

@ -1,23 +1,26 @@
--- libmetis/CMakeLists.txt.orig 2013-03-30 16:24:45 UTC
--- libmetis/CMakeLists.txt.orig 2025-03-31 19:34:42 UTC
+++ libmetis/CMakeLists.txt
@@ -2,8 +2,13 @@
include_directories(.)
@@ -3,15 +3,22 @@ file(GLOB metis_sources *.c)
include_directories ("${PROJECT_BINARY_DIR}/include")
# Find sources.
file(GLOB metis_sources *.c)
+# Borrowed from metis-edf
+file(GLOB libmetis_h *.h)
# Build libmetis.
add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
-target_link_libraries(metis ${MATH_LIB})
+target_link_libraries(metis m)
+if(SHARED)
+ set_target_properties(metis PROPERTIES SOVERSION ${SHLIB_MAJOR})
+endif()
if(UNIX)
target_link_libraries(metis m)
endif()
@@ -13,4 +18,6 @@ if(METIS_INSTALL)
if(METIS_INSTALL)
install(TARGETS metis
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
ARCHIVE DESTINATION lib)
+# Borrowed from metis-edf
+ install(FILES ${libmetis_h} DESTINATION include/libmetis)
install(FILES gklib_defs.h DESTINATION include)
install(FILES gklib_rename.h DESTINATION include)
endif()

View file

@ -1,6 +1,6 @@
--- programs/CMakeLists.txt.orig 2013-03-30 16:24:45 UTC
--- programs/CMakeLists.txt.orig 2025-03-31 19:34:42 UTC
+++ programs/CMakeLists.txt
@@ -13,9 +13,14 @@ foreach(prog gpmetis ndmetis mpmetis m2gmetis graphchk
@@ -13,9 +13,14 @@ endforeach(prog)
# target_link_libraries(${prog} metis profiler)
endforeach(prog)

View file

@ -6,3 +6,5 @@ multi-constraint partitioning schemes developed in our lab.
METIS provides high-quality partitions, is extremely fast, and
produces low-fill orderings.
See also: https://github.com/KarypisLab/METIS

View file

@ -4,7 +4,6 @@
%%SHARED%%bin/m2gmetis
%%SHARED%%bin/mpmetis
%%SHARED%%bin/ndmetis
%%SHARED%%include/GKlib.h
%%SHARED%%include/gk_arch.h
%%SHARED%%include/gk_defs.h
%%SHARED%%include/gk_externs.h
@ -20,6 +19,10 @@
%%SHARED%%include/gk_proto.h
%%SHARED%%include/gk_struct.h
%%SHARED%%include/gk_types.h
%%SHARED%%include/gklib_defs.h
%%SHARED%%include/gklib_rename.h
%%SHARED%%include/gklib_tls.h
%%SHARED%%include/GKlib.h
%%SHARED%%include/gkregex.h
%%STATIC%%include/libmetis/defs.h
%%STATIC%%include/libmetis/gklib_defs.h