aboutsummaryrefslogtreecommitdiff
path: root/academic
diff options
context:
space:
mode:
Diffstat (limited to 'academic')
-rw-r--r--academic/metis/autotoolize.diff199
-rw-r--r--academic/metis/metis.SlackBuild57
-rw-r--r--academic/metis/metis.info6
-rw-r--r--academic/metis/patches/cmake.diff328
4 files changed, 361 insertions, 229 deletions
diff --git a/academic/metis/autotoolize.diff b/academic/metis/autotoolize.diff
deleted file mode 100644
index 93c16ea6b343..000000000000
--- a/academic/metis/autotoolize.diff
+++ /dev/null
@@ -1,199 +0,0 @@
-diff --git a/Doc/Makefile.am b/Doc/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Doc/Makefile.am
-@@ -0,0 +1,5 @@
-+dist_noinst_DATA = manual.ps
-+dist_pdf_DATA = manual.pdf
-+
-+%.pdf: %.ps
-+ ps2pdf $<
-diff --git a/Graphs/Makefile.am b/Graphs/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Graphs/Makefile.am
-@@ -0,0 +1,2 @@
-+EXTRA_DIST = 0README
-+dist_noinst_DATA = 4elt.graph 4elt.graph.part.10 metis.mesh test.mgraph
-diff --git a/Lib/Makefile.am b/Lib/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Lib/Makefile.am
-@@ -0,0 +1,61 @@
-+pkgincludedir = $(includedir)/metis
-+pkginclude_HEADERS = defs.h macros.h metis.h proto.h rename.h struct.h
-+
-+SRC = \
-+ balance.c \
-+ bucketsort.c \
-+ ccgraph.c \
-+ coarsen.c \
-+ compress.c \
-+ debug.c \
-+ estmem.c \
-+ fm.c \
-+ fortran.c \
-+ frename.c \
-+ graph.c \
-+ initpart.c \
-+ kmetis.c \
-+ kvmetis.c \
-+ kwayfm.c \
-+ kwayrefine.c \
-+ kwayvolfm.c \
-+ kwayvolrefine.c \
-+ match.c \
-+ mbalance.c \
-+ mbalance2.c \
-+ mcoarsen.c \
-+ memory.c \
-+ mesh.c \
-+ meshpart.c \
-+ mfm.c \
-+ mfm2.c \
-+ mincover.c \
-+ minitpart.c \
-+ minitpart2.c \
-+ mkmetis.c \
-+ mkwayfmh.c \
-+ mkwayrefine.c \
-+ mmatch.c \
-+ mmd.c \
-+ mpmetis.c \
-+ mrefine.c \
-+ mrefine2.c \
-+ mutil.c \
-+ myqsort.c \
-+ ometis.c \
-+ parmetis.c \
-+ pmetis.c \
-+ pqueue.c \
-+ refine.c \
-+ separator.c \
-+ sfm.c \
-+ srefine.c \
-+ stat.c \
-+ subdomains.c \
-+ timing.c \
-+ util.c
-+
-+lib_LTLIBRARIES = libmetis.la
-+libmetis_la_SOURCES = $(SRC)
-+libmetis_la_LIBADD = -lm
-+libmetis_la_LDFLAGS = -no-undefined -release $(PACKAGE_VERSION)
-diff --git a/Makefile.am b/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Makefile.am
-@@ -0,0 +1,5 @@
-+SUBDIRS = Lib Programs Graphs Test Doc
-+EXTRA_DIST = CHANGES FILES INSTALL LICENSE VERSION
-+
-+pkgconfigdir = $(libdir)/pkgconfig
-+pkgconfig_DATA = metis.pc
-diff --git a/Programs/Makefile.am b/Programs/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Programs/Makefile.am
-@@ -0,0 +1,23 @@
-+AM_CPPFLAGS = -I$(top_srcdir)/Lib
-+LDADD = $(top_builddir)/Lib/libmetis.la
-+
-+bin_PROGRAMS = \
-+ pmetis \
-+ kmetis \
-+ oemetis \
-+ onmetis \
-+ mesh2dual \
-+ mesh2nodal \
-+ partdmesh \
-+ partnmesh \
-+ graphchk
-+
-+pmetis_SOURCES = pmetis.c io.c
-+kmetis_SOURCES = kmetis.c io.c
-+oemetis_SOURCES = oemetis.c io.c smbfactor.c
-+onmetis_SOURCES = onmetis.c io.c smbfactor.c
-+mesh2dual_SOURCES = mesh2dual.c io.c
-+mesh2nodal_SOURCES = mesh2nodal.c io.c
-+partdmesh_SOURCES = partdmesh.c io.c
-+partnmesh_SOURCES = partnmesh.c io.c
-+graphchk_SOURCES = graphchk.c io.c
-diff --git a/Test/Makefile.am b/Test/Makefile.am
-new file mode 100644
---- /dev/null
-+++ b/Test/Makefile.am
-@@ -0,0 +1,11 @@
-+AM_CPPFLAGS = -I$(top_srcdir)/Lib
-+LDADD = $(top_builddir)/Lib/libmetis.la
-+
-+check_PROGRAMS = mtest
-+mtest_SOURCES = mtest.c ../Programs/io.c
-+
-+GRAPHS = \
-+ ../Graphs/4elt.graph
-+
-+check-local: $(check_PROGRAMS) $(GRAPHS)
-+ -./mtest ../Graphs/4elt.graph
-diff --git a/configure.ac b/configure.ac
-new file mode 100644
---- /dev/null
-+++ b/configure.ac
-@@ -0,0 +1,40 @@
-+# -*- Autoconf -*-
-+# Process this file with autoconf to produce a configure script.
-+
-+AC_PREREQ([2.69])
-+AC_INIT([METIS],[4.0.3],[karypis@cs.umn.edu],[metis],[http://glaros.dtc.umn.edu/gkhome/metis/metis/overview])
-+AC_CONFIG_SRCDIR([Lib/metis.h])
-+AC_CONFIG_HEADERS([config.h])
-+AM_INIT_AUTOMAKE([foreign])
-+LT_INIT
-+
-+# Checks for programs.
-+AC_PROG_INSTALL
-+AC_PROG_CC
-+
-+LIBS_SAVED=$LIBS
-+
-+# Checks for libraries.
-+AC_CHECK_LIB([m], [sqrt])
-+
-+# Checks for header files.
-+AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
-+
-+# Checks for typedefs, structures, and compiler characteristics.
-+
-+# Checks for library functions.
-+AC_FUNC_MALLOC
-+AC_FUNC_REALLOC
-+AC_CHECK_FUNCS([pow sqrt strtol])
-+
-+LIBS=$LIBS_SAVED
-+
-+AC_CONFIG_FILES([
-+ metis.pc
-+ Makefile
-+ Doc/Makefile
-+ Graphs/Makefile
-+ Lib/Makefile
-+ Programs/Makefile
-+ Test/Makefile])
-+AC_OUTPUT
-diff --git a/metis.pc.in b/metis.pc.in
-new file mode 100644
---- /dev/null
-+++ b/metis.pc.in
-@@ -0,0 +1,12 @@
-+prefix=@prefix@
-+exec_prefix=@exec_prefix@
-+libdir=@libdir@
-+includedir=@includedir@
-+
-+Name: @PACKAGE_NAME@
-+Description: Software for partitioning unstructured graphs and meshes
-+Version: @PACKAGE_VERSION@
-+URL: @PACKAGE_URL@
-+Libs: -L${libdir} -lmetis
-+Libs.private: -lm
-+Cflags: -I${includedir}/metis
diff --git a/academic/metis/metis.SlackBuild b/academic/metis/metis.SlackBuild
index b8ba91ac581a..5bd73be96429 100644
--- a/academic/metis/metis.SlackBuild
+++ b/academic/metis/metis.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for METIS
-# Copyright 2015 Kyle Guinn <elyk03@gmail.com>, USA
+# Copyright 2015-2016 Kyle Guinn <elyk03@gmail.com>, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,13 +23,13 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=metis
-VERSION=${VERSION:-4.0.3}
-BUILD=${BUILD:-3}
+VERSION=${VERSION:-5.1.0}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$(uname -m) ;;
esac
@@ -40,11 +40,14 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM-$VERSION
OUTPUT=${OUTPUT:-/tmp}
-DOCS="CHANGES FILES INSTALL LICENSE VERSION"
+DOCS="Changelog LICENSE.txt manual/manual.pdf"
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
@@ -57,7 +60,7 @@ else
fi
# Recommended by SuiteSparse
-SLKCFLAGS="$SLKCFLAGS -fexceptions -D_FILE_OFFSET_BITS=64"
+SLKCFLAGS="$SLKCFLAGS -fexceptions"
set -e
@@ -70,27 +73,27 @@ cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go-w,a+rX-st .
-patch -p1 < $CWD/autotoolize.diff
-autoreconf -vif
-
-CFLAGS="$SLKCFLAGS" \
-./configure \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --mandir=/usr/man \
- --infodir=/usr/info \
- --docdir=/usr/doc/$PRGNAM-$VERSION \
- --enable-shared \
- --disable-dependency-tracking \
- --build=$ARCH-slackware-linux
-
-make
-make check
-make install-strip DESTDIR=$PKG
-
-find $PKG/usr/lib${LIBDIRSUFFIX} -name '*.la' -delete
+# Fix compiler flags and directories.
+# Fix overlinking.
+# Respect CMake's BUILD_SHARED_LIBS variable.
+# Add a pkg-config file.
+patch -p1 < $CWD/patches/cmake.diff
+
+mkdir -p build
+cd build
+ cmake \
+ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_SYSCONFDIR=/etc \
+ -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
+ -DBUILD_SHARED_LIBS=ON \
+ -DCMAKE_SKIP_RPATH=YES \
+ -DCMAKE_RULE_MESSAGES=OFF \
+ -DCMAKE_VERBOSE_MAKEFILE=TRUE \
+ -DOPENMP=ON \
+ ..
+ make install/strip DESTDIR=$PKG
+cd ..
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
diff --git a/academic/metis/metis.info b/academic/metis/metis.info
index f4b17ca94574..64bb8ba5098c 100644
--- a/academic/metis/metis.info
+++ b/academic/metis/metis.info
@@ -1,8 +1,8 @@
PRGNAM="metis"
-VERSION="4.0.3"
+VERSION="5.1.0"
HOMEPAGE="http://glaros.dtc.umn.edu/gkhome/metis/metis/overview"
-DOWNLOAD="http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-4.0.3.tar.gz"
-MD5SUM="d3848b454532ef18dc83e4fb160d1e10"
+DOWNLOAD="http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz"
+MD5SUM="5465e67079419a69e0116de24fce58fe"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/academic/metis/patches/cmake.diff b/academic/metis/patches/cmake.diff
new file mode 100644
index 000000000000..a646cc45fd13
--- /dev/null
+++ b/academic/metis/patches/cmake.diff
@@ -0,0 +1,328 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,25 +1,10 @@
+-cmake_minimum_required(VERSION 2.8)
+-project(METIS)
++cmake_minimum_required(VERSION 3.0)
++project(METIS VERSION 5.1.0 LANGUAGES C)
+
+-set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
+-set(SHARED FALSE CACHE BOOL "build a shared library")
+-
+-if(MSVC)
+- set(METIS_INSTALL FALSE)
+-else()
+- set(METIS_INSTALL TRUE)
+-endif()
+-
+-# Configure libmetis library.
+-if(SHARED)
+- set(METIS_LIBRARY_TYPE SHARED)
+-else()
+- set(METIS_LIBRARY_TYPE STATIC)
+-endif(SHARED)
+-
+-include(${GKLIB_PATH}/GKlibSystem.cmake)
++include(GNUInstallDirs)
++include(GKlib/GKlibSystem.cmake)
+ # Add include directories.
+-include_directories(${GKLIB_PATH})
++include_directories(GKlib)
+ include_directories(include)
+ # Recursively look for CMakeLists.txt in subdirs.
+ add_subdirectory("include")
+diff --git a/GKlib/CMakeLists.txt b/GKlib/CMakeLists.txt
+--- a/GKlib/CMakeLists.txt
++++ b/GKlib/CMakeLists.txt
+@@ -1,21 +1,23 @@
+-cmake_minimum_required(VERSION 2.8)
+-project(GKlib)
++cmake_minimum_required(VERSION 3.0)
++project(GKlib LANGUAGES C)
+
+-get_filename_component(abs "." ABSOLUTE)
+-set(GKLIB_PATH ${abs})
+-unset(abs)
++include(GNUInstallDirs)
+ include(GKlibSystem.cmake)
+
+ include_directories(".")
+-add_library(GKlib STATIC ${GKlib_sources})
++add_library(GKlib ${GKlib_sources})
++if(OPENMP AND OPENMP_FOUND)
++ set_property(TARGET GKlib APPEND PROPERTY COMPILE_FLAGS ${OpenMP_C_FLAGS})
++ set_property(TARGET GKlib APPEND PROPERTY LINK_FLAGS ${OpenMP_C_FLAGS})
++endif()
+ if(UNIX)
+- target_link_libraries(GKlib m)
++ target_link_libraries(GKlib PRIVATE m)
+ endif(UNIX)
+
+ include_directories("test")
+ add_subdirectory("test")
+
+ install(TARGETS GKlib
+- ARCHIVE DESTINATION lib
+- LIBRARY DESTINATION lib)
+-install(FILES ${GKlib_includes} DESTINATION include)
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES ${GKlib_includes} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GKlib)
+diff --git a/GKlib/GKlibSystem.cmake b/GKlib/GKlibSystem.cmake
+--- a/GKlib/GKlibSystem.cmake
++++ b/GKlib/GKlibSystem.cmake
+@@ -15,35 +15,28 @@
+
+ # Add compiler flags.
+ if(MSVC)
+- set(GKlib_COPTS "/Ox")
+- set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX")
+-elseif(MINGW)
+- set(GKlib_COPTS "-DUSE_GKREGEX")
+-else()
+- set(GKlib_COPTS "-O3")
+- set(GKlib_COPTIONS "-DLINUX -D_FILE_OFFSET_BITS=64")
+-endif(MSVC)
+-if(CYGWIN)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DCYGWIN")
+-endif(CYGWIN)
++ add_definitions(-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE)
++elseif(UNIX)
++ add_definitions(-DLINUX -D_FILE_OFFSET_BITS=64)
++elseif(CYGWIN)
++ add_definitions(-DCYGWIN)
++endif()
++
+ if(CMAKE_COMPILER_IS_GNUCC)
+ # GCC opts.
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -std=c99 -fno-strict-aliasing")
+- if(NOT MINGW)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -fPIC")
+- endif(NOT MINGW)
++ add_compile_options(-std=c99 -fno-strict-aliasing)
+ # GCC warnings.
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -Wall -pedantic -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas")
++ add_compile_options(-Wall -pedantic -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas)
+ elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun")
+ # Sun insists on -xc99.
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99")
++ add_compile_options(-xc99)
+ endif(CMAKE_COMPILER_IS_GNUCC)
+
+ # Find OpenMP if it is requested.
+ if(OPENMP)
+ include(FindOpenMP)
+ if(OPENMP_FOUND)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__OPENMP__ ${OpenMP_C_FLAGS}")
++ add_definitions(-D__OPENMP__)
+ else()
+ message(WARNING "OpenMP was requested but support was not found")
+ endif(OPENMP_FOUND)
+@@ -52,64 +45,64 @@
+
+ # Add various definitions.
+ if(GDB)
+- set(GKlib_COPTS "${GKlib_COPTS} -g")
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror")
++ add_compile_options(-g)
++ add_compile_options(-Werror)
+ endif(GDB)
+
+
+ if(DEBUG)
+- set(GKlib_COPTS "-g")
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DDEBUG")
++ add_compile_options(-g)
++ add_definitions(-DDEBUG)
+ endif(DEBUG)
+
+ if(GPROF)
+- set(GKlib_COPTS "-pg")
++ add_compile_options(-pg)
+ endif(GPROF)
+
+ if(NOT ASSERT)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DNDEBUG")
++ add_definitions(-DNDEBUG)
+ endif(NOT ASSERT)
+
+ if(NOT ASSERT2)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DNDEBUG2")
++ add_definitions(-DNDEBUG2)
+ endif(NOT ASSERT2)
+
+
+ # Add various options
+ if(PCRE)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__WITHPCRE__")
++ add_definitions(-D__WITHPCRE__)
+ endif(PCRE)
+
+ if(GKREGEX)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DUSE_GKREGEX")
++ add_definitions(-DUSE_GKREGEX)
+ endif(GKREGEX)
+
+ if(GKRAND)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DUSE_GKRAND")
++ add_definitions(-DUSE_GKRAND)
+ endif(GKRAND)
+
+
+ # Check for features.
+ check_include_file(execinfo.h HAVE_EXECINFO_H)
+ if(HAVE_EXECINFO_H)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_EXECINFO_H")
++ add_definitions(-DHAVE_EXECINFO_H)
+ endif(HAVE_EXECINFO_H)
+
+ check_function_exists(getline HAVE_GETLINE)
+ if(HAVE_GETLINE)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_GETLINE")
++ add_definitions(-DHAVE_GETLINE)
+ endif(HAVE_GETLINE)
+
+
+ # Custom check for TLS.
+ if(MSVC)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__thread=__declspec(thread)")
++ add_definitions(-D__thread=__declspec\(thread\))
+ else()
+ # This if checks if that value is cached or not.
+ if("${HAVE_THREADLOCALSTORAGE}" MATCHES "^${HAVE_THREADLOCALSTORAGE}$")
+ try_compile(HAVE_THREADLOCALSTORAGE
+ ${CMAKE_BINARY_DIR}
+- ${GKLIB_PATH}/conf/check_thread_storage.c)
++ ${CMAKE_CURRENT_LIST_DIR}/conf/check_thread_storage.c)
+ if(HAVE_THREADLOCALSTORAGE)
+ message(STATUS "checking for thread-local storage - found")
+ else()
+@@ -117,13 +110,10 @@
+ endif()
+ endif()
+ if(NOT HAVE_THREADLOCALSTORAGE)
+- set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__thread=")
++ add_definitions(-D__thread=)
+ endif()
+ endif()
+
+-# Finally set the official C flags.
+-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GKlib_COPTIONS} ${GKlib_COPTS}")
+-
+ # Find GKlib sources.
+-file(GLOB GKlib_sources ${GKLIB_PATH}/*.c)
+-file(GLOB GKlib_includes ${GKLIB_PATH}/*.h)
++file(GLOB GKlib_sources ${CMAKE_CURRENT_LIST_DIR}/*.c)
++file(GLOB GKlib_includes ${CMAKE_CURRENT_LIST_DIR}/*.h)
+diff --git a/Makefile b/Makefile
+--- a/Makefile
++++ b/Makefile
+@@ -6,7 +6,6 @@
+ gprof = not-set
+ openmp = not-set
+ prefix = not-set
+-gklib_path = not-set
+ shared = not-set
+ cc = not-set
+
+@@ -20,10 +19,6 @@
+
+ # Process configuration options.
+ CONFIG_FLAGS = -DCMAKE_VERBOSE_MAKEFILE=1
+-ifeq ($(gklib_path), not-set)
+- gklib_path = GKlib
+-endif
+-CONFIG_FLAGS += -DGKLIB_PATH=$(abspath $(gklib_path))
+ ifneq ($(gdb), not-set)
+ CONFIG_FLAGS += -DGDB=$(gdb)
+ endif
+@@ -46,7 +41,7 @@
+ CONFIG_FLAGS += -DCMAKE_INSTALL_PREFIX=$(prefix)
+ endif
+ ifneq ($(shared), not-set)
+- CONFIG_FLAGS += -DSHARED=1
++ CONFIG_FLAGS += -DBUILD_SHARED_LIBS=1
+ endif
+ ifneq ($(cc), not-set)
+ CONFIG_FLAGS += -DCMAKE_C_COMPILER=$(cc)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -1,3 +1 @@
+-if(METIS_INSTALL)
+- install(FILES metis.h DESTINATION include)
+-endif()
++install(FILES metis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/metis)
+diff --git a/libmetis/CMakeLists.txt b/libmetis/CMakeLists.txt
+--- a/libmetis/CMakeLists.txt
++++ b/libmetis/CMakeLists.txt
+@@ -3,14 +3,20 @@
+ # Find sources.
+ file(GLOB metis_sources *.c)
+ # Build libmetis.
+-add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
++add_library(metis ${GKlib_sources} ${metis_sources})
++if(OPENMP AND OPENMP_FOUND)
++ set_property(TARGET metis APPEND PROPERTY COMPILE_FLAGS ${OpenMP_C_FLAGS})
++ set_property(TARGET metis APPEND PROPERTY LINK_FLAGS ${OpenMP_C_FLAGS})
++endif()
+ if(UNIX)
+- target_link_libraries(metis m)
++ target_link_libraries(metis PRIVATE m)
+ endif()
+
+-if(METIS_INSTALL)
+- install(TARGETS metis
+- LIBRARY DESTINATION lib
+- RUNTIME DESTINATION lib
+- ARCHIVE DESTINATION lib)
+-endif()
++install(TARGETS metis
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
++
++configure_file(metis.pc.in metis.pc @ONLY)
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metis.pc
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+diff --git a/libmetis/metis.pc.in b/libmetis/metis.pc.in
+new file mode 100644
+--- /dev/null
++++ b/libmetis/metis.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
++includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
++
++Name: @PROJECT_NAME@
++Description: Software for partitioning unstructured graphs and meshes
++Version: @PROJECT_VERSION@
++URL: http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
++Libs: -L${libdir} -lmetis
++Libs.private: -lm
++Cflags: -I${includedir}/metis
+diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt
+--- a/programs/CMakeLists.txt
++++ b/programs/CMakeLists.txt
+@@ -1,6 +1,5 @@
+ # These programs use internal metis data structures.
+ include_directories(../libmetis)
+-link_directories(/home/karypis/local/lib)
+ # Build program.
+ add_executable(gpmetis gpmetis.c cmdline_gpmetis.c io.c stat.c)
+ add_executable(ndmetis ndmetis.c cmdline_ndmetis.c io.c smbfactor.c)
+@@ -13,10 +12,8 @@
+ # target_link_libraries(${prog} metis profiler)
+ endforeach(prog)
+
+-if(METIS_INSTALL)
+- install(TARGETS gpmetis ndmetis mpmetis m2gmetis graphchk cmpfillin
+- RUNTIME DESTINATION bin)
+-endif()
++install(TARGETS gpmetis ndmetis mpmetis m2gmetis graphchk cmpfillin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ # Try to find subversion revision.
+ set(SVNREV "")