[7zip] Fix cmake package config (#23511)

This commit is contained in:
Osyotr 2022-03-16 01:24:05 +03:00 committed by GitHub
parent c21f961c2d
commit 5220969a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 102 additions and 80 deletions

View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/7zip-targets.cmake")
check_required_components(7zip)

View File

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.19)
project(7zip LANGUAGES C CXX)
@ -62,6 +61,7 @@ target_sources(7zip PRIVATE
CPP/7zip/Compress/ZlibEncoder.cpp
CPP/7zip/Compress/ZDecoder.cpp
CPP/7zip/Compress/CodecExports.cpp
CPP/7zip/Crypto/7zAes.cpp
CPP/7zip/Crypto/7zAesRegister.cpp
CPP/7zip/Crypto/HmacSha1.cpp
@ -95,14 +95,13 @@ target_sources(7zip PRIVATE
C/Lzma2Dec.c
C/Lzma2DecMt.c
C/Lzma2Enc.c
C/LzmaDec.c
C/LzmaEnc.c
C/LzmaLib.c
C/MtCoder.c
C/MtDec.c
C/Ppmd7.c
C/Ppmd7Dec.c
C/Ppmd7aDec.c
C/Ppmd7Dec.c
C/Ppmd7Enc.c
C/Ppmd8.c
C/Ppmd8Dec.c
@ -130,7 +129,9 @@ target_sources(7zip PRIVATE
CPP/Common/MyWindows.cpp
CPP/Common/MyXml.cpp
CPP/Common/NewHandler.cpp
CPP/Common/Sha1Prepare.cpp
CPP/Common/Sha1Reg.cpp
CPP/Common/Sha256Prepare.cpp
CPP/Common/Sha256Reg.cpp
CPP/Common/StringConvert.cpp
CPP/Common/StringToInt.cpp
@ -174,8 +175,8 @@ target_sources(7zip PRIVATE
CPP/7zip/Archive/ApmHandler.cpp
CPP/7zip/Archive/ArHandler.cpp
CPP/7zip/Archive/ArjHandler.cpp
CPP/7zip/Archive/Bz2Handler.cpp
CPP/7zip/Archive/Base64Handler.cpp
CPP/7zip/Archive/Bz2Handler.cpp
CPP/7zip/Archive/ComHandler.cpp
CPP/7zip/Archive/CpioHandler.cpp
CPP/7zip/Archive/CramfsHandler.cpp
@ -291,36 +292,40 @@ target_sources(7zip PRIVATE
C/Util/LzmaLib/LzmaLib.def
)
# 7zCrcOpt # AesOpt # Sha1Opt # Sha256Opt # XzCrc64Opt # LzFindOpt
set(WINDOWS_PRIVATE_HEADERS
Asm/x86/7zCrcOpt.asm
Asm/x86/AesOpt.asm
Asm/x86/Sha1Opt.asm
Asm/x86/Sha256Opt.asm
Asm/x86/XzCrc64Opt.asm
Asm/x86/LzFindOpt.asm
)
set(WINDOWS_PRIVATE_SOURCE_FILES
C/7zCrcOpt.c
C/AesOpt.c
C/Sha1Opt.c
C/Sha256Opt.c
C/XzCrc64Opt.c
C/LzFindOpt.c
)
# 7zCrcOpt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE ${WINDOWS_PRIVATE_HEADERS})
set_source_files_properties(${WINDOWS_PRIVATE_HEADERS} PROPERTIES LANGUAGE ASM_MASM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
#target_sources(7zip PRIVATE Asm/arm/7zCrcOpt.asm)
target_sources(7zip PRIVATE C/7zCrcOpt.c)
target_sources(7zip PRIVATE Asm/x86/7zCrcOpt.asm)
set_source_files_properties(Asm/x86/7zCrcOpt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE ${WINDOWS_PRIVATE_SOURCE_FILES})
target_sources(7zip PRIVATE C/7zCrcOpt.c)
endif()
else()
target_sources(7zip PRIVATE ${WINDOWS_PRIVATE_SOURCE_FILES})
target_sources(7zip PRIVATE C/7zCrcOpt.c)
endif()
# AesOpt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE Asm/x86/AesOpt.asm)
set_source_files_properties(Asm/x86/AesOpt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE C/AesOpt.c)
endif()
else()
target_sources(7zip PRIVATE C/AesOpt.c)
endif()
# LzFindOpt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE Asm/x86/LzFindOpt.asm)
set_source_files_properties(Asm/x86/LzFindOpt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE C/LzFindOpt.c)
endif()
else()
target_sources(7zip PRIVATE C/LzFindOpt.c)
endif()
# LzmaDecOpt
@ -341,6 +346,42 @@ if((VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") OR
set_source_files_properties(C/LzmaDec.c PROPERTIES COMPILE_DEFINITIONS "${defs}")
endif()
# Sha1Opt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE Asm/x86/Sha1Opt.asm)
set_source_files_properties(Asm/x86/Sha1Opt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE C/Sha1Opt.c)
endif()
else()
target_sources(7zip PRIVATE C/Sha1Opt.c)
endif()
# Sha256Opt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE Asm/x86/Sha256Opt.asm)
set_source_files_properties(Asm/x86/Sha256Opt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE C/Sha256Opt.c)
endif()
else()
target_sources(7zip PRIVATE C/Sha256Opt.c)
endif()
# XzCrc64Opt
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(7zip PRIVATE Asm/x86/XzCrc64Opt.asm)
set_source_files_properties(Asm/x86/XzCrc64Opt.asm PROPERTIES LANGUAGE ASM_MASM)
else()
target_sources(7zip PRIVATE C/XzCrc64Opt.c)
endif()
else()
target_sources(7zip PRIVATE C/XzCrc64Opt.c)
endif()
target_compile_definitions(7zip
PUBLIC
-D_REENTRANT
@ -398,6 +439,17 @@ foreach(HEADER ${PUBLIC_HEADERS})
)
endforeach()
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/7zip-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/7zip-config.cmake"
INSTALL_DESTINATION "share/7zip"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/7zip-config.cmake"
DESTINATION "share/7zip"
)
install(
EXPORT 7zip-targets
DESTINATION share/7zip

View File

@ -1,18 +1,18 @@
set(7ZIP_VERSION 21.07)
set(7ZIP_VERSION "2107")
vcpkg_download_distfile(ARCHIVE
URLS "https://www.7-zip.org/a/7z2107-src.7z"
FILENAME "7z2107-src.7z"
URLS "https://www.7-zip.org/a/7z${7ZIP_VERSION}-src.7z"
FILENAME "7z${7ZIP_VERSION}-src.7z"
SHA512 c13521a9829ac239a89015e1f5da27eeaa2469754e3f8ca32311d964ea9d0b40a17e4f8ccbd425d3e865aa768be345368f1c36f354d5710ac7cb2749dd6a3ab5
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${7ZIP_VERSION}
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
NO_REMOVE_ONE_LEVEL
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/7zip-config.cmake.in" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"

View File

@ -1,41 +0,0 @@
****** ***** ****** unRAR - free utility for RAR archives
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
****** ******* ****** License for use and distribution of
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** ** ** ** ** ** FREE portable version
~~~~~~~~~~~~~~~~~~~~~
The source code of unRAR utility is freeware. This means:
1. All copyrights to RAR and the utility unRAR are exclusively
owned by the author - Alexander Roshal.
2. The unRAR sources may be used in any software to handle RAR
archives without limitations free of charge, but cannot be used
to re-create the RAR compression algorithm, which is proprietary.
Distribution of modified unRAR sources in separate form or as a
part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
3. The unRAR utility may be freely distributed. No person or company
may charge a fee for the distribution of unRAR without written
permission from the copyright holder.
4. THE RAR ARCHIVER AND THE UNRAR UTILITY ARE DISTRIBUTED "AS IS".
NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
OR MISUSING THIS SOFTWARE.
5. Installing and using the unRAR utility signifies acceptance of
these terms and conditions of the license.
6. If you don't agree with terms of the license you must remove
unRAR files from your storage devices and cease to use the
utility.
Thank you for your interest in RAR and unRAR.
Alexander L. Roshal

View File

@ -1,6 +1,7 @@
{
"name": "7zip",
"version-string": "21.07",
"port-version": 1,
"description": "Library for archiving file with a high compression ratio.",
"homepage": "https://www.7-zip.org",
"license": "LGPL-2.1-or-later",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d60561160384264eaf45a225dcb41beccb87ecbc",
"version-string": "21.07",
"port-version": 1
},
{
"git-tree": "7a951689070e40d8ff0ed20b4e18bc533ef5db1f",
"version-string": "21.07",

View File

@ -6,7 +6,7 @@
},
"7zip": {
"baseline": "21.07",
"port-version": 0
"port-version": 1
},
"abseil": {
"baseline": "20211102.1",