-
Notifications
You must be signed in to change notification settings - Fork 83
build(deps): Migrate LibArchive dependency to task-based installation: #1122
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
280ba24
0f97d9b
0f686fd
88f1eed
2cacc5d
2597a21
3a53973
3ff8669
8a2407b
3233f2f
f61890b
e78c035
5fdbc12
cb47228
8f5d04d
5046d0d
e65b433
d54a1ea
2bb246b
515e400
a21c9ce
c6e03c0
bc61453
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,23 +12,14 @@ | |||||||||||||
| # - Variables only for use within the script are prefixed with "libarchive_" | ||||||||||||||
| # - Variables that should be externally visible are prefixed with "LibArchive_" | ||||||||||||||
|
|
||||||||||||||
| set(libarchive_LIBNAME "archive") | ||||||||||||||
|
|
||||||||||||||
| include(cmake/Modules/FindLibraryDependencies.cmake) | ||||||||||||||
|
|
||||||||||||||
| # On macOS, libarchive installed through brew is not linked into prefix by default. | ||||||||||||||
| # So it cannot be found by pkg-config and we need to manually find it. | ||||||||||||||
| # For more details, see https://github.com/Homebrew/homebrew-core/issues/117642 | ||||||||||||||
| # Find and setup libarchive | ||||||||||||||
| if(APPLE) | ||||||||||||||
| execute_process(COMMAND brew --prefix libarchive OUTPUT_VARIABLE libarchive_MACOS_PREFIX) | ||||||||||||||
| string(STRIP "${libarchive_MACOS_PREFIX}" libarchive_MACOS_PREFIX) | ||||||||||||||
| set(ENV{libarchive_PREV_CMAKE_PATH} "$ENV{CMAKE_PREFIX_PATH}") # save it so we can revert it later | ||||||||||||||
| set(ENV{CMAKE_PREFIX_PATH} "${libarchive_MACOS_PREFIX};$ENV{CMAKE_PREFIX_PATH}") | ||||||||||||||
| endif() | ||||||||||||||
| set(libarchive_LIBNAME "archive") | ||||||||||||||
| set(libarchive_PKGCONFIG_DIR "${LibArchive_ROOT}/lib/pkgconfig") | ||||||||||||||
|
|
||||||||||||||
| # Run pkg-config | ||||||||||||||
| find_package(PkgConfig) | ||||||||||||||
| set(ENV{PKG_CONFIG_PATH} "${libarchive_PKGCONFIG_DIR};$ENV{PKG_CONFIG_PATH}") | ||||||||||||||
Bill-hbrhbr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| pkg_check_modules(libarchive_PKGCONF QUIET "lib${libarchive_LIBNAME}") | ||||||||||||||
|
|
||||||||||||||
| # Set include directory | ||||||||||||||
|
|
@@ -38,6 +29,7 @@ find_path(LibArchive_INCLUDE_DIR archive.h | |||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| # Handle static libraries | ||||||||||||||
| set(LibArchive_USE_STATIC_LIBS ON) | ||||||||||||||
Bill-hbrhbr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| if(LibArchive_USE_STATIC_LIBS) | ||||||||||||||
| # Save current value of CMAKE_FIND_LIBRARY_SUFFIXES | ||||||||||||||
| set(libarchive_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) | ||||||||||||||
|
|
@@ -52,7 +44,7 @@ find_library(LibArchive_LIBRARY | |||||||||||||
| HINTS ${libarchive_PKGCONF_LIBDIR} | ||||||||||||||
| PATH_SUFFIXES lib | ||||||||||||||
| ) | ||||||||||||||
| if (LibArchive_LIBRARY) | ||||||||||||||
| if(LibArchive_LIBRARY) | ||||||||||||||
| # NOTE: This must be set for find_package_handle_standard_args to work | ||||||||||||||
| set(LibArchive_FOUND ON) | ||||||||||||||
| endif() | ||||||||||||||
Bill-hbrhbr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
|
|
@@ -64,10 +56,16 @@ if(LibArchive_USE_STATIC_LIBS) | |||||||||||||
| # Restore original value of CMAKE_FIND_LIBRARY_SUFFIXES | ||||||||||||||
| set(CMAKE_FIND_LIBRARY_SUFFIXES ${libarchive_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) | ||||||||||||||
| unset(libarchive_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) | ||||||||||||||
| else() | ||||||||||||||
| set(libarchive_DYNAMIC_LIBS "${libarchive_PKGCONF_STATIC_LIBRARIES}") | ||||||||||||||
| endif() | ||||||||||||||
|
||||||||||||||
| else() | |
| set(libarchive_DYNAMIC_LIBS "${libarchive_PKGCONF_STATIC_LIBRARIES}") | |
| endif() | |
| else() | |
| set(libarchive_DYNAMIC_LIBS "${libarchive_PKGCONF_LIBRARIES}") | |
| endif() |
🤖 Prompt for AI Agents
In components/core/cmake/Modules/FindLibArchive.cmake around lines 59 to 61, the
variable libarchive_DYNAMIC_LIBS is incorrectly assigned the static libraries
from libarchive_PKGCONF_STATIC_LIBRARIES. To fix this, change the assignment so
that libarchive_DYNAMIC_LIBS is set to the regular libraries from pkg-config,
not the static ones, ensuring the correct libraries are used when not building
statically.
Bill-hbrhbr marked this conversation as resolved.
Show resolved
Hide resolved
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,6 @@ brew install \ | |
| coreutils \ | ||
| gcc \ | ||
| java11 \ | ||
| libarchive \ | ||
| llvm@16 \ | ||
| lz4 \ | ||
| mariadb-connector-c \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ set -eu | |
| set -o pipefail | ||
|
|
||
| dnf install -y \ | ||
| bzip2-devel \ | ||
| gcc-c++ \ | ||
| java-11-openjdk \ | ||
| jq \ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.