2023-06-14 14:03:20 +08:00
|
|
|
vcpkg_from_github(
|
2018-03-02 00:44:25 +08:00
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2023-06-14 14:03:20 +08:00
|
|
|
REPO tukaani-project/xz
|
|
|
|
REF "v${VERSION}"
|
2024-06-19 03:34:27 +08:00
|
|
|
SHA512 ec708bcddc64285b0c36b89c9e6413994af4c15bb6865a7bc243a048ce86afccd0df88d46d55aa23fb8071d137dcc19cf357117adc92f030919540f8993cacf9
|
2023-06-14 14:03:20 +08:00
|
|
|
HEAD_REF master
|
2019-03-29 05:38:44 +08:00
|
|
|
PATCHES
|
2020-11-21 04:23:19 +08:00
|
|
|
win_output_name.patch # Fix output name on Windows. Autotool build does not generate lib prefixed libraries on windows.
|
2022-05-18 07:53:40 +08:00
|
|
|
build-tools.patch
|
2018-07-15 05:03:36 +08:00
|
|
|
)
|
|
|
|
|
2022-05-18 07:53:40 +08:00
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
|
|
FEATURES
|
|
|
|
tools BUILD_TOOLS
|
|
|
|
)
|
2023-02-11 03:30:30 +08:00
|
|
|
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
|
|
|
|
set(WASM_OPTIONS -DCMAKE_C_BYTE_ORDER=LITTLE_ENDIAN -DCMAKE_CXX_BYTE_ORDER=LITTLE_ENDIAN)
|
|
|
|
endif()
|
|
|
|
|
2021-07-23 06:48:47 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2022-05-18 07:53:40 +08:00
|
|
|
OPTIONS
|
|
|
|
${FEATURE_OPTIONS}
|
2023-02-11 03:30:30 +08:00
|
|
|
${WASM_OPTIONS}
|
2023-01-05 21:01:34 +08:00
|
|
|
-DBUILD_TESTING=OFF
|
|
|
|
-DCREATE_XZ_SYMLINKS=OFF
|
|
|
|
-DCREATE_LZMA_SYMLINKS=OFF
|
2023-07-12 01:33:28 +08:00
|
|
|
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT= # using flags from (vcpkg) toolchain
|
2024-06-19 03:34:27 +08:00
|
|
|
-DENABLE_NLS=OFF # nls is not supported by this port, yet
|
2023-01-05 21:01:34 +08:00
|
|
|
MAYBE_UNUSED_VARIABLES
|
2023-07-12 01:33:28 +08:00
|
|
|
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
|
2023-01-05 21:01:34 +08:00
|
|
|
CREATE_XZ_SYMLINKS
|
|
|
|
CREATE_LZMA_SYMLINKS
|
2024-06-19 03:34:27 +08:00
|
|
|
ENABLE_NLS
|
2018-03-02 00:44:25 +08:00
|
|
|
)
|
2021-07-23 06:48:47 +08:00
|
|
|
vcpkg_cmake_install()
|
2018-03-02 00:44:25 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2020-11-21 04:23:19 +08:00
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(libdir "\${prefix}/lib")
|
|
|
|
set(includedir "\${prefix}/include")
|
|
|
|
set(PACKAGE_URL https://tukaani.org/xz/)
|
2024-06-19 03:34:27 +08:00
|
|
|
set(PACKAGE_VERSION "${VERSION}")
|
2020-11-21 04:23:19 +08:00
|
|
|
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(PTHREAD_CFLAGS -pthread)
|
|
|
|
endif()
|
2022-03-01 02:25:31 +08:00
|
|
|
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)
|
2020-11-21 04:23:19 +08:00
|
|
|
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()
|
|
|
|
|
2021-07-23 06:48:47 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/liblzma)
|
2020-11-21 04:23:19 +08:00
|
|
|
|
2022-03-01 02:25:31 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "1")
|
2020-02-05 07:32:13 +08:00
|
|
|
else()
|
2022-03-01 02:25:31 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lzma.h" "defined(LZMA_API_STATIC)" "0")
|
2020-02-05 07:32:13 +08:00
|
|
|
endif()
|
2019-05-29 07:58:00 +08:00
|
|
|
|
2022-03-01 02:25:31 +08:00
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/man"
|
|
|
|
)
|
2020-11-21 04:23:19 +08:00
|
|
|
|
2024-06-19 03:34:27 +08:00
|
|
|
set(TOOLS xz xzdec lzmadec lzmainfo)
|
2020-11-21 04:23:19 +08:00
|
|
|
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()
|
2018-03-02 00:44:25 +08:00
|
|
|
|
2022-03-01 02:25:31 +08:00
|
|
|
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}")
|
2023-06-14 14:03:20 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|