Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[check,libsbml] Update, port fixes #34656

Merged
merged 9 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ports/check/linkage.patch
Original file line number Diff line number Diff line change
@@ -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
24 changes: 12 additions & 12 deletions ports/check/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 4 additions & 0 deletions ports/check/usage
Original file line number Diff line number Diff line change
@@ -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>)
2 changes: 1 addition & 1 deletion ports/check/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
133 changes: 133 additions & 0 deletions ports/libsbml/dependencies.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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,9 @@ endif()
option(WITH_BZIP2 "Enable the use of bzip2 compression." ${BZIP_INITIAL_VALUE})
set(USE_BZ2 OFF)
if(WITH_BZIP2)
- find_package(BZ2 REQUIRED)
+ if(NOT TARGET BZ2::BZ2)
+ endif()
+ find_package(BZip2 REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this find_package is supposed to be inside the if statement?

Suggested change
+ if(NOT TARGET BZ2::BZ2)
+ endif()
+ find_package(BZip2 REQUIRED)
+ if(NOT TARGET BZ2::BZ2)
+ find_package(BZip2 REQUIRED)
+ endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It is meant to be called without guard.

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 changes: 28 additions & 0 deletions ports/libsbml/dirent.diff
Original file line number Diff line number Diff line change
@@ -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
38 changes: 0 additions & 38 deletions ports/libsbml/fix-deps-libxml.patch

This file was deleted.

4 changes: 2 additions & 2 deletions ports/libsbml/libsbml-config.cmake
Original file line number Diff line number Diff line change
@@ -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()
12 changes: 12 additions & 0 deletions ports/libsbml/no-docs.diff
Original file line number Diff line number Diff line change
@@ -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})

###############################################################################
#
Loading
Loading