[libxml2] Update to 2.9.12 and use upstream CMakeLists.txt (#17945)

* vcpkg_fixup_pkgconfig for allgero5

* version stuff

* Update port

* version stuff

* add missing patch

* version stuff

* deactivate ICU linkage

* add missing 2

* fix include issue in dependend ports.

* fix include dirs in wrapper

* always install wrapper for corrections

* target also needs fixing.

* fix install of wrapper

* version stuff

* libxml define LIBXML_STATIC in the header in static builds

* libxslt build only one type of library to avoid link issues

* version stuff

* add cmake policy

* version stuff

* remove accidental cmake_minimum_required(VERSION)

* version stuff

* version stuff

* add feature tools to build tools

* version stuff

* fix version stuff

* add ws2_32 to the target which was missing.

* version stuff

* add liblzma and zlib to the target

* no need to adjust in config mode

* version stuff

* apply some of the CR suggestions

* version update

* remove icu dependency.

* version stuff

* setting uwp builds of libxml2 to fail. (icu supports:!uwp)

* add !uwp into supports due to getenv call

* version stuff

* baseline stuff

* Restore old version record for libxml2.

Co-authored-by: Robert Schumacher <ras0219@outlook.com>
This commit is contained in:
Alexander Neumann 2021-07-16 02:19:56 +02:00 committed by GitHub
parent ee66b89059
commit e43557e665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 320 additions and 342 deletions

View File

@ -1,183 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(libxml2 C)
include(GNUInstallDirs)
set(WITH_TRIO 0 CACHE BOOL "Add trio support")
set(WITH_THREADS 1 CACHE BOOL "Add multithread support")
set(WITH_THREAD_ALLOC 0 CACHE BOOL "Add per-thread memory")
set(WITH_TREE 1 CACHE BOOL "Add the DOM like tree manipulation APIs")
set(WITH_OUTPUT 1 CACHE BOOL "Add the serialization support")
set(WITH_PUSH 1 CACHE BOOL "Add the PUSH parser interfaces")
set(WITH_READER 1 CACHE BOOL "Add the xmlReader parsing interface")
set(WITH_PATTERN 1 CACHE BOOL "Add the xmlPattern selection interface")
set(WITH_WRITER 1 CACHE BOOL "Add the xmlWriter saving interface")
set(WITH_SAX1 1 CACHE BOOL "Add the older SAX1 interface")
set(WITH_VALID 1 CACHE BOOL "Add the DTD validation support")
set(WITH_HTML 1 CACHE BOOL "Add the HTML support")
set(WITH_LEGACY 1 CACHE BOOL "Add deprecated APIs for compatibility")
set(WITH_C14N 1 CACHE BOOL "Add the Canonicalization support")
set(WITH_CATALOG 1 CACHE BOOL "Add the Catalog support")
set(WITH_DOCB 1 CACHE BOOL "Add Docbook SGML support")
set(WITH_XPATH 1 CACHE BOOL "Add the XPATH support")
set(WITH_XPTR 1 CACHE BOOL "Add the XPointer support")
set(WITH_XINCLUDE 1 CACHE BOOL "Add the XInclude support")
set(WITH_ICONV 1 CACHE BOOL "Add ICONV support")
set(WITH_ICU 0 CACHE BOOL "Add ICU support")
set(WITH_ISO8859X 1 CACHE BOOL "Add ISO8859X support if no iconv")
set(WITH_DEBUG 1 CACHE BOOL "Add the memory debugging module")
set(WITH_MEM_DEBUG 0 CACHE BOOL "Add the memory debugging module")
set(WITH_RUN_DEBUG 0 CACHE BOOL "Add the runtime debugging module")
set(WITH_REGEXPS 1 CACHE BOOL "Add Regular Expressions support")
set(WITH_SCHEMAS 1 CACHE BOOL "Add Relax-NG and Schemas support")
set(WITH_SCHEMATRON 1 CACHE BOOL "Add Schematron support")
set(WITH_MODULES 1 CACHE BOOL "Add the dynamic modules support")
set(WITH_ZLIB 1 CACHE BOOL "Add zlib support")
set(WITH_LZMA 1 CACHE BOOL "Add liblzma support")
set(WITH_HTTP 1 CACHE BOOL "Add the HTTP support")
set(WITH_FTP 1 CACHE BOOL "Add the FTP support")
option(INSTALL_HEADERS "Install public header files" ON)
set(MODULE_EXTENSION ".so")
set(CMAKE_SHARED_LIBRARY_PREFIX)
set(CMAKE_STATIC_LIBRARY_PREFIX)
find_package(ZLIB REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(Iconv REQUIRED)
file(GLOB SOURCES *.c)
list(FILTER SOURCES EXCLUDE REGEX "/(run|test|trio)[^/]*$")
list(FILTER SOURCES EXCLUDE REGEX "xml(lint|catalog).c$")
list(FILTER SOURCES EXCLUDE REGEX "rngparser\.c$")
# Generate xmlexports with fixed definition of LIBXML_STATIC
file(READ include/libxml/xmlexports.h XMLEXPORTS_H)
if(BUILD_SHARED_LIBS)
string(REPLACE "!defined(LIBXML_STATIC)" "1" XMLEXPORTS_H "${XMLEXPORTS_H}")
else()
string(REPLACE "!defined(LIBXML_STATIC)" "0" XMLEXPORTS_H "${XMLEXPORTS_H}")
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h "${XMLEXPORTS_H}")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
configure_file(include/win32config.h config.h COPYONLY)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
configure_file("${PORT_DIR}/config.osx.h" config.h COPYONLY)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
configure_file("${PORT_DIR}/config.linux.h" config.h COPYONLY)
else()
message(FATAL_ERROR "No config.h checked in for the target platform. Please run ./configure for libxml2 and add the resulting config.h into this port.")
endif()
message(STATUS "Reading version info from configure.ac")
file(STRINGS "configure.ac"
_libxml_version_defines REGEX "LIBXML_(MAJOR|MINOR|MICRO)_VERSION=([0-9]+)$")
foreach(ver ${_libxml_version_defines})
if(ver MATCHES "LIBXML_(MAJOR|MINOR|MICRO)_VERSION=([0-9]+)$")
set(LIBXML_${CMAKE_MATCH_1}_VERSION "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(VERSION ${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}.${LIBXML_MICRO_VERSION})
math(EXPR LIBXML_VERSION_NUMBER
"${LIBXML_MAJOR_VERSION} * 10000 + ${LIBXML_MINOR_VERSION} * 100 + ${LIBXML_MICRO_VERSION}")
message(STATUS "LIBXML_MAJOR_VERSION: ${LIBXML_MAJOR_VERSION}")
message(STATUS "LIBXML_MINOR_VERSION: ${LIBXML_MINOR_VERSION}")
message(STATUS "LIBXML_MICRO_VERSION: ${LIBXML_MICRO_VERSION}")
message(STATUS "VERSION: ${VERSION}")
message(STATUS "LIBXML_VERSION_NUMBER: ${LIBXML_VERSION_NUMBER}")
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(WITH_CATALOG 0)
set(WITH_MODULES 0)
endif()
message(STATUS "Generating xmlversion.h")
configure_file(include/libxml/xmlversion.h.in include/libxml/xmlversion.h)
add_library(libxml2 ${SOURCES})
if(INSTALL_HEADERS)
file(GLOB PUBLIC_HEADERS include/libxml/*.h ${CMAKE_CURRENT_BINARY_DIR}/include/libxml/xmlversion.h)
list(FILTER PUBLIC_HEADERS EXCLUDE REGEX "xmlexports\\.h$")
list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h)
set_target_properties(libxml2 PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")
endif()
target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include include ${LIBLZMA_INCLUDE_DIRS})
get_property(LIBRARIES TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES)
if(LIBRARIES)
set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "")
foreach(LIBRARY ${LIBRARIES})
# Since `libc.so` has no SONAME, CMake maps e.g. `/usr/lib/x86_64-linux-gnu/libc.so` to `-llibc`.
# This is not found: it should be mapped to `-lc`.
if(LIBRARY MATCHES "/libc\\.so$")
set_property(TARGET Iconv::Iconv APPEND PROPERTY INTERFACE_LINK_LIBRARIES "c")
else()
set_property(TARGET Iconv::Iconv APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${LIBRARY}")
endif()
endforeach()
endif()
target_link_libraries(libxml2 PRIVATE
Iconv::Iconv
ZLIB::ZLIB
${LIBLZMA_LIBRARIES}
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
target_include_directories(libxml2 PRIVATE win32/vc10)
target_link_libraries(libxml2 PRIVATE
wsock32.lib
ws2_32.lib
)
target_compile_definitions(libxml2 PRIVATE
-DHAVE_WIN32_THREADS
_WINSOCK_DEPRECATED_NO_WARNINGS
)
target_sources(libxml2 PRIVATE win32/libxml2.rc)
configure_file("${PORT_DIR}/rcVersion.h.in" include/rcVersion.h @ONLY)
endif()
target_compile_definitions(libxml2 PRIVATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_REENTRANT
-DNOLIBTOOL
-DHAVE_ZLIB_H
-DHAVE_LZMA_H
)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(libxml2 PRIVATE -DLIBXML_STATIC)
endif()
set(TARGET_INSTALL_OPTIONS)
if(INSTALL_HEADERS)
set(TARGET_INSTALL_OPTIONS PUBLIC_HEADER DESTINATION include/libxml)
endif()
install(TARGETS libxml2
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
${TARGET_INSTALL_OPTIONS}
)
# pkgconfig
if(NOT Iconv_IS_BUILT_IN)
set(ICONV_LIBS "-liconv")
endif()
if(UNIX)
set(M_LIBS "-lm")
set(THREAD_LIBS "-pthread")
endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
set(XML_INCLUDEDIR "-I\"\${includedir}\"")
configure_file(libxml-2.0.pc.in libxml-2.0.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/libxml-2.0.pc DESTINATION lib/pkgconfig)

View File

@ -1,56 +0,0 @@
#define GETHOSTBYNAME_ARG_CAST /**/
#define HAVE_ANSIDECL_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_ARPA_NAMESER_H 1
#define HAVE_CTYPE_H 1
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
#define HAVE_DLOPEN /**/
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FLOAT_H 1
#define HAVE_FTIME 1
#define HAVE_GETADDRINFO /**/
#define HAVE_GETTIMEOFDAY 1
#define HAVE_INTTYPES_H 1
#define HAVE_ISASCII 1
#define HAVE_LIMITS_H 1
#define HAVE_LOCALTIME 1
#define HAVE_LZMA_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MATH_H 1
#define HAVE_MMAP 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_POLL_H 1
#define HAVE_PTHREAD_H /**/
#define HAVE_PUTENV 1
#define HAVE_RAND 1
#define HAVE_RAND_R 1
#define HAVE_RESOLV_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_SRAND 1
#define HAVE_STAT 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRFTIME 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TIME 1
#define HAVE_TIME_H 1
#define HAVE_UNISTD_H 1
#define HAVE_VA_COPY 1
#define HAVE_ZLIB_H 1
#define ICONV_CONST
#define SEND_ARG2_CAST /**/
#define SUPPORT_IP6 /**/
#define VA_LIST_IS_ARRAY 1
#define XML_SOCKLEN_T socklen_t

View File

@ -1,54 +0,0 @@
#define GETHOSTBYNAME_ARG_CAST /**/
#define HAVE_ARPA_INET_H 1
#define HAVE_ARPA_NAMESER_H 1
#define HAVE_CTYPE_H 1
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
#define HAVE_DLOPEN /**/
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FLOAT_H 1
#define HAVE_FTIME 1
#define HAVE_GETADDRINFO /**/
#define HAVE_GETTIMEOFDAY 1
#define HAVE_INTTYPES_H 1
#define HAVE_ISASCII 1
#define HAVE_LIMITS_H 1
#define HAVE_LOCALTIME 1
#define HAVE_LZMA_H 1
#define HAVE_MATH_H 1
#define HAVE_MMAP 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_POLL_H 1
#define HAVE_PTHREAD_H /**/
#define HAVE_PUTENV 1
#define HAVE_RAND 1
#define HAVE_RAND_R 1
#define HAVE_RESOLV_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_SRAND 1
#define HAVE_STAT 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRFTIME 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TIME 1
#define HAVE_TIME_H 1
#define HAVE_UNISTD_H 1
#define HAVE_VA_COPY 1
#define HAVE_ZLIB_H 1
#define ICONV_CONST
#define SEND_ARG2_CAST /**/
#define SUPPORT_IP6 /**/
#define VA_LIST_IS_ARRAY 1
#define XML_SOCKLEN_T socklen_t

View File

@ -0,0 +1,119 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a437717ba..0a11039d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
-project(libxml2 VERSION 2.9.10 LANGUAGES C)
+project(libxml2 VERSION 2.9.12 LANGUAGES C)
include(CheckCSourceCompiles)
include(CheckFunctionExists)
@@ -465,15 +465,15 @@ endif()
if(LIBXML2_WITH_ICU)
target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc)
if(WIN32)
- set(ICU_LIBS "-licudt -licuin -licuuc")
+ set(ICU_LIBS "icu-i18n")
else()
- set(ICU_LIBS "-licudata -licui18n -licuuc")
+ set(ICU_LIBS "icu-i18n")
endif()
endif()
if(LIBXML2_WITH_LZMA)
target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA)
- set(LZMA_LIBS "-llzma")
+ set(LZMA_LIBS "liblzma")
endif()
if(LIBXML2_WITH_THREADS)
@@ -483,7 +483,7 @@ endif()
if(LIBXML2_WITH_ZLIB)
target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
- set(Z_LIBS "-lz")
+ set(Z_LIBS "zlib")
endif()
set_target_properties(
@@ -495,24 +495,9 @@ set_target_properties(
PREFIX lib
VERSION ${PROJECT_VERSION}
)
-
+set(XML_LIB_NAME xml2)
if(MSVC)
- if(BUILD_SHARED_LIBS)
- set_target_properties(
- LibXml2
- PROPERTIES
- DEBUG_POSTFIX d
- )
- else()
- set_target_properties(
- LibXml2
- PROPERTIES
- DEBUG_POSTFIX sd
- MINSIZEREL_POSTFIX s
- RELEASE_POSTFIX s
- RELWITHDEBINFO_POSTFIX s
- )
- endif()
+ set(XML_LIB_NAME libxml2)
endif()
install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
@@ -659,30 +644,30 @@ install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2 COMPONEN
configure_package_config_file(
libxml2-config.cmake.cmake.in libxml2-config.cmake
- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
COMPONENT development
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
VERSION ${PROJECT_VERSION}
- COMPATIBILITY ExactVersion
+ COMPATIBILITY SameMinorVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
COMPONENT development
)
install(
EXPORT LibXml2
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
NAMESPACE LibXml2::
FILE libxml2-export.cmake
COMPONENT development
diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
index 2653a7c56..d1bff5bcc 100644
--- a/libxml-2.0.pc.in
+++ b/libxml-2.0.pc.in
@@ -7,7 +7,8 @@ modules=@WITH_MODULES@
Name: libXML
Version: @VERSION@
Description: libXML library version2.
-Requires:
-Libs: -L${libdir} -lxml2
-Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
+Requires:
+Requires.private: @ICU_LIBS@ @Z_LIBS@ @LZMA_LIBS@
+Libs: -L${libdir} -l@XML_LIB_NAME@
+Libs.private: @THREAD_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@

View File

@ -1,13 +1,14 @@
vcpkg_from_github(
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/libxml2
REF v2.9.10
SHA512 de8d7c6c90f9d0441747deec320c4887faee1fd8aff9289115caf7ce51ab73b6e2c4628ae7eaad4a33a64561d23a92fd5e8a5afa7fa74183bdcd9a7b06bc67f1
REF b48e77cf4f6fa0792c5f4b639707a2b0675e461b
SHA512 2d20867961b8d8a0cb0411192146882b976c1276d2e8ecd9a7ee3f1eb287f64e59282736f58c641b66abf63ba45c9421f27e13ec09a0b10814cd56987b18cb5b
HEAD_REF master
PATCHES
fix_cmakelist.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
if (VCPKG_TARGET_IS_UWP)
message(WARNING "Feature network couldn't be enabled on UWP, disable http and ftp automatically.")
set(ENABLE_NETWORK 0)
@ -15,36 +16,79 @@ else()
set(ENABLE_NETWORK 1)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"tools" LIBXML2_WITH_PROGRAMS
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DPORT_DIR=${CMAKE_CURRENT_LIST_DIR}
-DWITH_HTTP=${ENABLE_NETWORK}
-DWITH_FTP=${ENABLE_NETWORK}
OPTIONS_DEBUG
-DINSTALL_HEADERS=OFF
${FEATURE_OPTIONS}
-DLIBXML2_WITH_TESTS=OFF
-DLIBXML2_WITH_HTTP=${ENABLE_NETWORK}
-DLIBXML2_WITH_FTP=${ENABLE_NETWORK}
-DLIBXML2_WITH_HTML=ON
-DLIBXML2_WITH_C14N=ON
-DLIBXML2_WITH_CATALOG=ON
-DLIBXML2_WITH_DEBUG=ON
-DLIBXML2_WITH_DOCB=ON
-DLIBXML2_WITH_ICONV=ON
-DLIBXML2_WITH_ISO8859X=ON
-DLIBXML2_WITH_ZLIB=ON
-DLIBXML2_WITH_ICU=OFF # Culprit of linkage issues? Solving this is probably another PR
-DLIBXML2_WITH_LZMA=ON
-DLIBXML2_WITH_LEGACY=ON
-DLIBXML2_WITH_MEM_DEBUG=OFF
-DLIBXML2_WITH_MODULES=ON
-DLIBXML2_WITH_OUTPUT=ON
-DLIBXML2_WITH_PATTERN=ON
-DLIBXML2_WITH_PUSH=ON
-DLIBXML2_WITH_PYTHON=OFF
-DLIBXML2_WITH_READER=ON
-DLIBXML2_WITH_REGEXPS=ON
-DLIBXML2_WITH_RUN_DEBUG=OFF
-DLIBXML2_WITH_SAX1=ON
-DLIBXML2_WITH_SCHEMAS=ON
-DLIBXML2_WITH_SCHEMATRON=ON
-DLIBXML2_WITH_THREADS=ON
-DLIBXML2_WITH_THREAD_ALLOC=OFF
-DLIBXML2_WITH_TREE=ON
-DLIBXML2_WITH_VALID=ON
-DLIBXML2_WITH_WRITER=ON
-DLIBXML2_WITH_XINCLUDE=ON
-DLIBXML2_WITH_XPATH=ON
-DLIBXML2_WITH_XPTR=ON
)
vcpkg_install_cmake()
if(VCPKG_TARGET_IS_WINDOWS)
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libxml-2.0.pc" "-lxml2" "-llibxml2")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxml-2.0.pc" "-lxml2" "-llibxml2")
endif ()
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libxml-2.0.pc" "\nRequires:\n" "\nRequires.private: liblzma zlib\n")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxml-2.0.pc" "\nRequires:\n" "\nRequires.private: liblzma zlib\n")
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libxml2)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES xmllint xmlcatalog AUTO_CLEAN)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(_file "${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h")
file(READ "${_file}" _contents)
string(REPLACE "#ifdef LIBXML_STATIC" "#undef LIBXML_STATIC\n#define LIBXML_STATIC\n#ifdef LIBXML_STATIC" _contents "${_contents}")
file(WRITE "${_file}" "${_contents}")
endif()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/Copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(COPY "${CURRENT_PACKAGES_DIR}/include/libxml2/" DESTINATION "${CURRENT_PACKAGES_DIR}/include") # TODO: Fix usage in all dependent ports hardcoding the wrong include path.
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/Copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
#Cleanup
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/xml2Conf.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/xml2Conf.sh")

View File

@ -1,4 +0,0 @@
#define LIBXML_MAJOR_VERSION @LIBXML_MAJOR_VERSION@
#define LIBXML_MINOR_VERSION @LIBXML_MINOR_VERSION@
#define LIBXML_MICRO_VERSION @LIBXML_MICRO_VERSION@
#define LIBXML_DOTTED_VERSION "@VERSION@"

View File

@ -1,5 +1,4 @@
The package libxml2 is compatible with built-in CMake targets:
find_package(LibXml2 REQUIRED)
target_include_directories(main PRIVATE ${LIBXML2_INCLUDE_DIR})
target_link_libraries(main PRIVATE ${LIBXML2_LIBRARIES})
find_package(LibXml2 CONFIG REQUIRED)
target_link_libraries(main PRIVATE LibXml2::LibXml2)

View File

@ -1,27 +1,52 @@
_find_package(${ARGS})
if(LibXml2_FOUND)
list(APPEND LIBXML2_INCLUDE_DIRS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
list(APPEND LIBXML2_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") # This is wrong but downstream doesn't correctly use _DIR vs _DIRS variables
if(TARGET LibXml2::LibXml2)
target_include_directories(LibXml2::LibXml2 INTERFACE "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
endif()
endif()
if(LibXml2_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT ${ARGV0}_CONFIG)
find_package(LibLZMA)
find_package(ZLIB)
include(SelectLibraryConfigurations)
find_library(LIBXML2_LIBRARY_RELEASE NAMES xml2 libxml2 xml2s libxml2s xml2d libxml2d xml2sd libxml2sd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
find_library(LIBXML2_LIBRARY_DEBUG NAMES xml2 libxml2 xml2s libxml2s NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
find_library(ICONV_LIBRARY_DEBUG NAMES iconvd libiconvd iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
find_library(ICONV_LIBRARY_RELEASE NAMES iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
find_library(ICONV_LIBRARY_RELEASE NAMES iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib)
find_library(CHARSET_LIBRARY_DEBUG NAMES charsetd libcharsetd charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
find_library(CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
find_library(CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib)
unset(LIBXML2_LIBRARIES)
unset(LIBXML2_LIBRARY CACHE)
select_library_configurations(LIBXML2)
select_library_configurations(ICONV)
select_library_configurations(CHARSET)
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES})
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "liblzma::liblzma" "ZLIB::ZLIB")
if(TARGET LibXml2::LibXml2 AND LIBXML2_LIBRARY_RELEASE)
set_target_properties(LibXml2::LibXml2 PROPERTIES IMPORTED_LOCATION_RELEASE "${LIBXML2_LIBRARY_RELEASE}")
endif()
if(TARGET LibXml2::LibXml2 AND LIBXML2_LIBRARY_DEBUG)
set_target_properties(LibXml2::LibXml2 PROPERTIES IMPORTED_LOCATION_DEBUG "${LIBXML2_LIBRARY_DEBUG}")
endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0079 NEW)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBXML2_LIBRARIES m)
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "m")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND LIBXML2_LIBRARIES ws2_32)
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "ws2_32")
endif()
endif()
if(ICONV_LIBRARIES)
list(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES})
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE ${ICONV_LIBRARIES} )
target_link_libraries(LibXml2::LibXml2 INTERFACE ${ICONV_LIBRARIES})
endif()
endif()
if(CHARSET_LIBRARIES)
@ -30,7 +55,8 @@ if(LibXml2_FOUND)
target_link_libraries(LibXml2::LibXml2 INTERFACE ${CHARSET_LIBRARIES})
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND LIBXML2_LIBRARIES ws2_32)
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES})
endif()
cmake_policy(POP)
endif()

View File

@ -1,12 +1,17 @@
{
"name": "libxml2",
"version-semver": "2.9.10",
"port-version": 8,
"version-semver": "2.9.12",
"description": "Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform).",
"homepage": "https://xmlsoft.org/",
"supports": "!uwp",
"dependencies": [
"libiconv",
"liblzma",
"zlib"
]
],
"features": {
"tools": {
"description": "Build tools"
}
}
}

View File

@ -1,6 +0,0 @@
Source: libxslt
Version: 1.1.34
Homepage: https://github.com/GNOME/libxslt
Description: Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT
Build-Depends: libxml2, liblzma
Supports: !uwp

View File

@ -0,0 +1,56 @@
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index f803a747c..f43a54f51 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -163,7 +163,11 @@ _VC_MANIFEST_EMBED_EXE=
_VC_MANIFEST_EMBED_DLL=
!endif
-all : libxslt libxslta libexslt libexslta utils
+!if "$(STATIC)" == "1"
+all : libxslta libexslta utils
+!else
+all : libxslt libexslt utils
+!endif
libxslt : $(BINDIR)\$(XSLT_SO)
@@ -196,12 +200,15 @@ install-libs : all
if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)
copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME)
copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME)
+!if "$(STATIC)" != "1"
copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX)
- copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX)
copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX)
copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX)
- copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX)
copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX)
+!else
+ copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX)
+ copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX)
+!endif
install : install-libs
copy $(BINDIR)\*.exe $(BINPREFIX)
@@ -313,7 +320,6 @@ $(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) lib
$(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta
$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A)
-
# Creates the utils intermediate directory.
$(UTILS_INTDIR) :
if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)
@@ -336,7 +342,11 @@ APPLIBS = $(LIBS) libxml2.lib
!endif
# Builds xsltproc and friends. Uses the implicit rule for commands.
-$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta
+!if "$(STATIC)" == "1"
+$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslta libexslta
+!else
+$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libexslt
+!endif
# plugins only work with non-static builds currently.
!if "$(STATIC)" == "0"

View File

@ -16,6 +16,7 @@ vcpkg_from_github(
0001-Fix-makefile.patch
0002-Fix-lzma.patch
0003-Fix-configure.patch
only_build_one_lib_type.patch
)
if (VCPKG_TARGET_IS_WINDOWS)
@ -26,14 +27,23 @@ if (VCPKG_TARGET_IS_WINDOWS)
endif()
set(CONFIGURE_COMMAND_TEMPLATE
cruntime=@CRUNTIME@
static=@BUILDSTATIC@
debug=@DEBUGMODE@
prefix=@INSTALL_DIR@
include=@INCLUDE_DIR@
lib=@LIB_DIR@
bindir=$(PREFIX)\\bin
sodir=$(PREFIX)\\bin
zlib=yes
lzma=yes
)
# Debug params
# Common
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(BUILDSTATIC yes)
else()
set(BUILDSTATIC no)
endif()
# Release params
if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CRUNTIME /MD)
else()
@ -47,7 +57,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
file(TO_NATIVE_PATH "${INCLUDE_DIR}" INCLUDE_DIR)
file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR)
string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND_REL)
# Release params
# Debug params
if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CRUNTIME /MDd)
else()

12
ports/libxslt/vcpkg.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "libxslt",
"version": "1.1.34",
"port-version": 1,
"description": "Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT",
"homepage": "https://github.com/GNOME/libxslt",
"supports": "!uwp",
"dependencies": [
"liblzma",
"libxml2"
]
}

View File

@ -3721,8 +3721,8 @@
"port-version": 0
},
"libxml2": {
"baseline": "2.9.10",
"port-version": 8
"baseline": "2.9.12",
"port-version": 0
},
"libxmlmm": {
"baseline": "0.6.0",
@ -3738,7 +3738,7 @@
},
"libxslt": {
"baseline": "1.1.34",
"port-version": 0
"port-version": 1
},
"libyaml": {
"baseline": "0.2.5",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c6fe9f85f9c0a1f9349de95425b786cf6462314c",
"version-semver": "2.9.12",
"port-version": 0
},
{
"git-tree": "b0cf9aec6fb5cd87ae6358e9015e92e9d113c1f1",
"version-semver": "2.9.10",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d5021817ac7038fcfc53721d55a17fbab42ceb59",
"version": "1.1.34",
"port-version": 1
},
{
"git-tree": "1893a874d7cc6d1bfd903ae9a341f9d1e6419b78",
"version-string": "1.1.34",