Merge pull request #313 from muemart/xslt

Add libxslt
This commit is contained in:
Alexander Karatarakis 2016-11-22 15:52:00 -08:00 committed by GitHub
commit c4af751534
6 changed files with 324 additions and 32 deletions

View File

@ -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

View File

@ -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.
--

View File

@ -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
)

View File

@ -0,0 +1,73 @@
---
win32/Makefile.msvc | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index 23a02d2..b13dd26 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -22,7 +22,7 @@ BASEDIR = ..
XSLT_SRCDIR = $(BASEDIR)\libxslt
EXSLT_SRCDIR = $(BASEDIR)\libexslt
UTILS_SRCDIR = $(BASEDIR)\xsltproc
-BINDIR = bin.msvc
+BINDIR = $(OUTDIR)\bin.msvc
# Names of various input and output components.
XSLT_NAME = xslt
@@ -39,11 +39,11 @@ EXSLT_DEF = $(EXSLT_BASENAME).def
EXSLT_A = $(EXSLT_BASENAME)_a.lib
# Places where intermediate files produced by the compiler go
-XSLT_INTDIR = int.xslt.msvc
-XSLT_INTDIR_A = int.xslta.msvc
-EXSLT_INTDIR = int.exslt.msvc
-EXSLT_INTDIR_A = int.exslta.msvc
-UTILS_INTDIR = int.utils.msvc
+XSLT_INTDIR = $(OUTDIR)\int.xslt.msvc
+XSLT_INTDIR_A = $(OUTDIR)\int.xslta.msvc
+EXSLT_INTDIR = $(OUTDIR)\int.exslt.msvc
+EXSLT_INTDIR_A = $(OUTDIR)\int.exslta.msvc
+UTILS_INTDIR = $(OUTDIR)\int.utils.msvc
# The preprocessor and its options.
CPP = cl.exe /EP
@@ -59,7 +59,13 @@ CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
LD = link.exe
LDFLAGS = /nologo
LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
-LIBS = wsock32.lib
+# The libraries are needed for static builds (the makefile builds all tools and dlls)
+LIBS = wsock32.lib libiconv.lib libcharset.lib
+!if "$(DEBUG)" == "1"
+LIBS = $(LIBS) zlibd.lib
+!else
+LIBS = $(LIBS) zlib.lib
+!endif
# The archiver and its options.
AR = lib.exe
@@ -71,6 +77,7 @@ CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
LDFLAGS = $(LDFLAGS) /DEBUG
!else
CFLAGS = $(CFLAGS) /D "NDEBUG" /O2
+LDFLAGS = $(LDFLAGS) /DEBUG /OPT:REF /OPT:ICF
!endif
# Libxslt object files.
@@ -309,13 +316,7 @@ $(UTILS_INTDIR) :
# An implicit rule for xsltproc and friends.
APPLIBS = $(LIBS)
!if "$(STATIC)" == "1"
-APPLIBS = $(LIBS) libxml2_a.lib
-!if "$(WITH_ICONV)" == "1"
-APPLIBS = $(APPLIBS) iconv.lib
-!endif
-!if "$(WITH_ZLIB)" == "1"
-APPLIBS = $(APPLIBS) zlib.lib
-!endif
+APPLIBS = $(LIBS) libxml2.lib
{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
$(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \
$(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $<
--

4
ports/libxslt/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: libxslt
Version: 1.1.29
Description: Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT
Build-Depends: libxml2

View File

@ -0,0 +1,176 @@
# 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/libxslt-1.1.29)
vcpkg_download_distfile(ARCHIVE
URLS "ftp://xmlsoft.org/libxslt/libxslt-1.1.29.tar.gz"
FILENAME "libxslt-1.1.29.tar.gz"
SHA512 a1ce555a74a9dabe65e8f64bb66e27e77760fd76940d88f2d59f58dd63ca73c8ae59f3fcbd8e76c8f92ff992fb0c09328528c20ea38ccac83e63252106bf5f31
)
vcpkg_extract_source_archive(${ARCHIVE})
find_program(NMAKE nmake)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}/
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile.patch
)
set(SCRIPTS_DIR ${SOURCE_PATH}/win32)
set(CONFIGURE_COMMAND_TEMPLATE cscript configure.js
cruntime=@CRUNTIME@
debug=@DEBUGMODE@
prefix=@INSTALL_DIR@
include=@INCLUDE_DIR@
lib=@LIB_DIR@
bindir=$(PREFIX)\\tools\\
sodir=$(PREFIX)\\bin\\
)
# Create some directories ourselves, because the makefile doesn't
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
#
# Release
#
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
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)
set(INSTALL_DIR ${CURRENT_PACKAGES_DIR})
file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR)
file(TO_NATIVE_PATH "${INCLUDE_DIR}" INCLUDE_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}-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 OUTDIR=${OUTDIR}
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 OUTDIR=${OUTDIR}
WORKING_DIRECTORY ${SCRIPTS_DIR}
LOGNAME install-${TARGET_TRIPLET}-rel
)
message(STATUS "Installing ${TARGET_TRIPLET}-rel done")
#
# Debug
#
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
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)
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
)
# 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 OUTDIR=${OUTDIR}
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 OUTDIR=${OUTDIR}
WORKING_DIRECTORY ${SCRIPTS_DIR}
LOGNAME install-${TARGET_TRIPLET}-dbg
)
message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")
#
# Cleanup
#
# You have to define LIB(E)XSLT_STATIC or not, depending on how you link
file(READ ${CURRENT_PACKAGES_DIR}/include/libxslt/xsltexports.h XSLTEXPORTS_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "!defined(LIBXSLT_STATIC)" "0" XSLTEXPORTS_H "${XSLTEXPORTS_H}")
else()
string(REPLACE "!defined(LIBXSLT_STATIC)" "1" XSLTEXPORTS_H "${XSLTEXPORTS_H}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libxslt/xsltexports.h "${XSLTEXPORTS_H}")
file(READ ${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h EXSLTEXPORTS_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "!defined(LIBEXSLT_STATIC)" "0" EXSLTEXPORTS_H "${EXSLTEXPORTS_H}")
else()
string(REPLACE "!defined(LIBEXSLT_STATIC)" "1" EXSLTEXPORTS_H "${EXSLTEXPORTS_H}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h "${EXSLTEXPORTS_H}")
# 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)
# 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/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt_a.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt_a.lib)
else()
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxslt.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt.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/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxslt.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libexslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt.lib)
endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxslt)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxslt/COPYING ${CURRENT_PACKAGES_DIR}/share/libxslt/copyright)
vcpkg_copy_pdbs()