vcpkg/ports/liblzma/portfile.cmake
Dr.-Ing. Carsten Grimm 0ddcda32f1
[liblzma] update to version 5.6.0 (#37199)
Fixes #37197.

- [x] 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.
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [x] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [x] 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.

The update to version 5.6.0, includes the following changes
* the patches were adapted for changes in the new version (I cannot
check if the patch for iOS support was adapted correctly)
* the new tools `lzmadec` and `lzmainfo` are handled in the same manner
as the existing tools `xz` and `xzdec`
* ~nls was disabled to sidestep an issue with installing the man pages~
* ~a new feature `nls` was added to enable native language support. This
was necessary to handle a new optional dependency on `gettext` so that
the existing `tools` feature continues to work.~
* nls support was not added, yet. See discussion below for details.

I have successfully built 
* `liblzma:x86-windows`,
* `liblzma:x64-windows`,
* `liblzma:x64-linux`, 
* `liblzma[tools]:x64-linux`,

Note that `tools`  is not supported on `windows`.

Requested by @Neustradamus

EDIT 1: added nls feature
EDIT 2: removed nls feature again
2024-03-11 13:24:56 -07:00

88 lines
3.1 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tukaani-project/xz
REF "v${VERSION}"
SHA512 0aa74e01c019c1d3893cf16f53b300ba4e74c6aa9febabf57ddb49b28615d76862eeb746c54c2085efd37c7e8cc0829014d9b7ad481a76294bc929b3cca91336
HEAD_REF master
PATCHES
fix_config_include.patch
win_output_name.patch # Fix output name on Windows. Autotool build does not generate lib prefixed libraries on windows.
add_support_ios.patch # add install bundle info for support ios
build-tools.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools BUILD_TOOLS
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
set(WASM_OPTIONS -DCMAKE_C_BYTE_ORDER=LITTLE_ENDIAN -DCMAKE_CXX_BYTE_ORDER=LITTLE_ENDIAN)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
${WASM_OPTIONS}
-DBUILD_TESTING=OFF
-DCREATE_XZ_SYMLINKS=OFF
-DCREATE_LZMA_SYMLINKS=OFF
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT= # using flags from (vcpkg) toolchain
-DENABLE_NLS=OFF # nls is not supported by this port, yet
MAYBE_UNUSED_VARIABLES
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
CREATE_XZ_SYMLINKS
CREATE_LZMA_SYMLINKS
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/include")
set(PACKAGE_URL https://tukaani.org/xz/)
set(PACKAGE_VERSION "${VERSION}")
if(NOT VCPKG_TARGET_IS_WINDOWS)
set(PTHREAD_CFLAGS -pthread)
endif()
set(prefix "${CURRENT_INSTALLED_DIR}")
configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/liblzma.pc" @ONLY)
if (NOT VCPKG_BUILD_TYPE)
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblzma.pc" @ONLY)
endif()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/liblzma)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "1")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "0")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/man"
)
set(TOOLS xz xzdec lzmadec lzmainfo)
foreach(_tool IN LISTS TOOLS)
if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/bin/${_tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
list(REMOVE_ITEM TOOLS ${_tool})
endif()
endforeach()
if(TOOLS)
vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")