2018-03-02 00:44:25 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO xz-mirror/xz
|
2020-07-16 06:09:33 +08:00
|
|
|
REF v5.2.5
|
|
|
|
SHA512 686f01cfe33e2194766a856c48668c661b25eee194a443524f87ce3f866e0eb54914075b4e00185921516c5211db8cd5d2658f4b91f4a3580508656f776f468e
|
2018-03-02 00:44:25 +08:00
|
|
|
HEAD_REF master
|
2019-03-29 05:38:44 +08:00
|
|
|
PATCHES
|
|
|
|
enable-uwp-builds.patch
|
2020-11-21 04:23:19 +08:00
|
|
|
fix_config_include.patch
|
|
|
|
win_output_name.patch # Fix output name on Windows. Autotool build does not generate lib prefixed libraries on windows.
|
2018-07-15 05:03:36 +08:00
|
|
|
)
|
|
|
|
|
2018-03-02 00:44:25 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PREFER_NINJA
|
2020-11-21 04:23:19 +08:00
|
|
|
OPTIONS
|
|
|
|
"-DCMAKE_DEBUG_POSTFIX=d" # This was in the old vcpkg CMakeLists.txt and I don't intend to fix it all over vcpkg
|
2018-03-02 00:44:25 +08:00
|
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
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/)
|
|
|
|
set(PACKAGE_VERSION 5.2.5)
|
|
|
|
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(PTHREAD_CFLAGS -pthread)
|
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
set(prefix "${CURRENT_INSTALLED_DIR}")
|
|
|
|
configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/liblzma.pc" @ONLY)
|
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
|
|
|
|
configure_file("${SOURCE_PATH}/src/liblzma/liblzma.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblzma.pc" @ONLY)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblzma.pc" "-llzma" "-llzmad")
|
|
|
|
endif()
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
|
|
|
|
|
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/liblzma)
|
|
|
|
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/liblzma/liblzma-config.cmake" "include(\"\${CMAKE_CURRENT_LIST_DIR}/liblzmaConfig.cmake\")")
|
|
|
|
file(APPEND "${CURRENT_PACKAGES_DIR}/share/liblzma/liblzmaConfig.cmake"
|
2019-05-29 07:58:00 +08:00
|
|
|
"
|
|
|
|
include(\${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
|
|
|
|
find_path(LibLZMA_INCLUDE_DIR
|
|
|
|
NAMES lzma.h
|
|
|
|
PATH_SUFFIXES lzma
|
|
|
|
)
|
|
|
|
if(NOT LibLZMA_LIBRARY)
|
2020-11-21 04:23:19 +08:00
|
|
|
find_library(LibLZMA_LIBRARY_RELEASE NAMES lzma LZMA LibLZMA liblzma PATHS \${_IMPORT_PREFIX}/lib/)
|
|
|
|
find_library(LibLZMA_LIBRARY_DEBUG NAMES lzmad LZMAd LibLZMAd lzma LZMA LibLZMA liblzma PATHS \${_IMPORT_PREFIX}/debug/lib/)
|
2019-05-29 07:58:00 +08:00
|
|
|
select_library_configurations(LibLZMA)
|
|
|
|
endif()
|
|
|
|
set(LibLZMA_INCLUDE_DIRS \${LibLZMA_INCLUDE_DIR} CACHE PATH \"\")
|
|
|
|
set(LibLZMA_LIBRARIES \${LibLZMA_LIBRARY} CACHE STRING \"\")
|
|
|
|
set(LZMA_INCLUDE_DIR \${LibLZMA_INCLUDE_DIR} CACHE PATH \"\")
|
|
|
|
set(LZMA_LIBRARY \${LibLZMA_LIBRARY} CACHE STRING \"\")
|
|
|
|
set(LZMA_INCLUDE_DIRS \${LibLZMA_INCLUDE_DIR} CACHE PATH \"\")
|
|
|
|
set(LZMA_LIBRARIES \${LibLZMA_LIBRARY} CACHE STRING \"\")
|
|
|
|
set(LIBLZMA_INCLUDE_DIRS \${LibLZMA_INCLUDE_DIR} CACHE PATH \"\")
|
|
|
|
set(LIBLZMA_LIBRARIES \${LibLZMA_LIBRARY} CACHE STRING \"\")
|
|
|
|
set(LIBLZMA_INCLUDE_DIR \${LibLZMA_INCLUDE_DIR} CACHE PATH \"\")
|
|
|
|
set(LIBLZMA_LIBRARY \${LibLZMA_LIBRARY} CACHE STRING \"\")
|
|
|
|
|
|
|
|
if(LIBLZMA_INCLUDE_DIR AND EXISTS \"\${LIBLZMA_INCLUDE_DIR}/lzma/version.h\")
|
|
|
|
file(STRINGS \"\${LIBLZMA_INCLUDE_DIR}/lzma/version.h\" LIBLZMA_HEADER_CONTENTS REGEX \"#define LZMA_VERSION_[A-Z]+ [0-9]+\")
|
|
|
|
|
|
|
|
string(REGEX REPLACE \".*#define LZMA_VERSION_MAJOR ([0-9]+).*\" \"\\\\1\" LIBLZMA_VERSION_MAJOR \"\${LIBLZMA_HEADER_CONTENTS}\")
|
|
|
|
string(REGEX REPLACE \".*#define LZMA_VERSION_MINOR ([0-9]+).*\" \"\\\\1\" LIBLZMA_VERSION_MINOR \"\${LIBLZMA_HEADER_CONTENTS}\")
|
|
|
|
string(REGEX REPLACE \".*#define LZMA_VERSION_PATCH ([0-9]+).*\" \"\\\\1\" LIBLZMA_VERSION_PATCH \"\${LIBLZMA_HEADER_CONTENTS}\")
|
|
|
|
|
|
|
|
set(LIBLZMA_VERSION_STRING \"\${LIBLZMA_VERSION_MAJOR}.\${LIBLZMA_VERSION_MINOR}.\${LIBLZMA_VERSION_PATCH}\")
|
|
|
|
unset(LIBLZMA_HEADER_CONTENTS)
|
2018-03-02 00:44:25 +08:00
|
|
|
endif()
|
|
|
|
|
2019-05-29 07:58:00 +08:00
|
|
|
## We're using new code known now as XZ, even library still been called LZMA
|
|
|
|
## it can be found in http://tukaani.org/xz/
|
|
|
|
## Avoid using old codebase
|
|
|
|
#if (LIBLZMA_LIBRARY)
|
|
|
|
# include(\${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
|
|
|
# CHECK_LIBRARY_EXISTS(\${LibLZMA_LIBRARY_RELEASE} lzma_auto_decoder \"\" LIBLZMA_HAS_AUTO_DECODER)
|
|
|
|
# CHECK_LIBRARY_EXISTS(\${LibLZMA_LIBRARY_RELEASE} lzma_easy_encoder \"\" LIBLZMA_HAS_EASY_ENCODER)
|
|
|
|
# CHECK_LIBRARY_EXISTS(\${LibLZMA_LIBRARY_RELEASE} lzma_lzma_preset \"\" LIBLZMA_HAS_LZMA_PRESET)
|
|
|
|
#endif ()
|
|
|
|
|
|
|
|
set(LibLZMA_FOUND TRUE CACHE BOOL \"\")
|
|
|
|
set(LZMA_FOUND TRUE CACHE BOOL \"\")
|
|
|
|
set(LIBLZMA_FOUND TRUE CACHE BOOL \"\")
|
|
|
|
")
|
|
|
|
|
2020-07-30 06:57:24 +08:00
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/include/lzma.h _contents)
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
string(REPLACE "defined(LZMA_API_STATIC)" "1" _contents "${_contents}")
|
|
|
|
else()
|
|
|
|
string(REPLACE "defined(LZMA_API_STATIC)" "0" _contents "${_contents}")
|
2019-05-29 07:58:00 +08:00
|
|
|
endif()
|
2020-07-30 06:57:24 +08:00
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/include/lzma.h "${_contents}")
|
2019-05-29 07:58:00 +08:00
|
|
|
|
2020-02-05 07:32:13 +08:00
|
|
|
if (VCPKG_BUILD_TYPE STREQUAL debug)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/include)
|
|
|
|
else()
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
endif()
|
2019-05-29 07:58:00 +08:00
|
|
|
|
2020-04-28 05:43:29 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
vcpkg_replace_string(
|
|
|
|
"${CURRENT_PACKAGES_DIR}/include/lzma.h"
|
|
|
|
"if !defined(LZMA_API_STATIC)"
|
|
|
|
"if 0"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-07-16 06:09:33 +08:00
|
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
2020-11-21 04:23:19 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
|
|
|
|
set(TOOLS xz xzdec)
|
|
|
|
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
|
|
|
|
2020-07-16 06:09:33 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
2020-11-21 04:23:19 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|