[libiconv][libxml2] Fix libxml2 on Linux and OSX

This commit is contained in:
Robert Schumacher 2018-04-03 15:59:54 -07:00
parent 1a296f33e6
commit 1f7d155b5f
10 changed files with 150 additions and 73 deletions

View File

@ -1,3 +1,3 @@
Source: libiconv
Version: 1.15-2
Version: 1.15-3
Description: GNU Unicode text conversion

View File

@ -1,7 +1,7 @@
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/libiconv)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-iconv-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libiconv)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-iconv-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-iconv)
return()
endif()

View File

@ -0,0 +1,2 @@
add_library(unofficial::iconv::libcharset UNKNOWN IMPORTED)
add_library(unofficial::iconv::libiconv UNKNOWN IMPORTED)

View File

@ -1,2 +0,0 @@
add_library(unofficial::vcpkg::libcharset UNKNOWN IMPORTED)
add_library(unofficial::vcpkg::libiconv UNKNOWN IMPORTED)

View File

@ -3,60 +3,16 @@ project(libxml2 C)
option(INSTALL_HEADERS "Install public header files" ON)
set(CMAKE_SHARED_LIBRARY_PREFIX)
set(CMAKE_STATIC_LIBRARY_PREFIX)
find_package(ZLIB REQUIRED)
find_package(LibLZMA REQUIRED)
if(WIN32)
find_library(ICONV NAMES libiconv)
find_library(ICONV_CHARSET NAMES libcharset)
endif()
find_package(unofficial-iconv REQUIRED)
set(SOURCES
buf.c
c14n.c
catalog.c
chvalid.c
debugXML.c
dict.c
DOCBparser.c
encoding.c
entities.c
error.c
globals.c
hash.c
HTMLparser.c
HTMLtree.c
legacy.c
list.c
nanoftp.c
nanohttp.c
parser.c
parserInternals.c
pattern.c
relaxng.c
SAX.c
SAX2.c
schematron.c
threads.c
tree.c
uri.c
valid.c
xinclude.c
xlink.c
xmlIO.c
xmlmemory.c
xmlreader.c
xmlregexp.c
xmlmodule.c
xmlsave.c
xmlschemas.c
xmlschemastypes.c
xmlstring.c
xmlunicode.c
xmlwriter.c
xpath.c
xpointer.c
xzlib.c
)
file(GLOB SOURCES *.c)
list(FILTER SOURCES EXCLUDE REGEX "/(run|test|trio)[^/]*$")
list(FILTER SOURCES EXCLUDE REGEX "xml(lint|catalog).c$")
# Generate xmlexports with fixed definition of LIBXML_STATIC
file(READ include/libxml/xmlexports.h XMLEXPORTS_H)
@ -67,25 +23,33 @@ else()
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h "${XMLEXPORTS_H}")
file(GLOB PUBLIC_HEADERS include/libxml/*.h)
list(FILTER PUBLIC_HEADERS EXCLUDE REGEX "xmlexports\\.h$")
list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h)
configure_file(include/win32config.h config.h COPYONLY)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
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()
add_library(libxml2 ${SOURCES})
if(INSTALL_HEADERS)
file(GLOB PUBLIC_HEADERS include/libxml/*.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} win32/vc10 include ${LIBLZMA_INCLUDE_DIRS})
target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} include ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(libxml2 PRIVATE
unofficial::iconv::libcharset unofficial::iconv::libiconv
ZLIB::ZLIB
${LIBLZMA_LIBRARIES}
)
if(WIN32)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_include_directories(libxml2 PRIVATE win32/vc10)
target_link_libraries(libxml2 PRIVATE
${ICONV}
${ICONV_CHARSET}
wsock32.lib
ws2_32.lib
)

View File

@ -1,4 +1,4 @@
Source: libxml2
Version: 2.9.4-4
Version: 2.9.4-5
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

View File

@ -0,0 +1,56 @@
#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

@ -0,0 +1,54 @@
#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

@ -12,6 +12,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DPORT_DIR=${CMAKE_CURRENT_LIST_DIR}
OPTIONS_DEBUG -DINSTALL_HEADERS=OFF
)

View File

@ -1,11 +1,13 @@
_find_package(${ARGS})
if(LibXml2_FOUND AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
if(LibXml2_FOUND)
find_package(LibLZMA)
list(APPEND LIBXML2_LIBRARIES
${LIBLZMA_LIBRARIES}
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
ws2_32)
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_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
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
ws2_32)
endif()
endif()