mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[libxml2] Update to 2.9.9 (#5193)
* [libxml2] Update to 2.9.9 Fix #5177 * [libxml2] Fix static build * [libxml2] Modernize * [libxml2] Use vcpkg_from_github * [libxml2] Get version info from configure.ac * [libxml2] Install xmlversion.h * [libxml2] Improve port file * [libxml2] Move version.h generation into CMakeLists.txt * [libxml2] Fix misspelled version header * [libxml2] Add UWP support
This commit is contained in:
parent
d433d21904
commit
68a2b4c766
@ -13,6 +13,7 @@ find_package(unofficial-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)
|
||||
@ -23,7 +24,7 @@ else()
|
||||
endif()
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h "${XMLEXPORTS_H}")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
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)
|
||||
@ -33,21 +34,86 @@ 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}")
|
||||
|
||||
set(WITH_TRIO 0)
|
||||
set(WITH_THREADS 1)
|
||||
set(WITH_THREAD_ALLOC 0)
|
||||
set(WITH_TREE 1)
|
||||
set(WITH_OUTPUT 1)
|
||||
set(WITH_PUSH 1)
|
||||
set(WITH_READER 1)
|
||||
set(WITH_PATTERN 1)
|
||||
set(WITH_WRITER 1)
|
||||
set(WITH_SAX1 1)
|
||||
set(WITH_FTP 1)
|
||||
set(WITH_HTTP 1)
|
||||
set(WITH_VALID 1)
|
||||
set(WITH_HTML 1)
|
||||
set(WITH_LEGACY 1)
|
||||
set(WITH_C14N 1)
|
||||
set(WITH_CATALOG 1)
|
||||
set(WITH_DOCB 1)
|
||||
set(WITH_XPATH 1)
|
||||
set(WITH_XPTR 1)
|
||||
set(WITH_XINCLUDE 1)
|
||||
set(WITH_ICONV 1)
|
||||
set(WITH_ICU 0)
|
||||
set(WITH_ISO8859X 1)
|
||||
set(WITH_DEBUG 1)
|
||||
set(WITH_MEM_DEBUG 0)
|
||||
set(WITH_RUN_DEBUG 0)
|
||||
set(WITH_REGEXPS 1)
|
||||
set(WITH_SCHEMAS 1)
|
||||
set(WITH_SCHEMATRON 1)
|
||||
set(WITH_MODULES 1)
|
||||
set(MODULE_EXTENSION ".so")
|
||||
set(WITH_ZLIB 1)
|
||||
set(WITH_LZMA 1)
|
||||
|
||||
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)
|
||||
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} include ${LIBLZMA_INCLUDE_DIRS})
|
||||
target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include include ${LIBLZMA_INCLUDE_DIRS})
|
||||
target_link_libraries(libxml2 PRIVATE
|
||||
unofficial::iconv::libcharset unofficial::iconv::libiconv
|
||||
ZLIB::ZLIB
|
||||
${LIBLZMA_LIBRARIES}
|
||||
)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
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
|
||||
@ -55,6 +121,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
)
|
||||
target_compile_definitions(libxml2 PRIVATE
|
||||
-DHAVE_WIN32_THREADS
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: libxml2
|
||||
Version: 2.9.4-5
|
||||
Version: 2.9.9-4
|
||||
Description: Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform)
|
||||
Build-Depends: zlib, libiconv, liblzma
|
||||
|
@ -1,11 +1,12 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libxml2-2.9.4)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz" "http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz"
|
||||
FILENAME "libxml2-2.9.4.tar.gz"
|
||||
SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO GNOME/libxml2
|
||||
REF v2.9.9
|
||||
SHA512 bfcc08bd033f538a968205f0f9e2da4c3438ec2f35f017289783903365e13ed93d83f2f63c7497344a362b7418170ee586a5ecb45493e30feaa0f62b22a57b54
|
||||
HEAD_REF master
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
@ -19,8 +20,11 @@ vcpkg_configure_cmake(
|
||||
vcpkg_install_cmake()
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxml2/COPYING ${CURRENT_PACKAGES_DIR}/share/libxml2/copyright)
|
||||
configure_file(${SOURCE_PATH}/Copyright ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
|
||||
|
||||
# Install usage
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
_find_package(${ARGS})
|
||||
if(LibXml2_FOUND)
|
||||
find_package(LibLZMA)
|
||||
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
find_package(ZLIB)
|
||||
|
||||
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
list(APPEND LIBXML2_LIBRARIES
|
||||
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
|
||||
@ -9,5 +12,7 @@ if(LibXml2_FOUND)
|
||||
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
|
||||
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
|
||||
ws2_32)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
list(APPEND LIBXML2_LIBRARIES m)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user