From 5ef4b6879fb8102d6a2d1e12a09335c6b2d1ed97 Mon Sep 17 00:00:00 2001 From: "Oleg A. Khlybov" Date: Tue, 12 Nov 2019 03:01:18 -0800 Subject: [PATCH 1/2] Introduced the parmetis package. --- ...ngw-w64-does-not-have-sys-resource-h.patch | 15 ++++ ...se-reserved-double-underscored-names.patch | 21 +++++ .../0003-WIN32-Install-RUNTIME-to-bin.patch | 18 +++++ .../0004-METIS-GKLIB-location.patch | 65 ++++++++++++++++ mingw-w64-parmetis/0005-find-MPI.patch | 21 +++++ mingw-w64-parmetis/PKGBUILD | 77 +++++++++++++++++++ 6 files changed, 217 insertions(+) create mode 100644 mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch create mode 100644 mingw-w64-parmetis/0002-mingw-w64-do-not-use-reserved-double-underscored-names.patch create mode 100644 mingw-w64-parmetis/0003-WIN32-Install-RUNTIME-to-bin.patch create mode 100644 mingw-w64-parmetis/0004-METIS-GKLIB-location.patch create mode 100644 mingw-w64-parmetis/0005-find-MPI.patch create mode 100644 mingw-w64-parmetis/PKGBUILD diff --git a/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch b/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch new file mode 100644 index 0000000000..e99a0f40e4 --- /dev/null +++ b/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch @@ -0,0 +1,15 @@ +diff -urN parmetis-4.0.3.orig/metis/GKlib/gk_arch.h parmetis-4.0.3/metis/GKlib/gk_arch.h +--- parmetis-4.0.3.orig/metis/GKlib/gk_arch.h 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/metis/GKlib/gk_arch.h 2019-11-11 22:46:53.625107300 -0800 +@@ -41,8 +41,9 @@ + #endif + #include + #include +- #include +- #include ++ #ifndef __MINGW32__ ++ #include ++ #endif #include + #endif + + diff --git a/mingw-w64-parmetis/0002-mingw-w64-do-not-use-reserved-double-underscored-names.patch b/mingw-w64-parmetis/0002-mingw-w64-do-not-use-reserved-double-underscored-names.patch new file mode 100644 index 0000000000..32a337c15b --- /dev/null +++ b/mingw-w64-parmetis/0002-mingw-w64-do-not-use-reserved-double-underscored-names.patch @@ -0,0 +1,21 @@ +diff -urN parmetis-4.0.3.orig/metis/GKlib/gk_getopt.h parmetis-4.0.3/metis/GKlib/gk_getopt.h +--- parmetis-4.0.3.orig/metis/GKlib/gk_getopt.h 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/metis/GKlib/gk_getopt.h 2019-11-11 22:48:38.248965700 -0800 +@@ -52,12 +52,11 @@ + + + /* Function prototypes */ +-extern int gk_getopt(int __argc, char **__argv, char *__shortopts); +-extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts, +- struct gk_option *__longopts, int *__longind); +-extern int gk_getopt_long_only (int __argc, char **__argv, +- char *__shortopts, struct gk_option *__longopts, int *__longind); +- ++extern int gk_getopt(int gk_argc, char **gk_argv, char *__shortopts); ++extern int gk_getopt_long(int gk_argc, char **gk_argv, char *__shortopts, ++ struct gk_option *__longopts, int *__longind); ++extern int gk_getopt_long_only (int gk_argc, char **gk_argv, ++ char *__shortopts, struct gk_option *__longopts, int *__longind); + + + #endif diff --git a/mingw-w64-parmetis/0003-WIN32-Install-RUNTIME-to-bin.patch b/mingw-w64-parmetis/0003-WIN32-Install-RUNTIME-to-bin.patch new file mode 100644 index 0000000000..3ccf8b46d4 --- /dev/null +++ b/mingw-w64-parmetis/0003-WIN32-Install-RUNTIME-to-bin.patch @@ -0,0 +1,18 @@ +diff -urN parmetis-4.0.3.orig/libparmetis/CMakeLists.txt parmetis-4.0.3/libparmetis/CMakeLists.txt +--- parmetis-4.0.3.orig/libparmetis/CMakeLists.txt 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/libparmetis/CMakeLists.txt 2019-11-11 23:27:19.061446400 -0800 +@@ -8,7 +8,13 @@ + target_link_libraries(parmetis metis ${MPI_LIBRARIES}) + set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + ++if(WIN32) ++ set(RT_DEST bin) ++else() ++ set(RT_DEST lib) ++endif() ++ + install(TARGETS parmetis + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION ${RT_DEST} + ARCHIVE DESTINATION lib) diff --git a/mingw-w64-parmetis/0004-METIS-GKLIB-location.patch b/mingw-w64-parmetis/0004-METIS-GKLIB-location.patch new file mode 100644 index 0000000000..6de7efd1f8 --- /dev/null +++ b/mingw-w64-parmetis/0004-METIS-GKLIB-location.patch @@ -0,0 +1,65 @@ +diff -urN parmetis-4.0.3.orig/CMakeLists.txt parmetis-4.0.3/CMakeLists.txt +--- parmetis-4.0.3.orig/CMakeLists.txt 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/CMakeLists.txt 2019-11-12 01:46:27.177627800 -0800 +@@ -1,12 +1,18 @@ + cmake_minimum_required(VERSION 2.8) + project(ParMETIS) + +-set(GKLIB_PATH METIS/GKlib CACHE PATH "path to GKlib") +-set(METIS_PATH METIS CACHE PATH "path to METIS") ++include(FindPkgConfig) ++pkg_check_modules(METIS metis) ++if(NOT METIS_FOUND) ++ message(FATAL_ERROR "metis is not found") ++endif() ++ ++set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/metis/GKlib" CACHE PATH "path to GKlib") ++#set(METIS_PATH METIS CACHE PATH "path to METIS") + + # Symlink ./metis to wherever metis is. This allows files to be + # included from metis/libmetis/. +-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${METIS_PATH} metis) ++#execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${METIS_PATH} metis) + + # Search for MPI. + # GK commented this out as it seems to be creating problems +@@ -30,10 +36,11 @@ + include_directories(include) + include_directories(${MPI_INCLUDE_PATH}) + include_directories(${GKLIB_PATH}) +-include_directories(${METIS_PATH}/include) ++#include_directories(${METIS_PATH}/include) ++include_directories(${METIS_INCLUDE_DIRS}) + + # List of directories that cmake will look for CMakeLists.txt +-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) ++#add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) + add_subdirectory(include) + add_subdirectory(libparmetis) + add_subdirectory(programs) +diff -urN parmetis-4.0.3.orig/libparmetis/CMakeLists.txt parmetis-4.0.3/libparmetis/CMakeLists.txt +--- parmetis-4.0.3.orig/libparmetis/CMakeLists.txt 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/libparmetis/CMakeLists.txt 2019-11-12 01:37:03.599001000 -0800 +@@ -5,7 +5,7 @@ + # Create libparmetis + add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources}) + # Link with metis and MPI libraries. +-target_link_libraries(parmetis metis ${MPI_LIBRARIES}) ++target_link_libraries(parmetis ${METIS_LINK_LIBRARIES} ${MPI_LIBRARIES}) + set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + + install(TARGETS parmetis +diff -urN parmetis-4.0.3.orig/metis/GKlib/CMakeLists.txt parmetis-4.0.3/metis/GKlib/CMakeLists.txt +--- parmetis-4.0.3.orig/metis/GKlib/CMakeLists.txt 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/metis/GKlib/CMakeLists.txt 2019-11-12 01:45:02.052483700 -0800 +@@ -1,9 +1,7 @@ + cmake_minimum_required(VERSION 2.8) + project(GKlib) + +-get_filename_component(abs "." ABSOLUTE) +-set(GKLIB_PATH ${abs}) +-unset(abs) ++set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/metis/GKlib" CACHE PATH "path to GKlib") + include(GKlibSystem.cmake) + + include_directories(".") diff --git a/mingw-w64-parmetis/0005-find-MPI.patch b/mingw-w64-parmetis/0005-find-MPI.patch new file mode 100644 index 0000000000..1b5d387726 --- /dev/null +++ b/mingw-w64-parmetis/0005-find-MPI.patch @@ -0,0 +1,21 @@ +diff -urN parmetis-4.0.3.orig/CMakeLists.txt parmetis-4.0.3/CMakeLists.txt +--- parmetis-4.0.3.orig/CMakeLists.txt 2013-03-30 08:24:50.000000000 -0700 ++++ parmetis-4.0.3/CMakeLists.txt 2019-11-12 00:35:22.652916600 -0800 +@@ -9,12 +9,11 @@ + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${METIS_PATH} metis) + + # Search for MPI. +-# GK commented this out as it seems to be creating problems +-# include(FindMPI) +-# if(NOT MPI_FOUND) +-# message(FATAL_ERROR "mpi is not found") +-# endif() +-# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") ++include(FindMPI) ++if(NOT MPI_FOUND) ++ message(FATAL_ERROR "mpi is not found") ++endif() ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") + + # Prepare libraries. + if(SHARED) diff --git a/mingw-w64-parmetis/PKGBUILD b/mingw-w64-parmetis/PKGBUILD new file mode 100644 index 0000000000..ce8c544d84 --- /dev/null +++ b/mingw-w64-parmetis/PKGBUILD @@ -0,0 +1,77 @@ +# Contributor: Oleg A. Khlybov + +_realname=parmetis +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=4.0.3 +pkgrel=1 +pkgdesc="Parallel Graph Partitioning and Fill-reducing Matrix Ordering (mingw-w64)" +arch=('any') +url='http://glaros.dtc.umn.edu/gkhome/views/parmetis' +license=('Apache') +depends=("${MINGW_PACKAGE_PREFIX}-metis>=5.1.0" "${MINGW_PACKAGE_PREFIX}-msmpi") +makedepends=("${MINGW_PACKAGE_PREFIX}-cmake") +options=('strip' 'staticlibs') +source=("http://glaros.dtc.umn.edu/gkhome/fetch/sw/${_realname}/parmetis-${pkgver}.tar.gz" + "0001-mingw-w64-does-not-have-sys-resource-h.patch" + "0002-mingw-w64-do-not-use-reserved-double-underscored-names.patch" + "0003-WIN32-Install-RUNTIME-to-bin.patch" + "0004-METIS-GKLIB-location.patch" + "0005-find-MPI.patch") +sha256sums=('f2d9a231b7cf97f1fee6e8c9663113ebf6c240d407d3c118c55b3633d6be6e5f' + '14774c97455ef931069c43021b527f08821deeaee1ac62c837674ceb9118d48a' + '141026e4e39f0529a916dce718273875ba12a98b0ebe7c2730e4950866ffc845' + 'b384fa51e01b9d3384fd067236e34036b0520f375d16abe575005e518dd5b1fd' + 'f1e7a174460ac79732de10d0f076f87b2ed60d185436bda0698bd012e70ea53c' + '642f801967edc196e94e28f7fa3a63759ab33c1a534a5924d404acdcbfea2eb2') +prepare() { + cd "${srcdir}"/${_realname}-${pkgver} + for p in ${srcdir}/*.patch; do + patch -p1 -i "$p" + done +} + +build() { + for _shared in OFF ON; do + cd "$srcdir"/${_realname}-${pkgver} + [[ -d "${srcdir}"/build-shared-${_shared}-${CARCH} ]] && rm -rf "${srcdir}"/build-shared-${_shared}-${CARCH} + mkdir -p "${srcdir}"/build-shared-${_shared}-${CARCH} && cd "${srcdir}"/build-shared-${_shared}-${CARCH} + declare -a extra_config + if check_option "debug" "n"; then + extra_config+=("-DCMAKE_BUILD_TYPE=Release") + else + extra_config+=("-DCMAKE_BUILD_TYPE=Debug") + fi + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake \ + -G'MSYS Makefiles' \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DCMAKE_C_COMPILER=mpicc \ + -DCMAKE_CXX_COMPILER=mpicxx \ + -DCMAKE_C_FLAGS="${CPPFLAGS} ${CFLAGS}" \ + "${extra_config[@]}" \ + -DSHARED=${_shared} \ + ../${_realname}-${pkgver} + make + done +} + +package() { + for _shared in OFF ON; do + cd "${srcdir}"/build-shared-${_shared}-${CARCH} + make install DESTDIR="${pkgdir}" + mkdir -p "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig" + echo " + prefix=${MINGW_PREFIX} + libdir=\${prefix}/lib + includedir=\${prefix}/include + Name: ${_realname} + URL: ${url} + Version: ${pkgver} + Description: ${pkgdesc} + Requires: metis msmpi + Cflags: -I\${includedir} + Libs: -L\${libdir} -l${_realname} + " | sed '/^\s*$/d;s/^\s*//' > "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/${_realname}.pc" + done +} From d6f381766d371dfa2281fdaa4020abfd083aa27b Mon Sep 17 00:00:00 2001 From: "Oleg A. Khlybov" Date: Wed, 13 Nov 2019 22:06:58 -0800 Subject: [PATCH 2/2] Fixed a typo in the patch. --- ...01-mingw-w64-does-not-have-sys-resource-h.patch | 14 ++++++-------- mingw-w64-parmetis/PKGBUILD | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch b/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch index e99a0f40e4..fcbfa90701 100644 --- a/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch +++ b/mingw-w64-parmetis/0001-mingw-w64-does-not-have-sys-resource-h.patch @@ -1,15 +1,13 @@ diff -urN parmetis-4.0.3.orig/metis/GKlib/gk_arch.h parmetis-4.0.3/metis/GKlib/gk_arch.h --- parmetis-4.0.3.orig/metis/GKlib/gk_arch.h 2013-03-30 08:24:50.000000000 -0700 -+++ parmetis-4.0.3/metis/GKlib/gk_arch.h 2019-11-11 22:46:53.625107300 -0800 -@@ -41,8 +41,9 @@ ++++ parmetis-4.0.3/metis/GKlib/gk_arch.h 2019-11-13 22:02:07.318990500 -0800 +@@ -41,7 +41,9 @@ #endif #include #include -- #include -- #include -+ #ifndef __MINGW32__ -+ #include -+ #endif #include ++#ifndef __MINGW32__ + #include ++#endif + #include #endif - diff --git a/mingw-w64-parmetis/PKGBUILD b/mingw-w64-parmetis/PKGBUILD index ce8c544d84..5c35126a7f 100644 --- a/mingw-w64-parmetis/PKGBUILD +++ b/mingw-w64-parmetis/PKGBUILD @@ -19,11 +19,12 @@ source=("http://glaros.dtc.umn.edu/gkhome/fetch/sw/${_realname}/parmetis-${pkgve "0004-METIS-GKLIB-location.patch" "0005-find-MPI.patch") sha256sums=('f2d9a231b7cf97f1fee6e8c9663113ebf6c240d407d3c118c55b3633d6be6e5f' - '14774c97455ef931069c43021b527f08821deeaee1ac62c837674ceb9118d48a' + '22e62ec7dfbaf01865b1e09e7b3f3bad20188354efbef6e64d102a03c7bf748b' '141026e4e39f0529a916dce718273875ba12a98b0ebe7c2730e4950866ffc845' 'b384fa51e01b9d3384fd067236e34036b0520f375d16abe575005e518dd5b1fd' 'f1e7a174460ac79732de10d0f076f87b2ed60d185436bda0698bd012e70ea53c' '642f801967edc196e94e28f7fa3a63759ab33c1a534a5924d404acdcbfea2eb2') + prepare() { cd "${srcdir}"/${_realname}-${pkgver} for p in ${srcdir}/*.patch; do