diff --git a/common/dllserver/dllserver.cpp b/common/dllserver/dllserver.cpp index 46cef2609f4..8ab43058dcc 100644 --- a/common/dllserver/dllserver.cpp +++ b/common/dllserver/dllserver.cpp @@ -785,7 +785,10 @@ void initDllServer(const char * localRoot) { CriticalBlock b(dllServerCrit); ::Release(dllServer); - dllServer = new DllServer(localRoot); + if (isContainerized()) + dllServer = new SharedVolumeDllServer(localRoot); + else + dllServer = new DllServer(localRoot); } diff --git a/dali/base/dadfs.cpp b/dali/base/dadfs.cpp index 030af8e53ca..5bed33ac926 100644 --- a/dali/base/dadfs.cpp +++ b/dali/base/dadfs.cpp @@ -6271,22 +6271,27 @@ class CDistributedSuperFile: public CDistributedFileBase virtual IDistributedFile &querySubFile(unsigned idx,bool sub) override { CriticalBlock block (sect); - if (sub) { - ForEachItemIn(i,subfiles) { + if (sub) + { + unsigned subfilen = idx; + ForEachItemIn(i,subfiles) + { IDistributedFile &f=subfiles.item(i); IDistributedSuperFile *super = f.querySuperFile(); - if (super) { + if (super) + { unsigned ns = super->numSubFiles(true); - if (ns>idx) - return super->querySubFile(idx,true); - idx -= ns; + if (ns>subfilen) + return super->querySubFile(subfilen,true); + subfilen -= ns; } - else if (idx--==0) + else if (subfilen--==0) return f; } - // fall through to error + throw makeStringExceptionV(-1,"CDistributedSuperFile::querySubFile(%u) for superfile %s - subfile doesn't exist ", idx, logicalName.get()); } - return subfiles.item(idx); + else + return subfiles.item(idx); } virtual IDistributedFile *querySubFileNamed(const char *name, bool sub) override diff --git a/dali/server/daldap.cpp b/dali/server/daldap.cpp index 90e97132297..a8176d1df74 100644 --- a/dali/server/daldap.cpp +++ b/dali/server/daldap.cpp @@ -105,6 +105,16 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface { if (!ldapsecurity||((getLDAPflags()&DLF_ENABLED)==0)) return SecAccess_Full; + + bool filescope = key && stricmp(key,"Scope")==0; + bool wuscope = key && stricmp(key,"workunit")==0; + + // + // Missing scopes get full access + if (!filescope && !wuscope) + return SecAccess_Full; + + StringBuffer username; StringBuffer password; if (udesc) @@ -114,57 +124,57 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface } else { - DBGLOG("NULL UserDescriptor in daldap.cpp getPermissions('%s')",key ? key : "NULL"); + DBGLOG("NULL UserDescriptor in daldap.cpp getPermissions('%s')", key ? key : "NULL"); } if (0 == username.length()) { username.append(filesdefaultuser); decrypt(password, filesdefaultpassword); - OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser for request %s %s", nullText(key), nullText(obj)); + OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser for request %s %s", nullText(key), + nullText(obj)); + logNullUser(nullptr); } Owned user = ldapsecurity->createUser(username); user->setAuthenticateStatus(AS_AUTHENTICATED); - bool filescope = key && stricmp(key,"Scope")==0; - bool wuscope = key && stricmp(key,"workunit")==0; - - if (filescope || wuscope) { - SecAccessFlags perm = SecAccess_None; - unsigned start = msTick(); - if (filescope) - perm=ldapsecurity->authorizeFileScope(*user, obj); - else if (wuscope) - perm=ldapsecurity->authorizeWorkunitScope(*user, obj); - if (perm == SecAccess_Unavailable) - { - OWARNLOG("LDAP: getPermissions(%s) Unable to get perms for scope=%s user=%s, setting 'SecAccess_None'", nullText(key), nullText(obj), username.str()); - perm = SecAccess_None; - } - unsigned taken = msTick()-start; + SecAccessFlags perm = SecAccess_None; + unsigned start = msTick(); + if (filescope) + perm = ldapsecurity->authorizeFileScope(*user, obj); + else if (wuscope) + perm = ldapsecurity->authorizeWorkunitScope(*user, obj); + if (perm == SecAccess_Unavailable) + { + OWARNLOG("LDAP: getPermissions(%s) Unable to get perms for scope=%s user=%s, setting 'SecAccess_None'", + nullText(key), nullText(obj), username.str()); + perm = SecAccess_None; + } + unsigned taken = msTick() - start; #ifndef _DEBUG - if (taken>100) + if (taken>100) #endif + { + PROGLOG("LDAP: getPermissions(%s) scope=%s user=%s returns %d in %d ms", nullText(key), nullText(obj), + username.str(), perm, taken); + } + if (auditflags & DALI_LDAP_AUDIT_REPORT) + { + StringBuffer auditstr; + if ((auditflags & DALI_LDAP_READ_WANTED) && !HASREADPERMISSION(perm)) + auditstr.append("Lookup Access Denied"); + else if ((auditflags & DALI_LDAP_WRITE_WANTED) && !HASWRITEPERMISSION(perm)) + auditstr.append("Create Access Denied"); + if (auditstr.length()) { - PROGLOG("LDAP: getPermissions(%s) scope=%s user=%s returns %d in %d ms", nullText(key), nullText(obj),username.str(),perm,taken); - } - if (auditflags&DALI_LDAP_AUDIT_REPORT) { - StringBuffer auditstr; - if ((auditflags&DALI_LDAP_READ_WANTED)&&!HASREADPERMISSION(perm)) - auditstr.append("Lookup Access Denied"); - else if ((auditflags&DALI_LDAP_WRITE_WANTED)&&!HASWRITEPERMISSION(perm)) - auditstr.append("Create Access Denied"); - if (auditstr.length()) { - auditstr.append(":\n\tProcess:\tdaserver"); - auditstr.appendf("\n\tUser:\t%s",username.str()); - auditstr.appendf("\n\tScope:\t%s\n",obj?obj:""); - SYSLOG(AUDIT_TYPE_ACCESS_FAILURE,auditstr.str()); - } + auditstr.append(":\n\tProcess:\tdaserver"); + auditstr.appendf("\n\tUser:\t%s", username.str()); + auditstr.appendf("\n\tScope:\t%s\n", obj ? obj : ""); + SYSLOG(AUDIT_TYPE_ACCESS_FAILURE, auditstr.str()); } - return perm; } - return SecAccess_Full; + return perm; } bool clearPermissionsCache(IUserDescriptor *udesc) { diff --git a/ecl/hqlcpp/hqlres.cpp b/ecl/hqlcpp/hqlres.cpp index 9f10a2cb6b4..f3445589360 100644 --- a/ecl/hqlcpp/hqlres.cpp +++ b/ecl/hqlcpp/hqlres.cpp @@ -648,6 +648,7 @@ bool ResourceManager::flush(StringBuffer &filename, const char *basename, bool f } fwrite(s.data.get(), 1, s.data.length(), bin); fclose(bin); + fprintf(f, " .size %s,%u\n", label.str(), (unsigned)s.data.length()); } fclose(f); #endif diff --git a/system/jlib/jstats.cpp b/system/jlib/jstats.cpp index 0f5b4618932..4dcab0b9ef1 100644 --- a/system/jlib/jstats.cpp +++ b/system/jlib/jstats.cpp @@ -2892,7 +2892,7 @@ void CRuntimeStatisticCollection::deserializeMerge(MemoryBuffer& in) in.read(hasNested); if (hasNested) { - ensureNested().deserializeMerge(in); + ensureNested().deserialize(in); } } diff --git a/vcpkg_overlays/libxml2/disable-docs.patch b/vcpkg_overlays/libxml2/disable-docs.patch new file mode 100644 index 00000000000..848961429d6 --- /dev/null +++ b/vcpkg_overlays/libxml2/disable-docs.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f922d5ab..70466bc7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -599,15 +599,5 @@ if(LIBXML2_WITH_PYTHON) + endif() + +-install(FILES doc/xml2-config.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) +-install(FILES doc/xmlcatalog.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) +-install(FILES doc/xmllint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) +-install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation +- PATTERN "Makefile.*" EXCLUDE +- PATTERN "*.1" EXCLUDE +- PATTERN "*.py" EXCLUDE +- PATTERN "*.res" EXCLUDE +- PATTERN "*.xml" EXCLUDE +- PATTERN "*.xsl" EXCLUDE) + + configure_package_config_file( + libxml2-config.cmake.cmake.in libxml2-config.cmake diff --git a/vcpkg_overlays/libxml2/fix_cmakelist.patch b/vcpkg_overlays/libxml2/fix_cmakelist.patch new file mode 100644 index 00000000000..f8c60d0f156 --- /dev/null +++ b/vcpkg_overlays/libxml2/fix_cmakelist.patch @@ -0,0 +1,108 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f922d5ab..685964b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -420,15 +420,15 @@ endif() + if(LIBXML2_WITH_ICU) + target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc) + if(WIN32) +- set(ICU_LIBS "-licudt -licuin -licuuc") ++ set(ICU_LIBS "icu-i18n") + else() +- set(ICU_LIBS "-licudata -licui18n -licuuc") ++ set(ICU_LIBS "icu-i18n") + endif() + endif() + + if(LIBXML2_WITH_LZMA) + target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA) +- set(LZMA_LIBS "-llzma") ++ set(LZMA_LIBS "liblzma") + endif() + + if(LIBXML2_WITH_THREADS) +@@ -438,7 +438,7 @@ endif() + + if(LIBXML2_WITH_ZLIB) + target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB) +- set(Z_LIBS "-lz") ++ set(Z_LIBS "zlib") + endif() + + set_target_properties( +@@ -490,23 +490,9 @@ set_target_properties( + SOVERSION ${LIBXML_MAJOR_VERSION} + ) + ++set(XML_LIB_NAME xml2) + if(MSVC) +- if(BUILD_SHARED_LIBS) +- set_target_properties( +- LibXml2 +- PROPERTIES +- DEBUG_POSTFIX d +- ) +- else() +- set_target_properties( +- LibXml2 +- PROPERTIES +- DEBUG_POSTFIX sd +- MINSIZEREL_POSTFIX s +- RELEASE_POSTFIX s +- RELWITHDEBINFO_POSTFIX s +- ) +- endif() ++ set(XML_LIB_NAME libxml2) + endif() + + install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) +@@ -654,30 +640,30 @@ install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2 COMPONEN + + configure_package_config_file( + libxml2-config.cmake.cmake.in libxml2-config.cmake +- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} ++ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2 + ) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2 + COMPONENT development + ) + + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake + VERSION ${PROJECT_VERSION} +- COMPATIBILITY ExactVersion ++ COMPATIBILITY SameMinorVersion + ) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2 + COMPONENT development + ) + + install( + EXPORT LibXml2 +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2 + NAMESPACE LibXml2:: + FILE libxml2-export.cmake + COMPONENT development +diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in +index 2653a7c5..2eb2f362 100644 +--- a/libxml-2.0.pc.in ++++ b/libxml-2.0.pc.in +@@ -8,6 +8,7 @@ Name: libXML + Version: @VERSION@ + Description: libXML library version2. + Requires: +-Libs: -L${libdir} @XML_LIBS@ +-Libs.private: @XML_PRIVATE_LIBS@ @LIBS@ ++Requires.private: @ICU_LIBS@ @Z_LIBS@ @LZMA_LIBS@ ++Libs: -L${libdir} -l@XML_LIB_NAME@ ++Libs.private: @THREAD_LIBS@ @ICONV_LIBS@ @LIBM@ @WIN32_EXTRA_LIBADD@ @LIBS@ + Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@ diff --git a/vcpkg_overlays/libxml2/portfile.cmake b/vcpkg_overlays/libxml2/portfile.cmake new file mode 100644 index 00000000000..483416031d5 --- /dev/null +++ b/vcpkg_overlays/libxml2/portfile.cmake @@ -0,0 +1,90 @@ +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.gnome.org/ + OUT_SOURCE_PATH SOURCE_PATH + REPO GNOME/libxml2 + REF f507d167f1755b7eaea09fb1a44d29aab828b6d1 + SHA512 2ac3dcab31111f608a3fe33dde492c9653ad2bd49a792373acdd03d2787e1a4ef70eeb7a3d47cf67eefd43aee2ab75ec50b36cdcd124445ca206de924abb6021 + HEAD_REF master + PATCHES + disable-docs.patch + fix_cmakelist.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "ftp" LIBXML2_WITH_FTP + "http" LIBXML2_WITH_HTTP + "iconv" LIBXML2_WITH_ICONV + "legacy" LIBXML2_WITH_LEGACY + "lzma" LIBXML2_WITH_LZMA + "zlib" LIBXML2_WITH_ZLIB + "tools" LIBXML2_WITH_PROGRAMS +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DLIBXML2_WITH_TESTS=OFF + -DLIBXML2_WITH_HTML=ON + -DLIBXML2_WITH_C14N=ON + -DLIBXML2_WITH_CATALOG=ON + -DLIBXML2_WITH_DEBUG=ON + -DLIBXML2_WITH_ISO8859X=ON + -DLIBXML2_WITH_ICU=OFF # Culprit of linkage issues? Solving this is probably another PR + -DLIBXML2_WITH_MEM_DEBUG=OFF + -DLIBXML2_WITH_MODULES=ON + -DLIBXML2_WITH_OUTPUT=ON + -DLIBXML2_WITH_PATTERN=ON + -DLIBXML2_WITH_PUSH=ON + -DLIBXML2_WITH_PYTHON=OFF + -DLIBXML2_WITH_READER=ON + -DLIBXML2_WITH_REGEXPS=ON + -DLIBXML2_WITH_RUN_DEBUG=OFF + -DLIBXML2_WITH_SAX1=ON + -DLIBXML2_WITH_SCHEMAS=ON + -DLIBXML2_WITH_SCHEMATRON=ON + -DLIBXML2_WITH_THREADS=ON + -DLIBXML2_WITH_THREAD_ALLOC=OFF + -DLIBXML2_WITH_TREE=ON + -DLIBXML2_WITH_VALID=ON + -DLIBXML2_WITH_WRITER=ON + -DLIBXML2_WITH_XINCLUDE=ON + -DLIBXML2_WITH_XPATH=ON + -DLIBXML2_WITH_XPTR=ON +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libxml2") +vcpkg_fixup_pkgconfig() + +vcpkg_copy_pdbs() + +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES xmllint xmlcatalog AUTO_CLEAN) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(_file "${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h") + file(READ "${_file}" _contents) + string(REPLACE "#ifdef LIBXML_STATIC" "#undef LIBXML_STATIC\n#define LIBXML_STATIC\n#ifdef LIBXML_STATIC" _contents "${_contents}") + file(WRITE "${_file}" "${_contents}") +endif() + +file(COPY "${CURRENT_PACKAGES_DIR}/include/libxml2/" DESTINATION "${CURRENT_PACKAGES_DIR}/include") # TODO: Fix usage in all dependent ports hardcoding the wrong include path. + +# Cleanup +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/xml2Conf.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/xml2Conf.sh") + +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" + "${CMAKE_CURRENT_LIST_DIR}/usage" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" +) +file(INSTALL "${SOURCE_PATH}/Copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg_overlays/libxml2/usage b/vcpkg_overlays/libxml2/usage new file mode 100644 index 00000000000..4eb53991550 --- /dev/null +++ b/vcpkg_overlays/libxml2/usage @@ -0,0 +1,4 @@ +The package libxml2 is compatible with built-in CMake targets: + + find_package(LibXml2 REQUIRED) + target_link_libraries(main PRIVATE LibXml2::LibXml2) diff --git a/vcpkg_overlays/libxml2/vcpkg-cmake-wrapper.cmake b/vcpkg_overlays/libxml2/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..596a9af5fed --- /dev/null +++ b/vcpkg_overlays/libxml2/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,3 @@ +list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE") +_find_package(${ARGS} CONFIG) +set(LIBXML2_FOUND "${LibXml2_FOUND}") # fphsa compatibility diff --git a/vcpkg_overlays/libxml2/vcpkg.json b/vcpkg_overlays/libxml2/vcpkg.json new file mode 100644 index 00000000000..47f4866b135 --- /dev/null +++ b/vcpkg_overlays/libxml2/vcpkg.json @@ -0,0 +1,57 @@ +{ + "name": "libxml2", + "version": "2.10.3", + "port-version": 1, + "description": "Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform).", + "homepage": "https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "iconv", + "lzma", + "zlib" + ], + "features": { + "ftp": { + "description": "Add the FTP support", + "supports": "!uwp" + }, + "http": { + "description": "Add the HTTP support", + "supports": "!uwp" + }, + "iconv": { + "description": "Add ICONV support", + "dependencies": [ + "libiconv" + ] + }, + "legacy": { + "description": "Add deprecated APIs for compatibility" + }, + "lzma": { + "description": "Use LZMA", + "dependencies": [ + "liblzma" + ] + }, + "tools": { + "description": "Build tools" + }, + "zlib": { + "description": "Use ZLib", + "dependencies": [ + "zlib" + ] + } + } +} diff --git a/vcpkg_overlays/libxslt/fix-gcrypt-deps.patch b/vcpkg_overlays/libxslt/fix-gcrypt-deps.patch new file mode 100644 index 00000000000..6d91a7248d4 --- /dev/null +++ b/vcpkg_overlays/libxslt/fix-gcrypt-deps.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6dc6501..d36a049 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -317,7 +317,9 @@ target_include_directories( + + if(LIBXSLT_WITH_CRYPTO AND NOT WIN32) + target_link_libraries(LibExslt PRIVATE Gcrypt::Gcrypt) +- set(LIBGCRYPT_LIBS "-lgcrypt") ++ # For libexslt.pc ++ set(LIBGCRYPT_LIBS "") ++ string(APPEND EXSLT_PRIVATE_REQUIRES " libgcrypt") + endif() + + target_link_libraries(LibExslt PUBLIC LibXslt LibXml2::LibXml2) +diff --git a/FindGcrypt.cmake b/FindGcrypt.cmake +index 781113d..a78fa84 100644 +--- a/FindGcrypt.cmake ++++ b/FindGcrypt.cmake +@@ -1,3 +1,20 @@ ++cmake_policy(PUSH) ++cmake_policy(SET CMP0012 NEW) ++cmake_policy(SET CMP0057 NEW) ++find_package(PkgConfig) ++if("REQUIRED" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) ++ pkg_check_modules(libxslt_gcrypt REQUIRED IMPORTED_TARGET libgcrypt) ++else() ++ pkg_check_modules(libxslt_gcrypt IMPORTED_TARGET libgcrypt) ++endif() ++set(Gcrypt_FOUND "${libxslt_gcrypt_FOUND}") # CMake standard, needed for find_dependency ++set(GCRYPT_FOUND "${libxslt_gcrypt_FOUND}") # libxslt usage ++if(libxslt_gcrypt_FOUND AND NOT TARGET Gcrypt::Gcrypt) ++ add_library(Gcrypt::Gcrypt INTERFACE IMPORTED) ++ set_target_properties(Gcrypt::Gcrypt PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::libxslt_gcrypt) ++endif() ++cmake_policy(POP) ++if(0) + include(FindPackageHandleStandardArgs) + include(SelectLibraryConfigurations) + +@@ -38,3 +53,4 @@ if(GCRYPT_FOUND AND NOT TARGET Gcrypt::Gcrypt) + INTERFACE_INCLUDE_DIRECTORIES "${GCRYPT_INCLUDE_DIRS}" + ) + endif() ++endif() diff --git a/vcpkg_overlays/libxslt/libexslt-pkgconfig.patch b/vcpkg_overlays/libxslt/libexslt-pkgconfig.patch new file mode 100644 index 00000000000..b500a8108ca --- /dev/null +++ b/vcpkg_overlays/libxslt/libexslt-pkgconfig.patch @@ -0,0 +1,14 @@ +diff --git a/libexslt.pc.in b/libexslt.pc.in +index 1d60563..50089e8 100644 +--- a/libexslt.pc.in ++++ b/libexslt.pc.in +@@ -7,7 +7,8 @@ includedir=@includedir@ + Name: libexslt + Version: @LIBEXSLT_VERSION@ + Description: EXSLT Extension library +-Requires: libxml-2.0, libxslt ++Requires: libxslt ++Requires.private: @EXSLT_PRIVATE_REQUIRES@ + Cflags: @EXSLT_INCLUDEDIR@ + Libs: @EXSLT_LIBDIR@ -lexslt + Libs.private: @EXSLT_PRIVATE_LIBS@ diff --git a/vcpkg_overlays/libxslt/msvc-no-suffix.patch b/vcpkg_overlays/libxslt/msvc-no-suffix.patch new file mode 100644 index 00000000000..243687fc579 --- /dev/null +++ b/vcpkg_overlays/libxslt/msvc-no-suffix.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d8679fb..6dc6501 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -244,7 +249,7 @@ set_target_properties( + VERSION ${PROJECT_VERSION} + ) + +-if(MSVC) ++if(0) # Never add suffixes which are not added by the autotools build or the nmake makefiles + if(BUILD_SHARED_LIBS) + set_target_properties( + LibXslt +@@ -327,7 +332,7 @@ set_target_properties( + VERSION ${LIBEXSLT_VERSION} + ) + +-if(MSVC) ++if(0) # same reason as above + if(BUILD_SHARED_LIBS) + set_target_properties( + LibExslt diff --git a/vcpkg_overlays/libxslt/portfile.cmake b/vcpkg_overlays/libxslt/portfile.cmake new file mode 100644 index 00000000000..6624f6a7818 --- /dev/null +++ b/vcpkg_overlays/libxslt/portfile.cmake @@ -0,0 +1,83 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO GNOME/libxslt + REF v1.1.37 + SHA512 4e7a57cbe02ceea34404213a88bdbb63a756edfab63063ce3979b670816ae3f6fb3637a49508204e6e46b936628e0a3b8b77e9201530a1184225bd68da403b25 + HEAD_REF master + PATCHES + python3.patch + msvc-no-suffix.patch + libexslt-pkgconfig.patch + fix-gcrypt-deps.patch + skip-install-docs.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "python" LIBXSLT_WITH_PYTHON + "crypto" LIBXSLT_WITH_CRYPTO +) +if("python" IN_LIST FEATURES) + vcpkg_find_acquire_program(PYTHON3) + list(APPEND FEATURE_OPTIONS "-DPYTHON_EXECUTABLE=${PYTHON3}") + list(APPEND FEATURE_OPTIONS_RELEASE "-DLIBXSLT_PYTHON_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/lib/site-packages") + list(APPEND FEATURE_OPTIONS_DEBUG "-DLIBXSLT_PYTHON_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/lib/site-packages") +endif() +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DLIBXSLT_WITH_TESTS:BOOL=OFF + -DLIBXSLT_WITH_THREADS:BOOL=ON + OPTIONS_RELEASE + ${FEATURE_OPTIONS_RELEASE} + -DLIBXSLT_WITH_XSLT_DEBUG:BOOL=OFF + -DLIBXSLT_WITH_MEM_DEBUG:BOOL=OFF + -DLIBXSLT_WITH_DEBUGGER:BOOL=OFF + OPTIONS_DEBUG + ${FEATURE_OPTIONS_DEBUG} + -DLIBXSLT_WITH_XSLT_DEBUG:BOOL=ON + -DLIBXSLT_WITH_MEM_DEBUG:BOOL=ON + -DLIBXSLT_WITH_DEBUGGER:BOOL=ON + ) +vcpkg_cmake_install() +file(GLOB config_path RELATIVE "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}/lib/cmake/libxslt-*") +vcpkg_cmake_config_fixup(CONFIG_PATH "${config_path}") + +file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/xsltConf.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/xsltConf.sh") + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/libxslt") +file(RENAME "${CURRENT_PACKAGES_DIR}/bin/xslt-config" "${CURRENT_PACKAGES_DIR}/tools/libxslt/xslt-config") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/libxslt/xslt-config" [[$(cd "$(dirname "$0")"; pwd -P)/..]] [[$(cd "$(dirname "$0")/../.."; pwd -P)]]) +if(NOT VCPKG_BUILD_TYPE) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/libxslt/debug") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/xslt-config" "${CURRENT_PACKAGES_DIR}/tools/libxslt/debug/xslt-config") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/libxslt/debug/xslt-config" [[$(cd "$(dirname "$0")"; pwd -P)/..]] [[$(cd "$(dirname "$0")/../../../debug"; pwd -P)]]) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/libxslt/debug/xslt-config" [[${prefix}/include]] [[${prefix}/../include]]) +endif() +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libxslt/xsltconfig.h" "#define LIBXSLT_DEFAULT_PLUGINS_PATH() \"${CURRENT_INSTALLED_DIR}/lib/libxslt-plugins\"" "") +vcpkg_copy_tools(TOOL_NAMES xsltproc AUTO_CLEAN) + +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libxslt/xsltexports.h" "ifdef LIBXSLT_STATIC" "if 1") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h" "ifdef LIBEXSLT_STATIC" "if 1") +endif() + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxslt.pc" " -lxslt" " -llibxslt") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libexslt.pc" " -lexslt" " -llibexslt") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libxslt.pc" " -lxslt" " -llibxslt") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libexslt.pc" " -lexslt" " -llibexslt") + endif() +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libxslt") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/Copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg_overlays/libxslt/python3.patch b/vcpkg_overlays/libxslt/python3.patch new file mode 100644 index 00000000000..fc86d1fc56e --- /dev/null +++ b/vcpkg_overlays/libxslt/python3.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d8679fb..6dc6501 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -35,6 +35,11 @@ if(LIBXSLT_WITH_PYTHON) + check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL) + if(HAVE_UNISTD_H AND HAVE_F_GETFL) + find_package(Python COMPONENTS Interpreter Development REQUIRED) ++ elseif(1) ++ find_package(Python3 COMPONENTS Interpreter Development REQUIRED) ++ add_library(Python::Python ALIAS Python3::Python) ++ set(Python_EXECUTABLE ${Python3_EXECUTABLE}) ++ set(Python_SITEARCH ${Python3_SITEARCH}) + else() + find_package(Python2 COMPONENTS Interpreter Development REQUIRED) + add_library(Python::Python ALIAS Python2::Python) diff --git a/vcpkg_overlays/libxslt/skip-install-docs.patch b/vcpkg_overlays/libxslt/skip-install-docs.patch new file mode 100644 index 00000000000..a5d59f32540 --- /dev/null +++ b/vcpkg_overlays/libxslt/skip-install-docs.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6dc6501..d36a049 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -432,10 +434,12 @@ if(LIBXSLT_WITH_PYTHON) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxslt.py DESTINATION ${LIBXSLT_PYTHON_INSTALL_DIR} COMPONENT runtime) + endif() + ++if(VCPKG_INSTALL_DOCS) + install(FILES libexslt/libexslt.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 COMPONENT documentation) + install(FILES libxslt/libxslt.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 COMPONENT documentation) + install(FILES doc/xsltproc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) + install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxslt COMPONENT documentation PATTERN Makefile.* EXCLUDE) ++endif() + + if(LIBXSLT_WITH_CRYPTO AND NOT WIN32) + install(FILES FindGcrypt.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxslt-${PROJECT_VERSION} COMPONENT development) diff --git a/vcpkg_overlays/libxslt/usage b/vcpkg_overlays/libxslt/usage new file mode 100644 index 00000000000..9bf987b6467 --- /dev/null +++ b/vcpkg_overlays/libxslt/usage @@ -0,0 +1,12 @@ +The package libxslt is compatible with built-in CMake targets: + + # xslt library + find_package(LibXslt REQUIRED) + target_link_libraries(main PRIVATE LibXslt::LibXslt) + + # exslt library + find_package(LibXslt REQUIRED) + target_link_libraries(main PRIVATE LibXslt::LibExslt) + +In order to use modules, you must set environment variable LIBXSLT_PLUGINS_PATH +at runtime. diff --git a/vcpkg_overlays/libxslt/vcpkg-cmake-wrapper.cmake b/vcpkg_overlays/libxslt/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..3d9f6e3dfa8 --- /dev/null +++ b/vcpkg_overlays/libxslt/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,5 @@ +list(REMOVE_ITEM ARGS "NO_MODULE") +list(REMOVE_ITEM ARGS "CONFIG") +list(REMOVE_ITEM ARGS "MODULE") + +_find_package(${ARGS} CONFIG) diff --git a/vcpkg_overlays/libxslt/vcpkg.json b/vcpkg_overlays/libxslt/vcpkg.json new file mode 100644 index 00000000000..8b9e8b83bc2 --- /dev/null +++ b/vcpkg_overlays/libxslt/vcpkg.json @@ -0,0 +1,43 @@ +{ + "name": "libxslt", + "version": "1.1.37", + "port-version": 2, + "description": "Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT", + "homepage": "https://github.com/GNOME/libxslt", + "license": null, + "supports": "!uwp", + "dependencies": [ + "libxml2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "default-features" + ], + "features": { + "crypto": { + "description": "Build with crypto support", + "supports": "!windows", + "dependencies": [ + "libgcrypt" + ] + }, + "default-features": { + "description": "default features for the current platform" + }, + "plugins": { + "description": "(deprecated)", + "supports": "!static" + }, + "python": { + "description": "Builds with python support", + "supports": "!windows" + } + } +}