diff --git a/mingw-w64-igraph/0001-igraph-0.9.0-link-libm-only-when-needed.patch b/mingw-w64-igraph/0001-igraph-0.9.0-link-libm-only-when-needed.patch deleted file mode 100644 index 61046a92a4..0000000000 --- a/mingw-w64-igraph/0001-igraph-0.9.0-link-libm-only-when-needed.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/etc/cmake/dependencies.cmake 2021-03-16 09:36:45.888000200 +0100 -+++ b/etc/cmake/dependencies.cmake 2021-03-16 09:38:50.702227000 +0100 -@@ -4,6 +4,8 @@ - # for tests - include(FindThreads) - -+include(CheckSymbolExists) -+ - macro(find_dependencies) - # Declare the list of dependencies that _may_ be vendored and those that may not - set(VENDORABLE_DEPENDENCIES BLAS CXSparse GLPK LAPACK ARPACK GMP) -@@ -103,5 +105,22 @@ - set(HAVE_GMP ${GMP_FOUND}) - set(HAVE_LIBXML ${LIBXML2_FOUND}) - -- find_library(MATH_LIBRARY m) -+ if(NOT DEFINED CACHE{NEED_LINKING_AGAINST_LIBM}) -+ check_symbol_exists(sinh "math.h" SINH_FUNCTION_EXISTS) -+ if(NOT SINH_FUNCTION_EXISTS) -+ unset(SINH_FUNCTION_EXISTS CACHE) -+ list(APPEND CMAKE_REQUIRED_LIBRARIES m) -+ check_symbol_exists(sinh "math.h" SINH_FUNCTION_EXISTS) -+ if(SINH_FUNCTION_EXISTS) -+ set(NEED_LINKING_AGAINST_LIBM True CACHE BOOL "" FORCE) -+ else() -+ message(FATAL_ERROR "Failed making the sinh() function available") -+ endif() -+ endif() -+ endif() -+ -+ if(NEED_LINKING_AGAINST_LIBM) -+ find_library(MATH_LIBRARY m) -+ endif() -+ - endmacro() diff --git a/mingw-w64-igraph/PKGBUILD b/mingw-w64-igraph/PKGBUILD index 2549e2e180..39720f9a40 100644 --- a/mingw-w64-igraph/PKGBUILD +++ b/mingw-w64-igraph/PKGBUILD @@ -1,61 +1,101 @@ +#! /usr/bin/bash + _realname=igraph pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") -pkgver=0.9.0 +pkgver=0.9.3 pkgrel=1 pkgdesc="Library for the analysis of networks (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64') url="https://igraph.org" license=('GPL') -source=("https://github.com/igraph/igraph/releases/download/${pkgver}/igraph-${pkgver}.tar.gz" - '0001-igraph-0.9.0-link-libm-only-when-needed.patch') -sha256sums=('012e5d5a50420420588c33ec114c6b3000ccde544db3f25c282c1931c462ad7a' - 'c84862f28bf07b145eeb3c2ebe65e1a8c5efadb1513cb8f897934f9c95244bd2') +source=("https://github.com/igraph/igraph/releases/download/${pkgver}/igraph-${pkgver}.tar.gz") +sha256sums=('0cb185df3bdf16895c012e37c4a01b01e01a7b81f630df7602070765511eda87') depends=("${MINGW_PACKAGE_PREFIX}-libxml2" "${MINGW_PACKAGE_PREFIX}-zlib") -makedepends=("${MINGW_PACKAGE_PREFIX}-cmake") +makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-ninja") _srcdir=${_realname}-${pkgver} _builddir=build-${pkgver}-${MINGW_PACKAGE_PREFIX} +# Keep _libtypes in THIS order to ensure that header file 'igraph_export.h' +# works for both the static and the shared library after installation. +_libtypes='static shared' prepare() { cd ${_srcdir} - patch -p1 -b -i "${srcdir}/0001-igraph-0.9.0-link-libm-only-when-needed.patch" } build() { - mkdir -p ${_builddir} - pushd ${_builddir} - MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ - ${MINGW_PREFIX}/bin/cmake ../${_srcdir} \ - -G 'MSYS Makefiles' \ - -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DIGRAPH_GLPK_SUPPORT=1 \ - -DIGRAPH_GRAPHML_SUPPORT=1 \ - -DIGRAPH_VERIFY_FINALLY_STACK=1 \ - -DIGRAPH_USE_INTERNAL_ARPACK=1 \ - -DIGRAPH_USE_INTERNAL_BLAS=1 \ - -DIGRAPH_USE_INTERNAL_CXSPARSE=1 \ - -DIGRAPH_USE_INTERNAL_GLPK=1 \ - -DIGRAPH_USE_INTERNAL_GMP=1 \ - -DIGRAPH_USE_INTERNAL_LAPACK=1 + for libtype in ${_libtypes}; do + case $libtype in + (static) _BUILD_SHARED_LIBS=OFF;; + (shared) _BUILD_SHARED_LIBS=ON;; + (*) exit 1 + esac + mkdir -p ${_builddir}-${libtype} + pushd ${_builddir}-${libtype} + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake ../${_srcdir} \ + -G 'Ninja' \ + -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \ + -DBUILD_SHARED_LIBS=${_BUILD_SHARED_LIBS} \ + -DCMAKE_BUILD_TYPE=Release \ + -DIGRAPH_ENABLE_TLS=1 \ + -DIGRAPH_GLPK_SUPPORT=1 \ + -DIGRAPH_GRAPHML_SUPPORT=1 \ + -DIGRAPH_USE_INTERNAL_ARPACK=1 \ + -DIGRAPH_USE_INTERNAL_BLAS=1 \ + -DIGRAPH_USE_INTERNAL_CXSPARSE=1 \ + -DIGRAPH_USE_INTERNAL_GLPK=1 \ + -DIGRAPH_USE_INTERNAL_GMP=1 \ + -DIGRAPH_USE_INTERNAL_LAPACK=1 - make || make VERBOSE=1 - popd + cmake --build . || cmake --verbose --build . + popd + done } check() { - # igraph 0.9.0: all tests succeeded - pushd ${_builddir} - make build_tests - ${MINGW_PREFIX}/bin/ctest --output-on-failure - popd + # igraph 0.9.3: All tests succeeded. + for libtype in ${_libtypes}; do + ${MINGW_PREFIX}/bin/cmake --build ${_builddir}-${libtype} --target build_tests + ${MINGW_PREFIX}/bin/ctest --test-dir ${_builddir}-${libtype} --output-on-failure + done } package() { - make -C ${_builddir} DESTDIR="${pkgdir}" install + # Install the libtypes one over another (until the simultaneous build of + # shared and static libraries is implemented). :( + for libtype in ${_libtypes}; do + DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --build ${_builddir}-${libtype} --target install + done + + # Create versions of igraph.pc for static and shared linking, + # called igraph-static.pc and igraph-shared.pc, resp. + pushd "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig" + for libtype in ${_libtypes}; do + case $libtype in + (static) sed -n '/^Name:/ s|\(.*\)|\1 (static)|; + /^Libs:/ s|\(.*\)|\1 -static|; + /^Cflags:/ s|\(.*\)|\1 -DIGRAPH_STATIC=1|; + p;' igraph.pc > igraph-static.pc;; + (shared) sed -n '/^Name:/ s|\(.*\)|\1 (shared)|; + /^Libs:/ s|\(.*\)|\1.dll|; + p;' igraph.pc > igraph-shared.pc;; + esac + done + # Keep the original pc file for knowledgeable users. + #rm igraph.pc + popd + + # Remove cmake files to avoid confusion when both shared and + # static library are installed. + pushd "${pkgdir}${MINGW_PREFIX}/lib" + rm -fr 'cmake' + popd + install -D -m644 ${_srcdir}/COPYING "${pkgdir}"/${MSYSTEM_PREFIX}/share/licenses/${_realname}/COPYING }