[check,libsbml] Update, port fixes (#34656)

* [libsbml] Update, port fixes

* [check] Follow VCPKG_LIBRARY_LINKAGE

* [check] Don't install checkmk

* [check] Burn-in dllimport

* [libsbml] Devendor dirent

* [libsbml] Burn-in library linkage

* Finish

* Fix typo

* [libsbml] Shorten patch
This commit is contained in:
Kai Pastor 2023-10-24 18:09:15 +02:00 committed by GitHub
parent e6a164736f
commit 4ff2d52566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 275 additions and 114 deletions

20
ports/check/linkage.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4a02dbe..3e147e4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -188,7 +188,14 @@ target_include_directories(checkShared
)
if(NOT THIS_IS_SUBPROJECT)
- install(TARGETS check checkShared
+ if(BUILD_SHARED_LIBS)
+ set(lib checkShared)
+ set_target_properties(check PROPERTIES EXCLUDE_FROM_ALL 1)
+ else()
+ set(lib check)
+ set_target_properties(checkShared PROPERTIES EXCLUDE_FROM_ALL 1)
+ endif()
+ install(TARGETS ${lib}
EXPORT check-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link

View File

@ -4,33 +4,33 @@ vcpkg_from_github(
REF 11970a7e112dfe243a2e68773f014687df2900e8 # 0.15.2
SHA512 210c9617fa1c1ce16bef983b0e6cb587b1774c3f7ce27a53ca7799642dc7a14be8de567d69dc0e57845684c6f7991d772c73654f63c8755afda3b37a35c7156e
HEAD_REF master
PATCHES fix-lib-path.patch
PATCHES
fix-lib-path.patch
linkage.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCHECK_ENABLE_TESTS=OFF
-DBUILD_TESTING=OFF
-DCHECK_ENABLE_GCOV=OFF
-DENABLE_MEMORY_LEAKING_TESTS=OFF
-DCHECK_ENABLE_TESTS=OFF
-DCHECK_ENABLE_TIMEOUT_TESTS=OFF
-DENABLE_MEMORY_LEAKING_TESTS=OFF
-DINSTALL_CHECKMK=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/check)
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/check)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/check.h" "#define CK_DLL_EXP" "#define CK_DLL_EXP __declspec(dllimport)")
endif()
# cleanup
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/man")
vcpkg_fixup_pkgconfig()
file(INSTALL "${SOURCE_PATH}/COPYING.LESSER" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.LESSER")

4
ports/check/usage Normal file
View File

@ -0,0 +1,4 @@
check provides CMake targets:
find_package(check CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:Check::check>,Check::check,Check::checkShared>)

View File

@ -1,7 +1,7 @@
{
"name": "check",
"version": "0.15.2",
"port-version": 4,
"port-version": 5,
"description": "A unit testing framework for C",
"homepage": "https://github.com/libcheck/check",
"license": "LGPL-2.1-only",

View File

@ -0,0 +1,131 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8af3a4..3926b68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -421,8 +421,9 @@ set(LIBSBML_XML_LIBRARY_LIBS)
if(WITH_EXPAT)
if(NOT TARGET EXPAT::EXPAT)
- find_package(EXPAT REQUIRED)
endif()
+ find_package(EXPAT NAMES expat REQUIRED)
+ set(EXPAT_LIBRARY expat::expat)
add_definitions( -DUSE_EXPAT )
list(APPEND SWIG_EXTRA_ARGS -DUSE_EXPAT)
@@ -443,7 +444,8 @@ endif(WITH_EXPAT)
set(USE_LIBXML OFF)
if(WITH_LIBXML)
- find_package(LIBXML REQUIRED)
+ find_package(LIBXML NAMES LibXml2 REQUIRED)
+ set(LIBXML_LIBRARY LibXml2::LibXml2)
add_definitions( -DUSE_LIBXML )
list(APPEND SWIG_EXTRA_ARGS -DUSE_LIBXML)
@@ -495,7 +497,7 @@ endif()
option(WITH_BZIP2 "Enable the use of bzip2 compression." ${BZIP_INITIAL_VALUE})
set(USE_BZ2 OFF)
if(WITH_BZIP2)
- find_package(BZ2 REQUIRED)
+ find_package(BZip2 REQUIRED)
set(USE_BZ2 ON)
add_definitions( -DUSE_BZ2 )
list(APPEND SWIG_EXTRA_ARGS -DUSE_BZ2)
@@ -521,6 +525,9 @@ Separate multiple directories using semicolons." )
# Locate zlib
#
+if(WITH_ZLIB)
+ find_package(ZLIB REQUIRED)
+endif()
set(ZLIB_INITIAL_VALUE)
if (NOT LIBZ_LIBRARY)
find_library(LIBZ_LIBRARY
@@ -614,7 +621,6 @@ valid. It should contain the file zlib.h, but it does not.")
endif(WITH_ZLIB)
# install find scripts only for used dependencies
-install(FILES ${LIBSBML_FIND_MODULES} DESTINATION share/cmake/Modules)
###############################################################################
#
@@ -671,7 +677,12 @@ if(WITH_CHECK)
enable_testing()
- find_package(CHECK REQUIRED)
+ find_package(CHECK NAMES check REQUIRED)
+ if(BUILD_SHARED_LIBS)
+ add_library(CHECK::CHECK ALIAS Check::checkShared)
+ else()
+ add_library(CHECK::CHECK ALIAS Check::check)
+ endif()
if (UNIX)
# setup valgrind
@@ -1005,17 +1016,18 @@ install(FILES ${DOCUMENTATION_FILES} DESTINATION ${MISC_PREFIX})
#
set (PRIVATE_LIBS "-lstdc++ -lm")
+set (PRIVATE_REQUIRES "")
if (WITH_ZLIB)
-set (PRIVATE_LIBS "${LIBZ_LIBRARY} ${PRIVATE_LIBS}")
+ string(APPEND PRIVATE_REQUIRES " zlib")
endif()
if (WITH_BZIP2)
-set (PRIVATE_LIBS "${LIBBZ_LIBRARY} ${PRIVATE_LIBS}")
+ string(APPEND PRIVATE_REQUIRES " bzip2")
endif()
if (WITH_LIBXML)
-set (PRIVATE_LIBS "${LIBXML_LIBRARY} ${PRIVATE_LIBS}")
+ string(APPEND PRIVATE_REQUIRES " libxml-2.0")
endif()
if (WITH_EXPAT)
-set (PRIVATE_LIBS "${LIBEXPAT_LIBRARY} ${PRIVATE_LIBS}")
+ string(APPEND PRIVATE_REQUIRES " expat")
endif()
if (WITH_XERCES)
set (PRIVATE_LIBS "${XERCES_LIBRARY} ${PRIVATE_LIBS}")
@@ -1037,9 +1049,7 @@ if (WITH_XERCES)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Conflicts: xerces-c = 2.6.0\n")
endif()
-if (WITH_LIBXML)
-file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Requires.private: libxml-2.0 >= 2.6.22\n")
-endif()
+file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Requires.private: ${PRIVATE_REQUIRES}\n")
if (UNIX OR MINGW)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79301a6..0957d29 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -311,7 +311,7 @@ if(WITH_BZIP2)
sbml/compress/bzfstream.h
sbml/compress/bzfstream.cpp
)
- set(LIBSBML_LIBS ${LIBSBML_LIBS} BZ2::BZ2)
+ set(LIBSBML_LIBS ${LIBSBML_LIBS} BZip2::BZip2)
endif()
@@ -405,7 +405,7 @@ if(WITH_EXPAT)
sbml/xml/ExpatHandler.h
sbml/xml/ExpatParser.h
)
- set(LIBSBML_LIBS ${LIBSBML_LIBS} EXPAT::EXPAT)
+ set(LIBSBML_LIBS ${LIBSBML_LIBS} expat::expat)
endif(WITH_EXPAT)
@@ -423,7 +423,7 @@ if(WITH_LIBXML)
sbml/xml/LibXMLParser.h
sbml/xml/LibXMLTranscode.h
)
- set(LIBSBML_LIBS ${LIBSBML_LIBS} LIBXML::LIBXML)
+ set(LIBSBML_LIBS ${LIBSBML_LIBS} LibXml2::LibXml2)
endif(WITH_LIBXML)

28
ports/libsbml/dirent.diff Normal file
View File

@ -0,0 +1,28 @@
diff --git a/src/sbml/validator/test/tps/dirent.c b/src/sbml/validator/test/tps/dirent.c
index beafc5e..48a60ca 100644
--- a/src/sbml/validator/test/tps/dirent.c
+++ b/src/sbml/validator/test/tps/dirent.c
@@ -1,3 +1,4 @@
+#if 0
/* /////////////////////////////////////////////////////////////////////////////
* File: dirent.c
*
@@ -239,3 +240,4 @@ struct dirent *readdir(DIR *dir)
}
/* ////////////////////////////////////////////////////////////////////////// */
+#endif
diff --git a/src/sbml/validator/test/tps/dirent.h b/src/sbml/validator/test/tps/dirent.h
index 4703aa2..8e4c29c 100644
--- a/src/sbml/validator/test/tps/dirent.h
+++ b/src/sbml/validator/test/tps/dirent.h
@@ -46,6 +46,9 @@
#ifndef SYNSOFT_UNIXEM_INCL_H_DIRENT
#define SYNSOFT_UNIXEM_INCL_H_DIRENT
+#include <dirent.h>
+#endif
+#if 0
#ifndef _SYNSOFT_DOCUMENTATION_SKIP_SECTION
# define SYNSOFT_UNIXEM_VER_H_DIRENT_MAJOR 2

View File

@ -1,38 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42b3bd6..34e9a4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -442,17 +442,15 @@ endif(WITH_EXPAT)
set(USE_LIBXML OFF)
if(WITH_LIBXML)
- find_package(LIBXML REQUIRED)
+ find_package(LibXml2 REQUIRED)
add_definitions( -DUSE_LIBXML )
list(APPEND SWIG_EXTRA_ARGS -DUSE_LIBXML)
set(USE_LIBXML ON)
- set(LIBSBML_XML_LIBRARY "libxml2")
- set(LIBSBML_XML_LIBRARY_INCLUDE ${LIBXML_INCLUDE_DIR})
- set(LIBSBML_XML_LIBRARY_LIBS ${LIBXML_LIBRARY})
+ set(LIBSBML_XML_LIBRARY "LibXml2::LibXml2")
+ set(LIBSBML_XML_LIBRARY_LIBS ${LIBSBML_XML_LIBRARY})
- list(APPEND LIBSBML_FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/FindLIBXML.cmake")
endif(WITH_LIBXML)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79301a6..985f6cb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -423,7 +423,7 @@ if(WITH_LIBXML)
sbml/xml/LibXMLParser.h
sbml/xml/LibXMLTranscode.h
)
- set(LIBSBML_LIBS ${LIBSBML_LIBS} LIBXML::LIBXML)
+ set(LIBSBML_LIBS ${LIBSBML_LIBS} LibXml2::LibXml2)
endif(WITH_LIBXML)

View File

@ -1,6 +1,6 @@
include(CMakeFindDependencyMacro)
find_dependency(libsbml-static CONFIG)
find_dependency(@name@ CONFIG)
if(NOT TARGET libsbml)
add_library(libsbml INTERFACE IMPORTED)
target_link_libraries(libsbml INTERFACE libsbml-static)
target_link_libraries(libsbml INTERFACE $<TARGET_NAME:@name@>)
endif()

View File

@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ad678a..f856774 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1012,7 +1012,6 @@ set(DOCUMENTATION_FILES
VERSION.txt
)
-install(FILES ${DOCUMENTATION_FILES} DESTINATION ${MISC_PREFIX})
###############################################################################
#

View File

@ -2,16 +2,24 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO sbmlteam/libsbml
REF "v${VERSION}"
SHA512 c40f164ebd05a36f140ce2684dedb4bbccc51a2732383d3935fca1258738a9b9ba5bc1be2061f3b113b213e5cbb7fe22e9dca43ff78d91964c79cad093e55466
SHA512 2770c1d3295e22ed8fb8dfa2480efa160fc61fbeeca3a9e214e210acb3fd6531a5cfb22eeb72c5334158bf8ba21c27015d0910487a7ef060f594a708f197676c
HEAD_REF development
PATCHES
fix-deps-libxml.patch
dependencies.diff
dirent.diff
no-docs.diff
test-shared.diff
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_RUNTIME)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATIC_LIBRARY)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" DYNAMIC_LIBRARY)
if("expat" IN_LIST FEATURES AND "libxml2" IN_LIST FEATURES)
message("Feature expat conflicts with feature libxml2. Selecting libxml2.")
list(REMOVE_ITEM FEATURES "expat")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
comp ENABLE_COMP
@ -22,76 +30,46 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
qual ENABLE_QUAL
render ENABLE_RENDER
bzip2 WITH_BZIP2
expat WITH_EXPAT
libxml2 WITH_LIBXML
zlib WITH_ZLIB
test WITH_CHECK
namespace WITH_CPP_NAMESPACE
)
# Handle conflict features
set(WITH_EXPAT OFF)
if ("expat" IN_LIST FEATURES)
set(WITH_EXPAT ON)
endif()
set(WITH_LIBXML OFF)
if ("libxml2" IN_LIST FEATURES)
set(WITH_LIBXML ON)
endif()
if (WITH_EXPAT AND WITH_LIBXML)
message("Feature expat conflict with feature libxml2, currently using libxml2...")
set(WITH_EXPAT OFF)
endif()
if ("test" IN_LIST FEATURES AND WIN32)
message(FATAL_ERROR "Feature test only support UNIX.")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
-DWITH_EXPAT=${WITH_EXPAT}
-DWITH_LIBXML=${WITH_LIBXML}
OPTIONS
${FEATURE_OPTIONS}
-DENABLE_L3V2EXTENDEDMATH:BOOL=ON
-DWITH_STATIC_RUNTIME=${STATIC_RUNTIME}
-DLIBSBML_SKIP_SHARED_LIBRARY=${STATIC_LIBRARY}
-DLIBSBML_SKIP_STATIC_LIBRARY=${DYNAMIC_LIBRARY}
MAYBE_UNUSED_VARIABLES
WITH_STATIC_RUNTIME
)
vcpkg_cmake_install()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake)
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME libsbml-static CONFIG_PATH lib/cmake)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/libsbml-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endif()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
foreach(name IN ITEMS libsbml libsbml-static sbml sbml-static)
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/${name}-config.cmake")
vcpkg_cmake_config_fixup(PACKAGE_NAME "${name}" CONFIG_PATH lib/cmake)
if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake")
configure_file("${CURRENT_PORT_DIR}/libsbml-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" @ONLY)
endif()
break()
endif()
endforeach()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sbml/common/extern.h" "defined LIBSBML_STATIC" "1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sbml/xml/XMLExtern.h" "defined(LIBLAX_STATIC)" "1")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(GLOB TXT_FILES "${CURRENT_PACKAGES_DIR}/debug/*.txt")
if (TXT_FILES)
file(REMOVE ${TXT_FILES})
endif()
file(GLOB TXT_FILES "${CURRENT_PACKAGES_DIR}/*.txt")
if (TXT_FILES)
file(REMOVE ${TXT_FILES})
endif()
if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/README.md")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/README.md")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/README.md")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.md")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
vcpkg_fixup_pkgconfig()

View File

@ -0,0 +1,14 @@
diff --git a/src/sbml/test/CMakeLists.txt b/src/sbml/test/CMakeLists.txt
index 7a408d7..462d58a 100644
--- a/src/sbml/test/CMakeLists.txt
+++ b/src/sbml/test/CMakeLists.txt
@@ -49,6 +49,9 @@ if (EXTRA_INCLUDE_DIRS)
include_directories(${EXTRA_INCLUDE_DIRS})
endif(EXTRA_INCLUDE_DIRS)
+if(NOT TARGET ${LIBSBML_LIBRARY}-static)
+ add_library(${LIBSBML_LIBRARY}-static ALIAS ${LIBSBML_LIBRARY})
+endif()
add_executable(test_sbml_sbml ${TEST_FILES})
target_link_libraries(test_sbml_sbml ${LIBSBML_LIBRARY}-static CHECK::CHECK)

View File

@ -1,7 +1,6 @@
{
"name": "libsbml",
"version": "5.20.0",
"port-version": 1,
"version": "5.20.2",
"description": "A library for reading / writing SBML files",
"homepage": "https://github.com/sbmlteam/libsbml",
"license": "LGPL-2.1",
@ -69,6 +68,7 @@
"dependencies": [
{
"name": "libsbml",
"default-features": false,
"features": [
"layout"
]
@ -77,8 +77,10 @@
},
"test": {
"description": "Unit testing of libSBMLs implementation",
"supports": "!windows | mingw | (windows & static)",
"dependencies": [
"check"
"check",
"dirent"
]
},
"zlib": {

View File

@ -1542,7 +1542,7 @@
},
"check": {
"baseline": "0.15.2",
"port-version": 4
"port-version": 5
},
"chipmunk": {
"baseline": "7.0.3",
@ -4665,8 +4665,8 @@
"port-version": 1
},
"libsbml": {
"baseline": "5.20.0",
"port-version": 1
"baseline": "5.20.2",
"port-version": 0
},
"libsbsms": {
"baseline": "2.3.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c993fcbc415d3c12c9161215529c1d36ba7e5f96",
"version": "0.15.2",
"port-version": 5
},
{
"git-tree": "d3b96c10d08746796f0e7540f9cb896b263cd4a9",
"version": "0.15.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5610c6abee862e6ef538a8c62fde2c6ff62325e0",
"version": "5.20.2",
"port-version": 0
},
{
"git-tree": "9d718a41ed85525971eb0cc46dbb31e91673c576",
"version": "5.20.0",