aboutsummaryrefslogtreecommitdiff
path: root/ports/libxml2
diff options
context:
space:
mode:
Diffstat (limited to 'ports/libxml2')
-rw-r--r--ports/libxml2/CMakeLists.txt93
-rw-r--r--ports/libxml2/CONTROL2
-rw-r--r--ports/libxml2/config.linux.h56
-rw-r--r--ports/libxml2/config.osx.h54
-rw-r--r--ports/libxml2/portfile.cmake19
-rw-r--r--ports/libxml2/usage5
-rw-r--r--ports/libxml2/vcpkg-cmake-wrapper.cmake13
7 files changed, 170 insertions, 72 deletions
diff --git a/ports/libxml2/CMakeLists.txt b/ports/libxml2/CMakeLists.txt
index 02cccd6c7..3d49985ee 100644
--- a/ports/libxml2/CMakeLists.txt
+++ b/ports/libxml2/CMakeLists.txt
@@ -3,58 +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)
-find_library(ICONV NAMES libiconv)
-find_library(ICONV_CHARSET NAMES libcharset)
+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)
@@ -65,31 +23,46 @@ 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}
- ${ICONV}
- ${ICONV_CHARSET}
- wsock32.lib
- ws2_32.lib
)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ 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
+ )
+endif()
+
target_compile_definitions(libxml2 PRIVATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_REENTRANT
-DNOLIBTOOL
- -DHAVE_WIN32_THREADS
-DHAVE_ZLIB_H
-DHAVE_LZMA_H
)
diff --git a/ports/libxml2/CONTROL b/ports/libxml2/CONTROL
index 9f1564226..f005d2367 100644
--- a/ports/libxml2/CONTROL
+++ b/ports/libxml2/CONTROL
@@ -1,4 +1,4 @@
Source: libxml2
-Version: 2.9.4-1
+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
diff --git a/ports/libxml2/config.linux.h b/ports/libxml2/config.linux.h
new file mode 100644
index 000000000..d029e95cf
--- /dev/null
+++ b/ports/libxml2/config.linux.h
@@ -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
diff --git a/ports/libxml2/config.osx.h b/ports/libxml2/config.osx.h
new file mode 100644
index 000000000..95d83edc1
--- /dev/null
+++ b/ports/libxml2/config.osx.h
@@ -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
diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake
index de98368c9..d55d4052d 100644
--- a/ports/libxml2/portfile.cmake
+++ b/ports/libxml2/portfile.cmake
@@ -1,15 +1,7 @@
-# Common Ambient Variables:
-# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
-# TARGET_TRIPLET is the current triplet (x86-windows, etc)
-# PORT is the current port name (zlib, etc)
-# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
-# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
-#
-
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"
+ 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
)
@@ -20,13 +12,18 @@ 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
)
vcpkg_install_cmake()
# Handle copyright
-file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2)
+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)
-vcpkg_copy_pdbs() \ No newline at end of file
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2)
+endif()
diff --git a/ports/libxml2/usage b/ports/libxml2/usage
new file mode 100644
index 000000000..fd94c4b4e
--- /dev/null
+++ b/ports/libxml2/usage
@@ -0,0 +1,5 @@
+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})
diff --git a/ports/libxml2/vcpkg-cmake-wrapper.cmake b/ports/libxml2/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..68bed6547
--- /dev/null
+++ b/ports/libxml2/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,13 @@
+_find_package(${ARGS})
+if(LibXml2_FOUND)
+ find_package(LibLZMA)
+ 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()