[lz4] Install pc file, cleanup (#20108)

* Drop unused xxhash dependency

* Modernize portfile

* Install pc file

* x-add-version

* Switch to 'version' field

* Update versions

* Fix liblz4 pc file name

* Update versions
This commit is contained in:
Kai Pastor 2021-09-13 22:25:29 +02:00 committed by GitHub
parent c26477297c
commit 35c086d050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 19 deletions

View File

@ -47,3 +47,11 @@ install(EXPORT lz4Config
# Export the package for use from the build-tree (this registers the build-tree with a global CMake-registry)
export(PACKAGE lz4)
# Create pkgconfig module file
file(STRINGS "lib/lz4.h" LZ4_H REGEX "^#define LZ4_VERSION_(MAJOR|MINOR|RELEASE) ")
string(REGEX REPLACE "^.*MAJOR +([0-9]+).*MINOR +([0-9]+).*RELEASE +([0-9]+).*$" "\\1.\\2.\\3" VERSION "${LZ4_H}")
set(INCLUDEDIR [[${prefix}/include]])
set(LIBDIR [[${prefix}/lib]])
configure_file(lib/liblz4.pc.in lib/liblz4.pc)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib/liblz4.pc" DESTINATION "lib/pkgconfig")

View File

@ -6,30 +6,35 @@ vcpkg_from_github(
HEAD_REF dev
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(DLL_IMPORT "1 && defined(_MSC_VER)")
else()
set(DLL_IMPORT "0")
endif()
foreach(FILE lz4.h lz4frame.h)
file(READ ${CURRENT_PACKAGES_DIR}/include/${FILE} LZ4_HEADER)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "1 && defined(_MSC_VER)" LZ4_HEADER "${LZ4_HEADER}")
else()
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "0" LZ4_HEADER "${LZ4_HEADER}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/${FILE} "${LZ4_HEADER}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${FILE}"
"defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)"
"${DLL_IMPORT}"
)
endforeach()
vcpkg_fixup_cmake_targets()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lz4.pc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lz4.pc" " -llz4" " -llz4d")
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/lib/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,10 +1,17 @@
{
"name": "lz4",
"version-string": "1.9.3",
"port-version": 1,
"version": "1.9.3",
"port-version": 2,
"description": "Lossless compression algorithm, providing compression speed at 400 MB/s per core.",
"homepage": "https://github.com/lz4/lz4",
"dependencies": [
"xxhash"
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -3982,7 +3982,7 @@
},
"lz4": {
"baseline": "1.9.3",
"port-version": 1
"port-version": 2
},
"lzfse": {
"baseline": "1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c73172e611edeb3ef440fd1ea7ef4fe746237cfc",
"version": "1.9.3",
"port-version": 2
},
{
"git-tree": "05857030abda5345ee64ed534732f07147844de6",
"version-string": "1.9.3",