-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[unarr] add new package #47734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[unarr] add new package #47734
Changes from 36 commits
fee9459
7fad868
405c5dd
2c29b62
418c4d5
3a5ff0c
69d3783
f25e1df
14a5e86
bbb5e00
644b684
9f551cf
1ac8661
674a889
ae2f8a4
5985abc
50579a6
25d897e
632e57d
cd9609c
d561314
ed81d8a
132151e
530c9b2
6e311a7
317e3ee
c31ce8f
83c5e2c
b7aff7b
3037d97
e7f370a
ba3ffd3
4f17244
2ddae2a
6fcc94f
c4e563b
900a80c
30294ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index f38b229..3d5c150 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -52,19 +52,6 @@ add_library( | ||
| # common/custalloc.c | ||
| common/stream.c | ||
| common/unarr.c | ||
| - lzmasdk/7zTypes.h | ||
| - lzmasdk/Compiler.h | ||
| - lzmasdk/CpuArch.h | ||
| - lzmasdk/Ppmd.h | ||
| - lzmasdk/Ppmd7.h | ||
| - lzmasdk/Ppmd8.h | ||
| - lzmasdk/Precomp.h | ||
| - lzmasdk/CpuArch.c | ||
| - lzmasdk/Ppmd7.c | ||
| - lzmasdk/Ppmd8.c | ||
| - lzmasdk/Ppmd7Dec.c | ||
| - lzmasdk/Ppmd7aDec.c | ||
| - lzmasdk/Ppmd8Dec.c | ||
| rar/lzss.h | ||
| rar/rar.h | ||
| rar/rarvm.h | ||
| @@ -102,6 +89,12 @@ target_include_directories( | ||
| if(BUILD_SHARED_LIBS) | ||
| target_compile_definitions(unarr PUBLIC UNARR_IS_SHARED_LIBRARY) | ||
| endif() | ||
| +# Debundle 7zip | ||
| +find_package(7zip CONFIG REQUIRED) | ||
| +target_link_libraries(unarr PRIVATE 7zip::7zip) | ||
| +# 7zip upstream does not supply a .pc file. Add it to Libs.private. | ||
| +set(PROJECT_LIBS_PRIVATE "${PROJECT_LIBS_PRIVATE} -l7zip") | ||
| +set(UNARR_DEPENDS_7zip "find_dependency(7zip CONFIG)") | ||
|
|
||
| if(USE_SYSTEM_BZ2) | ||
| find_package(BZip2) | ||
| @@ -115,7 +108,8 @@ if(BZIP2_FOUND) | ||
| endif() | ||
| target_compile_definitions(unarr PRIVATE -DHAVE_BZIP2) | ||
| # Bzip2 upstream does not supply a .pc file. Add it to Libs.private. | ||
| - set(PROJECT_LIBS_PRIVATE "-I${BZIP2_INCLUDE_DIRS} -l${BZIP2_LIBRARIES}") | ||
| + set(PROJECT_CFLAGS "${PROJECT_CFLAGS} -I${BZIP2_INCLUDE_DIRS}") | ||
| + set(PROJECT_LIBS_PRIVATE "${PROJECT_LIBS_PRIVATE} -l${BZIP2_LIBRARIES}") | ||
| set(UNARR_DEPENDS_BZip2 "find_dependency(BZip2)") | ||
| endif() | ||
|
|
||
| @@ -154,28 +148,6 @@ if(ZLIB_FOUND) | ||
| endif() | ||
|
|
||
| if(ENABLE_7Z) | ||
| - target_sources( | ||
| - unarr | ||
| - PRIVATE lzmasdk/7z.h | ||
| - lzmasdk/7zArcIn.c | ||
| - lzmasdk/7zBuf.h | ||
| - lzmasdk/7zBuf.c | ||
| - lzmasdk/7zDec.c | ||
| - lzmasdk/7zStream.c | ||
| - lzmasdk/7zWindows.h | ||
| - lzmasdk/Bcj2.h | ||
| - lzmasdk/Bcj2.c | ||
| - lzmasdk/Bra.c | ||
| - lzmasdk/Bra.h | ||
| - lzmasdk/Bra86.c | ||
| - lzmasdk/7zCrc.h | ||
| - lzmasdk/Delta.h | ||
| - lzmasdk/Delta.c | ||
| - lzmasdk/Lzma2Dec.h | ||
| - lzmasdk/Lzma2Dec.c) | ||
| - if(LIBLZMA_FOUND) # TODO: Replace 7z lzma with system lzma | ||
| - target_sources(unarr PRIVATE lzmasdk/LzmaDec.h lzmasdk/LzmaDec.c) | ||
| - endif() | ||
| target_compile_definitions(unarr PRIVATE -DHAVE_7Z -DZ7_PPMD_SUPPORT) | ||
| endif() | ||
|
|
||
| @@ -194,8 +166,7 @@ if(UNIX | ||
| -Werror-implicit-function-declaration | ||
| $<$<CONFIG:Release>:-fomit-frame-pointer> | ||
| $<$<C_COMPILER_ID:Clang,AppleClang>: | ||
| - -Wno-missing-field-initializers> | ||
| - -flto) | ||
| + -Wno-missing-field-initializers>) | ||
| if(BUILD_FUZZER) | ||
| target_compile_options(unarr PUBLIC "${sanitize_opts}") | ||
| target_compile_definitions( | ||
| @@ -218,7 +189,7 @@ if(UNIX | ||
|
|
||
| # Clang linker needs -flto too when doing lto | ||
| if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") | ||
| - set(linker_opts "${linker_opts} -flto") | ||
| + set(linker_opts "${linker_opts}") | ||
| endif() | ||
|
|
||
| set_target_properties(unarr PROPERTIES LINK_FLAGS "${linker_opts}") | ||
| diff --git a/_7z/_7z.h b/_7z/_7z.h | ||
| index 7f207e1..f488e42 100644 | ||
| --- a/_7z/_7z.h | ||
| +++ b/_7z/_7z.h | ||
| @@ -6,9 +6,9 @@ | ||
|
|
||
| #include "../common/unarr-imp.h" | ||
|
|
||
| -#include "../lzmasdk/7zTypes.h" | ||
| +#include <7zip/C/7zTypes.h> | ||
| #ifdef HAVE_7Z | ||
| -#include "../lzmasdk/7z.h" | ||
| +#include <7zip/C/7z.h> | ||
| #endif | ||
|
|
||
| typedef struct ar_archive_7z_s ar_archive_7z; | ||
| diff --git a/pkg-config.pc.cmake b/pkg-config.pc.cmake | ||
| index 9055aef..a8581e0 100644 | ||
| --- a/pkg-config.pc.cmake | ||
| +++ b/pkg-config.pc.cmake | ||
| @@ -5,7 +5,7 @@ libdir=@PROJECT_INSTALL_LIBDIR@ | ||
| Name: @PROJECT_NAME@ | ||
| Description: @PROJECT_DESCRIPTION@ | ||
| Version: @PROJECT_VERSION@ | ||
| -Cflags: -I${includedir} | ||
| +Cflags: -I${includedir}@PROJECT_CFLAGS@ | ||
| Requires.private: @PROJECT_REQUIRES_PRIVATE@ | ||
| Libs: -L${libdir} -l@PROJECT_NAME@ | ||
| Libs.private: @PROJECT_LIBS_PRIVATE@ | ||
| diff --git a/rar/rar.h b/rar/rar.h | ||
| index a0a420a..b522a33 100644 | ||
| --- a/rar/rar.h | ||
| +++ b/rar/rar.h | ||
| @@ -7,7 +7,7 @@ | ||
| #include "../common/unarr-imp.h" | ||
|
|
||
| #include "lzss.h" | ||
| -#include "../lzmasdk/Ppmd7.h" | ||
| +#include <7zip/C/Ppmd7.h> | ||
| #include <limits.h> | ||
|
|
||
| static inline size_t smin(size_t a, size_t b) { return a < b ? a : b; } | ||
| diff --git a/unarr-config.cmake.in b/unarr-config.cmake.in | ||
| index 1c95f9b..4d82965 100644 | ||
| --- a/unarr-config.cmake.in | ||
| +++ b/unarr-config.cmake.in | ||
| @@ -5,6 +5,7 @@ include(CMakeFindDependencyMacro) | ||
| @UNARR_DEPENDS_BZip2@ | ||
| @UNARR_DEPENDS_LibLZMA@ | ||
| @UNARR_DEPENDS_ZLIB@ | ||
| +@UNARR_DEPENDS_7zip@ | ||
|
|
||
| if (NOT TARGET unarr::unarr) | ||
| include("${CMAKE_CURRENT_LIST_DIR}/unarr-targets.cmake") | ||
| diff --git a/zip/zip.h b/zip/zip.h | ||
| index b2ba34c..23da8d8 100644 | ||
| --- a/zip/zip.h | ||
| +++ b/zip/zip.h | ||
| @@ -16,9 +16,9 @@ | ||
| #ifdef HAVE_LIBLZMA | ||
| #include <lzma.h> | ||
| #else | ||
| -#include "../lzmasdk/LzmaDec.h" | ||
| +#include <7zip/C/LzmaDec.h> | ||
| #endif | ||
| -#include "../lzmasdk/Ppmd8.h" | ||
| +#include <7zip/C/Ppmd8.h> | ||
|
|
||
| typedef struct ar_archive_zip_s ar_archive_zip; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| vcpkg_from_github( | ||
| OUT_SOURCE_PATH SOURCE_PATH | ||
| REPO selmf/unarr | ||
| REF "v${VERSION}" | ||
| SHA512 da170e0391fbe92e9b2474beb6be9a96c9f905e4e572235aa839cda3f6faf3cb99773eede34e1054138a4997bf68a18ee84f4df47add202355449634c0fd6d93 | ||
| HEAD_REF master | ||
| PATCHES | ||
| debundle-7zip.patch | ||
| ) | ||
|
|
||
| file(REMOVE_RECURSE "${SOURCE_PATH}/lzmasdk") | ||
|
|
||
| vcpkg_cmake_configure( | ||
| SOURCE_PATH "${SOURCE_PATH}" | ||
| OPTIONS | ||
| ${FEATURE_OPTIONS} | ||
| -DENABLE_7Z=ON | ||
| -DUSE_SYSTEM_BZ2=ON | ||
| -DUSE_SYSTEM_LZMA=ON | ||
| -DUSE_SYSTEM_ZLIB=ON | ||
| -DUSE_ZLIB_CRC=ON | ||
| -DBUILD_INTEGRATION_TESTS=OFF | ||
| -DBUILD_FUZZER=OFF | ||
| -DBUILD_UNIT_TESTS=OFF | ||
| ) | ||
|
|
||
| vcpkg_cmake_install() | ||
| vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/unarr") | ||
| vcpkg_fixup_pkgconfig() | ||
| vcpkg_copy_pdbs() | ||
|
|
||
| file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") | ||
| vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "unarr", | ||
| "version": "1.1.1", | ||
| "description": "A decompression library for rar, tar, zip and 7z archives.", | ||
| "homepage": "https://github.com/selmf/unarr", | ||
| "license": "LGPL-3.0-only", | ||
| "supports": "!(windows & !static)", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately:
excludes every triplet we have so this doesn't pass the 'tested on at least one official triplet' requirement we need to put in the curated registry. Did you intend
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it simply "SUPPORTS: NOT (WINDOWS & DYNAMIC)"?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intended to skip shared library builds for Windows OS, but keep everything else. Is it
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am an idiot, sorry :( |
||
| "dependencies": [ | ||
| "7zip", | ||
| "bzip2", | ||
| "liblzma", | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "host": true | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake-config", | ||
| "host": true | ||
| }, | ||
| "zlib" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
|
||
| vcpkg_find_acquire_program(PKGCONFIG) | ||
|
|
||
| vcpkg_cmake_configure( | ||
| SOURCE_PATH "${CURRENT_PORT_DIR}/project" | ||
| OPTIONS | ||
| "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" | ||
| ) | ||
| vcpkg_cmake_build() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cmake_minimum_required(VERSION 3.25.1) | ||
| project(unarr-test LANGUAGES C) | ||
| set(CMAKE_C_STANDARD 99) | ||
| set(CMAKE_C_STANDARD_REQUIRED ON) | ||
|
|
||
| find_package(unarr CONFIG REQUIRED) | ||
| add_executable(main main.c) | ||
| target_link_libraries(main PRIVATE unarr::unarr) | ||
|
|
||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(libunarr REQUIRED IMPORTED_TARGET libunarr) | ||
| add_executable(main2 main.c) | ||
| target_link_libraries(main2 PRIVATE PkgConfig::libunarr) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #include <unarr.h> | ||
| int main() | ||
| { | ||
| ar_stream *stream; | ||
| ar_archive *ar = ar_open_rar_archive(stream); | ||
| ar_close_archive(ar); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "name": "vcpkg-ci-unarr", | ||
| "version-string": "ci", | ||
| "description": "Validates unarr", | ||
| "dependencies": [ | ||
| "unarr", | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "host": true | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "versions": [ | ||
| { | ||
| "git-tree": "0471e6eda1bead3ec6f80fb0606aef263c0d4afc", | ||
| "version": "1.1.1", | ||
| "port-version": 0 | ||
| } | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.