diff --git a/ports/7zip/CMakeLists.txt b/ports/7zip/CMakeLists.txt index 4ed9005841..ec45bf6811 100644 --- a/ports/7zip/CMakeLists.txt +++ b/ports/7zip/CMakeLists.txt @@ -1,23 +1,17 @@ -# Created from 7-zip v19.00 - 7zip/CPP/7zip/Bundles/Format7zF -cmake_minimum_required(VERSION 3.11) -cmake_policy(VERSION 3.11) +cmake_minimum_required(VERSION 3.19) -project(7zip LANGUAGES C CXX ASM_MASM) +project(7zip LANGUAGES C CXX) -set(SRC_ASM - Asm/x86/AesOpt.asm - Asm/x86/7zCrcOpt.asm - Asm/x86/XzCrc64Opt.asm -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set_source_files_properties(${SRC_ASM} PROPERTIES COMPILE_FLAGS "-Dx64") -else() - set_source_files_properties(${SRC_ASM} PROPERTIES COMPILE_FLAGS "-safeseh") +if(VCPKG_TARGET_IS_WINDOWS) + enable_language(ASM_MASM) +elseif(VCPKG_TARGET_IS_LINUX) + enable_language(ASM) endif() -set(SRC_COMPRESS +add_library(7zip) + +target_sources(7zip PRIVATE CPP/7zip/Compress/Bcj2Coder.cpp CPP/7zip/Compress/Bcj2Register.cpp CPP/7zip/Compress/BcjCoder.cpp @@ -68,9 +62,6 @@ set(SRC_COMPRESS CPP/7zip/Compress/ZlibEncoder.cpp CPP/7zip/Compress/ZDecoder.cpp CPP/7zip/Compress/CodecExports.cpp -) - -set(SRC_CRYPTO CPP/7zip/Crypto/7zAes.cpp CPP/7zip/Crypto/7zAesRegister.cpp CPP/7zip/Crypto/HmacSha1.cpp @@ -85,9 +76,7 @@ set(SRC_CRYPTO CPP/7zip/Crypto/WzAes.cpp CPP/7zip/Crypto/ZipCrypto.cpp CPP/7zip/Crypto/ZipStrong.cpp -) -set(SRC_C C/7zBuf2.c C/7zStream.c C/Alloc.c @@ -113,6 +102,7 @@ set(SRC_C C/MtDec.c C/Ppmd7.c C/Ppmd7Dec.c + C/Ppmd7aDec.c C/Ppmd7Enc.c C/Ppmd8.c C/Ppmd8Dec.c @@ -128,24 +118,16 @@ set(SRC_C C/Aes.c C/7zCrc.c C/XzCrc64.c -) -set_source_files_properties( - ${SRC_COMPRESS} - ${SRC_CRYPTO} - ${SRC_C} - PROPERTIES - COMPILE_FLAGS $<$:"/O2"> -) - -set(SRC_OTHER CPP/Common/CRC.cpp CPP/Common/CrcReg.cpp CPP/Common/DynLimBuf.cpp CPP/Common/IntToString.cpp + CPP/Common/LzFindPrepare.cpp CPP/Common/MyMap.cpp CPP/Common/MyString.cpp CPP/Common/MyVector.cpp + CPP/Common/MyWindows.cpp CPP/Common/MyXml.cpp CPP/Common/NewHandler.cpp CPP/Common/Sha1Reg.cpp @@ -193,6 +175,7 @@ set(SRC_OTHER CPP/7zip/Archive/ArHandler.cpp CPP/7zip/Archive/ArjHandler.cpp CPP/7zip/Archive/Bz2Handler.cpp + CPP/7zip/Archive/Base64Handler.cpp CPP/7zip/Archive/ComHandler.cpp CPP/7zip/Archive/CpioHandler.cpp CPP/7zip/Archive/CramfsHandler.cpp @@ -303,32 +286,72 @@ set(SRC_OTHER CPP/7zip/Archive/Zip/ZipOut.cpp CPP/7zip/Archive/Zip/ZipUpdate.cpp CPP/7zip/Archive/Zip/ZipRegister.cpp -) -add_library(7zip - ${SRC_ASM} - ${SRC_OTHER} - ${SRC_COMPRESS} - ${SRC_CRYPTO} - ${SRC_C} CPP/7zip/Archive/Archive2.def 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 +) + +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) + else() + target_sources(7zip PRIVATE ${WINDOWS_PRIVATE_SOURCE_FILES}) + endif() +else() + target_sources(7zip PRIVATE ${WINDOWS_PRIVATE_SOURCE_FILES}) +endif() + +# LzmaDecOpt +target_sources(7zip PRIVATE C/LzmaDec.c) +if((VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") OR + (VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + ) + if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + target_sources(7zip PRIVATE Asm/x86/LzmaDecOpt.asm) + set_source_files_properties(Asm/x86/LzmaDecOpt.asm PROPERTIES LANGUAGE ASM_MASM) + elseif(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + target_sources(7zip PRIVATE Asm/arm64/LzmaDecOpt.S) + set_source_files_properties(Asm/x86/LzmaDecOpt.asm PROPERTIES LANGUAGE ASM) + endif() + + get_source_file_property(defs C/LzmaDec.c COMPILE_DEFINITIONS) + list(APPEND defs "_LZMA_DEC_OPT") + set_source_files_properties(C/LzmaDec.c PROPERTIES COMPILE_DEFINITIONS "${defs}") +endif() + target_compile_definitions(7zip PUBLIC + -D_REENTRANT + -D_FILE_OFFSET_BITS=64 + -D_LARGEFILE_SOURCE -DEXTERNAL_CODECS -D_7ZIP_LARGE_PAGES -DUNICODE -D_UNICODE ) -target_compile_options(7zip - PRIVATE - /wd5043 - $<$:/guard:cf> -) - target_include_directories(7zip INTERFACE $/7zip/CPP @@ -359,7 +382,7 @@ set(PUBLIC_HEADERS install( TARGETS 7zip - EXPORT 7zip + EXPORT 7zip-targets ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -376,9 +399,7 @@ foreach(HEADER ${PUBLIC_HEADERS}) endforeach() install( - EXPORT 7zip + EXPORT 7zip-targets DESTINATION share/7zip - FILE 7zipConfig.cmake NAMESPACE 7zip:: - CONFIGURATIONS Release ) diff --git a/ports/7zip/License.txt b/ports/7zip/License.txt deleted file mode 100644 index e9113842ce..0000000000 --- a/ports/7zip/License.txt +++ /dev/null @@ -1,90 +0,0 @@ - 7-Zip source code - ~~~~~~~~~~~~~~~~~ - License for use and distribution - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - 7-Zip Copyright (C) 1999-2019 Igor Pavlov. - - The licenses for files are: - - 1) CPP/7zip/Compress/Rar* files: the "GNU LGPL" with "unRAR license restriction" - 2) CPP/7zip/Compress/LzfseDecoder.cpp: the "BSD 3-clause License" - 3) Some files are "public domain" files, if "public domain" status is stated in source file. - 4) the "GNU LGPL" for all other files. If there is no license information in - some source file, that file is under the "GNU LGPL". - - The "GNU LGPL" with "unRAR license restriction" means that you must follow both - "GNU LGPL" rules and "unRAR license restriction" rules. - - - - - GNU LGPL information - -------------------- - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - - - BSD 3-clause License - -------------------- - - The "BSD 3-clause License" is used for the code in LzfseDecoder.cpp that implements LZFSE data decompression. - That code was derived from the code in the "LZFSE compression library" developed by Apple Inc, - that also uses the "BSD 3-clause License": - - ---- - Copyright (c) 2015-2016, Apple Inc. All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - - - - - unRAR license restriction - ------------------------- - - The decompression engine for RAR archives was developed using source - code of unRAR program. - All copyrights to original unRAR code are owned by Alexander Roshal. - - The license for original unRAR code has the following restriction: - - The unRAR sources 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. - - - -- - Igor Pavlov diff --git a/ports/7zip/portfile.cmake b/ports/7zip/portfile.cmake index 4d88583b95..2e6287f359 100644 --- a/ports/7zip/portfile.cmake +++ b/ports/7zip/portfile.cmake @@ -1,8 +1,8 @@ -set(7ZIP_VERSION 19.00) +set(7ZIP_VERSION 21.07) vcpkg_download_distfile(ARCHIVE - URLS "https://www.7-zip.org/a/7z1900-src.7z" - FILENAME "7z1900-src.7z" - SHA512 d68b308e175224770adc8b1495f1ba3cf3e7f67168a7355000643d3d32560ae01aa34266f0002395181ed91fb5e682b86e0f79c20625b42d6e2c62dd24a5df93 + URLS "https://www.7-zip.org/a/7z2107-src.7z" + FILENAME "7z2107-src.7z" + SHA512 c13521a9829ac239a89015e1f5da27eeaa2469754e3f8ca32311d964ea9d0b40a17e4f8ccbd425d3e865aa768be345368f1c36f354d5710ac7cb2749dd6a3ab5 ) vcpkg_extract_source_archive_ex( @@ -14,17 +14,17 @@ vcpkg_extract_source_archive_ex( 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}" ) -vcpkg_install_cmake() - +vcpkg_cmake_install() vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup() + file( - INSTALL ${CMAKE_CURRENT_LIST_DIR}/License.txt - DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} + INSTALL "${SOURCE_PATH}/DOC/License.txt" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright ) diff --git a/ports/7zip/vcpkg.json b/ports/7zip/vcpkg.json index e0f7bb59ae..1736264839 100644 --- a/ports/7zip/vcpkg.json +++ b/ports/7zip/vcpkg.json @@ -1,8 +1,18 @@ { "name": "7zip", - "version-string": "19.00", - "port-version": 4, + "version-string": "21.07", "description": "Library for archiving file with a high compression ratio.", "homepage": "https://www.7-zip.org", - "supports": "!(linux | osx | arm | uwp)" + "license": "LGPL-2.1-or-later", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/7-/7zip.json b/versions/7-/7zip.json index 6701c1367c..84f6ceafbd 100644 --- a/versions/7-/7zip.json +++ b/versions/7-/7zip.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "7a951689070e40d8ff0ed20b4e18bc533ef5db1f", + "version-string": "21.07", + "port-version": 0 + }, { "git-tree": "54b143613df50187b48517d63796569641c4eee7", "version-string": "19.00", diff --git a/versions/baseline.json b/versions/baseline.json index 548eb689bf..9eee1d13bb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5,8 +5,8 @@ "port-version": 2 }, "7zip": { - "baseline": "19.00", - "port-version": 4 + "baseline": "21.07", + "port-version": 0 }, "abseil": { "baseline": "20211102.1",