vcpkg/ports/libxml2/portfile.cmake
phil7676 bf7992418c
[libxml2] Update to version 2.11.7 (#37028)
<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->

<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->

<!-- If this PR updates an existing port, please uncomment and fill out
this checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] The "supports" clause reflects platforms that may be fixed by this
new version.
- [ ] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [ ] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

END OF PORT UPDATE CHECKLIST (delete this line) -->

<!-- If this PR adds a new port, please uncomment and fill out this
checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] The name of the port matches an existing name for this component
on https://repology.org/ if possible, and/or is strongly associated with
that component on search engines.
- [ ] Optional dependencies are resolved in exactly one way. For
example, if the component is built with CMake, all `find_package` calls
are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or
disabled with
[CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [ ] The versioning scheme in `vcpkg.json` matches what upstream says.
- [ ] The license declaration in `vcpkg.json` matches what upstream
says.
- [ ] The installed as the "copyright" file matches what upstream says.
- [ ] The source code of the component installed comes from an
authoritative source.
- [ ] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [ ] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [ ] Only one version is in the new port's versions file.
- [ ] Only one version is added to each modified port's versions file.

END OF NEW PORT CHECKLIST (delete this line) -->

Co-authored-by: sin <Philipp.Sindel@iso-gruppe.com>
2024-03-01 14:43:46 -08:00

90 lines
2.9 KiB
CMake

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/libxml2
REF "v${VERSION}"
SHA512 289d8e30a894a3efde78e06d1cedadc1491f4abdc2c0b653bb5410be48338aacec29e0ca23e1f1cac2725fd4e2114a8d20dcdaa80cf7f5b34302342d6f5efe10
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
"icu" LIBXML2_WITH_ICU
)
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_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_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}"
)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/Copyright")