From c402d53080ad507dd81b0cb7ca8ddfb71a502c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Sat, 15 Oct 2016 20:52:05 +0200 Subject: Add libxml2 --- ports/libxml2/0001-Fix-makefile-imports.patch | 27 +++++ ports/libxml2/CONTROL | 4 + ports/libxml2/portfile.cmake | 145 ++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 ports/libxml2/0001-Fix-makefile-imports.patch create mode 100644 ports/libxml2/CONTROL create mode 100644 ports/libxml2/portfile.cmake (limited to 'ports/libxml2') diff --git a/ports/libxml2/0001-Fix-makefile-imports.patch b/ports/libxml2/0001-Fix-makefile-imports.patch new file mode 100644 index 000000000..ae40648b9 --- /dev/null +++ b/ports/libxml2/0001-Fix-makefile-imports.patch @@ -0,0 +1,27 @@ +diff --git "a/win32/Makefile.msvc" "b/win32/Makefile.msvc" +index d16c1a2..09d2291 100644 +--- "a/win32/Makefile.msvc" ++++ "b/win32/Makefile.msvc" +@@ -72,7 +72,7 @@ LIBS = + LIBS = $(LIBS) wsock32.lib ws2_32.lib + !endif + !if "$(WITH_ICONV)" == "1" +-LIBS = $(LIBS) iconv.lib ++LIBS = $(LIBS) libiconv.lib libcharset.lib + !endif + !if "$(WITH_ICU)" == "1" + LIBS = $(LIBS) icu.lib +@@ -80,7 +80,11 @@ LIBS = $(LIBS) icu.lib + !if "$(WITH_ZLIB)" == "1" + # could be named differently zdll or zlib + # LIBS = $(LIBS) zdll.lib +-LIBS = $(LIBS) zlib.lib ++!if "$(DEBUG)" == "1" ++LIBS = $(LIBS) zlibd.lib ++!else ++LIBS = $(LIBS) zlib.lib ++!endif + !endif + !if "$(WITH_LZMA)" == "1" + LIBS = $(LIBS) liblzma.lib + \ No newline at end of file diff --git a/ports/libxml2/CONTROL b/ports/libxml2/CONTROL new file mode 100644 index 000000000..538060dae --- /dev/null +++ b/ports/libxml2/CONTROL @@ -0,0 +1,4 @@ +Source: libxml2 +Version: 2.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 diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake new file mode 100644 index 000000000..11682c3bd --- /dev/null +++ b/ports/libxml2/portfile.cmake @@ -0,0 +1,145 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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(${CMAKE_TRIPLET_FILE}) +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" + FILENAME "libxml2-2.9.4.tar.gz" + SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +find_program(NMAKE nmake) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH}/ + PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile-imports.patch +) + +set(SCRIPTS_DIR ${SOURCE_PATH}/win32) + +set(CONFIGURE_COMMAND_TEMPLATE cscript configure.js + zlib=yes + cruntime=@CRUNTIME@ + debug=@DEBUGMODE@ + prefix=@INSTALL_DIR@ + include=@INCLUDE_DIR@ + lib=@LIB_DIR@ + bindir=@INSTALL_BIN_DIR@ +) + + +# +# Release +# + +message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + +set(CRUNTIME /MD) +set(DEBUGMODE no) +set(LIB_DIR ${CURRENT_INSTALLED_DIR}/lib) +set(INCLUDE_DIR ${CURRENT_INSTALLED_DIR}/include) +set(INSTALL_DIR ${CURRENT_PACKAGES_DIR}) +set(INSTALL_BIN_DIR "$(PREFIX)/tools") +file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR) +file(TO_NATIVE_PATH "${INCLUDE_DIR}" INCLUDE_DIR) +file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR) +file(TO_NATIVE_PATH "${INSTALL_BIN_DIR}" INSTALL_BIN_DIR) +string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND) +vcpkg_execute_required_process( + COMMAND ${CONFIGURE_COMMAND} + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME config-${TARGET_TRIPLET}-rel +) +message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + +message(STATUS "Building ${TARGET_TRIPLET}-rel") +vcpkg_execute_required_process( + COMMAND ${NMAKE} /f Makefile.msvc rebuild + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME build-${TARGET_TRIPLET}-rel +) +message(STATUS "Building ${TARGET_TRIPLET}-rel done") + +message(STATUS "Installing ${TARGET_TRIPLET}-rel") +vcpkg_execute_required_process( + COMMAND ${NMAKE} /f Makefile.msvc install + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME install-${TARGET_TRIPLET}-rel +) +message(STATUS "Installing ${TARGET_TRIPLET}-rel done") + + +# +# Debug +# + +message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + +set(CRUNTIME /MDd) +set(DEBUGMODE yes) +set(LIB_DIR ${CURRENT_INSTALLED_DIR}/debug/lib) +set(INSTALL_DIR ${CURRENT_PACKAGES_DIR}/debug) +file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR) +file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR) +string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND) + +vcpkg_execute_required_process( + COMMAND ${CONFIGURE_COMMAND} + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME config-${TARGET_TRIPLET}-dbg +) +message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + +message(STATUS "Building ${TARGET_TRIPLET}-dbg") +vcpkg_execute_required_process( + COMMAND ${NMAKE} /f Makefile.msvc rebuild + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME build-${TARGET_TRIPLET}-dbg +) +message(STATUS "Building ${TARGET_TRIPLET}-dbg done") + +message(STATUS "Installing ${TARGET_TRIPLET}-dbg") +vcpkg_execute_required_process( + COMMAND ${NMAKE} /f Makefile.msvc install + WORKING_DIRECTORY ${SCRIPTS_DIR} + LOGNAME install-${TARGET_TRIPLET}-dbg +) +message(STATUS "Installing ${TARGET_TRIPLET}-dbg done") + +# +# Cleanup +# + +# Remove tools and debug include directories +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tools) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Move includes to the expected directory +file(RENAME ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml ${CURRENT_PACKAGES_DIR}/include/libxml) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libxml2) + +# The makefile builds both static and dynamic libraries, so remove the ones we don't want +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2_a_dll.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a_dll.lib) +else() + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxml2.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2_a_dll.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a_dll.lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) + # Rename the libs to match the dynamic lib names + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2.lib) +endif() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxml2/COPYING ${CURRENT_PACKAGES_DIR}/share/libxml2/copyright) -- cgit v1.2.3 From 2e8f2d76be79726f9be9ec0c677026f4f58f6d91 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 31 Oct 2016 13:35:53 -0700 Subject: [libxml2] Call vcpkg_copy_pdbs() --- ports/libxml2/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ports/libxml2') diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake index 11682c3bd..26a604897 100644 --- a/ports/libxml2/portfile.cmake +++ b/ports/libxml2/portfile.cmake @@ -143,3 +143,5 @@ endif() # Handle copyright file(COPY ${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 -- cgit v1.2.3 From 1808d461b0e8793445b87eb8ceed71d5ac7aca6e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 8 Nov 2016 14:25:47 -0800 Subject: triplet is now automatically included before portfiles. Also remove trailing whitespaces from portfiles --- ports/libxml2/portfile.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'ports/libxml2') diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake index 26a604897..f7e17e21b 100644 --- a/ports/libxml2/portfile.cmake +++ b/ports/libxml2/portfile.cmake @@ -6,7 +6,6 @@ # CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} # -include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libxml2-2.9.4) vcpkg_download_distfile(ARCHIVE -- cgit v1.2.3 From 971e1dfd0dd67d886615a82e085a94fd1c39f84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Mon, 21 Nov 2016 22:39:34 +0100 Subject: Fix libxml2 port when building with static linkage --- ports/libxml2/portfile.cmake | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'ports/libxml2') diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake index f7e17e21b..8bddd6c54 100644 --- a/ports/libxml2/portfile.cmake +++ b/ports/libxml2/portfile.cmake @@ -41,7 +41,11 @@ set(CONFIGURE_COMMAND_TEMPLATE cscript configure.js message(STATUS "Configuring ${TARGET_TRIPLET}-rel") -set(CRUNTIME /MD) +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(CRUNTIME /MD) +else() + set(CRUNTIME /MT) +endif() set(DEBUGMODE no) set(LIB_DIR ${CURRENT_INSTALLED_DIR}/lib) set(INCLUDE_DIR ${CURRENT_INSTALLED_DIR}/include) @@ -82,7 +86,11 @@ message(STATUS "Installing ${TARGET_TRIPLET}-rel done") message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") -set(CRUNTIME /MDd) +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(CRUNTIME /MDd) +else() + set(CRUNTIME /MTd) +endif() set(DEBUGMODE yes) set(LIB_DIR ${CURRENT_INSTALLED_DIR}/debug/lib) set(INSTALL_DIR ${CURRENT_PACKAGES_DIR}/debug) @@ -117,6 +125,15 @@ message(STATUS "Installing ${TARGET_TRIPLET}-dbg done") # Cleanup # +# You have to define LIBXML_STATIC or not, depending on how you link +file(READ ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h XMLEXPORTS_H) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + string(REPLACE "!defined(LIBXML_STATIC)" "0" XMLEXPORTS_H "${XMLEXPORTS_H}") +else() + string(REPLACE "!defined(LIBXML_STATIC)" "1" XMLEXPORTS_H "${XMLEXPORTS_H}") +endif() +file(WRITE ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h "${XMLEXPORTS_H}") + # Remove tools and debug include directories file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tools) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools) -- cgit v1.2.3 From 7ebd074e064dbbad24c0d04da62c429ce6290471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Tue, 22 Nov 2016 09:44:37 +0100 Subject: Use different output folder for every triplet, and add debug info to release builds --- ports/libxml2/0001-Fix-makefile-imports.patch | 27 ------------ ports/libxml2/0001-Fix-makefile.patch | 60 +++++++++++++++++++++++++++ ports/libxml2/portfile.cmake | 16 ++++--- 3 files changed, 71 insertions(+), 32 deletions(-) delete mode 100644 ports/libxml2/0001-Fix-makefile-imports.patch create mode 100644 ports/libxml2/0001-Fix-makefile.patch (limited to 'ports/libxml2') diff --git a/ports/libxml2/0001-Fix-makefile-imports.patch b/ports/libxml2/0001-Fix-makefile-imports.patch deleted file mode 100644 index ae40648b9..000000000 --- a/ports/libxml2/0001-Fix-makefile-imports.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git "a/win32/Makefile.msvc" "b/win32/Makefile.msvc" -index d16c1a2..09d2291 100644 ---- "a/win32/Makefile.msvc" -+++ "b/win32/Makefile.msvc" -@@ -72,7 +72,7 @@ LIBS = - LIBS = $(LIBS) wsock32.lib ws2_32.lib - !endif - !if "$(WITH_ICONV)" == "1" --LIBS = $(LIBS) iconv.lib -+LIBS = $(LIBS) libiconv.lib libcharset.lib - !endif - !if "$(WITH_ICU)" == "1" - LIBS = $(LIBS) icu.lib -@@ -80,7 +80,11 @@ LIBS = $(LIBS) icu.lib - !if "$(WITH_ZLIB)" == "1" - # could be named differently zdll or zlib - # LIBS = $(LIBS) zdll.lib --LIBS = $(LIBS) zlib.lib -+!if "$(DEBUG)" == "1" -+LIBS = $(LIBS) zlibd.lib -+!else -+LIBS = $(LIBS) zlib.lib -+!endif - !endif - !if "$(WITH_LZMA)" == "1" - LIBS = $(LIBS) liblzma.lib - \ No newline at end of file diff --git a/ports/libxml2/0001-Fix-makefile.patch b/ports/libxml2/0001-Fix-makefile.patch new file mode 100644 index 000000000..0e6c774dd --- /dev/null +++ b/ports/libxml2/0001-Fix-makefile.patch @@ -0,0 +1,60 @@ +--- + win32/Makefile.msvc | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc +index d16c1a2..de9e22e 100644 +--- a/win32/Makefile.msvc ++++ b/win32/Makefile.msvc +@@ -28,11 +28,11 @@ XML_A = $(XML_BASENAME)_a.lib + XML_A_DLL = $(XML_BASENAME)_a_dll.lib + + # Place where we let the compiler put its output. +-BINDIR = bin.msvc +-XML_INTDIR = int.msvc +-XML_INTDIR_A = int.a.msvc +-XML_INTDIR_A_DLL = int.a.dll.msvc +-UTILS_INTDIR = int.utils.msvc ++BINDIR = $(OUTDIR)\bin.msvc ++XML_INTDIR = $(OUTDIR)\int.msvc ++XML_INTDIR_A = $(OUTDIR)\int.a.msvc ++XML_INTDIR_A_DLL = $(OUTDIR)\int.a.dll.msvc ++UTILS_INTDIR = $(OUTDIR)\int.utils.msvc + + # The preprocessor and its options. + CPP = cl.exe /EP +@@ -72,16 +72,18 @@ LIBS = + LIBS = $(LIBS) wsock32.lib ws2_32.lib + !endif + !if "$(WITH_ICONV)" == "1" +-LIBS = $(LIBS) iconv.lib ++LIBS = $(LIBS) libiconv.lib libcharset.lib + !endif + !if "$(WITH_ICU)" == "1" + LIBS = $(LIBS) icu.lib + !endif + !if "$(WITH_ZLIB)" == "1" +-# could be named differently zdll or zlib +-# LIBS = $(LIBS) zdll.lib ++!if "$(DEBUG)" == "1" ++LIBS = $(LIBS) zlibd.lib ++!else + LIBS = $(LIBS) zlib.lib + !endif ++!endif + !if "$(WITH_LZMA)" == "1" + LIBS = $(LIBS) liblzma.lib + !endif +@@ -101,10 +103,10 @@ ARFLAGS = /nologo + CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 + LDFLAGS = $(LDFLAGS) /DEBUG + !else + CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 + # commented out as this break VC10 c.f. 634846 + # LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 +-LDFLAGS = $(LDFLAGS) ++LDFLAGS = $(LDFLAGS) /DEBUG /OPT:REF /OPT:ICF + !endif + + # Libxml object files. +-- diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake index 8bddd6c54..bb4e043b3 100644 --- a/ports/libxml2/portfile.cmake +++ b/ports/libxml2/portfile.cmake @@ -19,7 +19,7 @@ find_program(NMAKE nmake) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH}/ - PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile-imports.patch + PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile.patch ) set(SCRIPTS_DIR ${SOURCE_PATH}/win32) @@ -61,11 +61,14 @@ vcpkg_execute_required_process( WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME config-${TARGET_TRIPLET}-rel ) +# Handle build output directory +file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" OUTDIR) +file(MAKE_DIRECTORY "${OUTDIR}") message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") message(STATUS "Building ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${NMAKE} /f Makefile.msvc rebuild + COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR} WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME build-${TARGET_TRIPLET}-rel ) @@ -73,7 +76,7 @@ message(STATUS "Building ${TARGET_TRIPLET}-rel done") message(STATUS "Installing ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${NMAKE} /f Makefile.msvc install + COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR} WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME install-${TARGET_TRIPLET}-rel ) @@ -103,11 +106,14 @@ vcpkg_execute_required_process( WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME config-${TARGET_TRIPLET}-dbg ) +# Handle build output directory +file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" OUTDIR) +file(MAKE_DIRECTORY "${OUTDIR}") message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") message(STATUS "Building ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${NMAKE} /f Makefile.msvc rebuild + COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR} WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME build-${TARGET_TRIPLET}-dbg ) @@ -115,7 +121,7 @@ message(STATUS "Building ${TARGET_TRIPLET}-dbg done") message(STATUS "Installing ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${NMAKE} /f Makefile.msvc install + COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR} WORKING_DIRECTORY ${SCRIPTS_DIR} LOGNAME install-${TARGET_TRIPLET}-dbg ) -- cgit v1.2.3