-
Notifications
You must be signed in to change notification settings - Fork 83
build(deps): Migrate BZip2 dependency to task-based installation. #1124
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
Open
Bill-hbrhbr
wants to merge
14
commits into
y-scope:main
Choose a base branch
from
Bill-hbrhbr:install-bzip2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3b0ac08
Add Bzip2 installation
Bill-hbrhbr 5c71bd9
Remove BZip2 prebuilt install from musllinux
Bill-hbrhbr 82c71c4
Add missing $
Bill-hbrhbr ead48b3
Add docstring
Bill-hbrhbr f550905
Address coderabbit ai comments
Bill-hbrhbr b3e618b
Merge branch 'main' into install-bzip2
Bill-hbrhbr 25353ed
Add components-core doc for BZip2 and specify correct version
Bill-hbrhbr 1602fbd
Build Bzip2 v1.0.8 using custom make commands
Bill-hbrhbr 3ecd4f1
Polish find module
Bill-hbrhbr 33200e7
Manually supply pkgconfig hints in the absense of pc file
Bill-hbrhbr 7c54e00
Update components/core/cmake/Modules/FindBZip2.cmake
Bill-hbrhbr a43eb9c
Update docs/src/dev-guide/components-core/index.md
Bill-hbrhbr b448f16
Update components/core/CMakeLists.txt
Bill-hbrhbr 444cc79
revert hints because it changes find_package mode
Bill-hbrhbr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # Try to find BZip2 | ||
| # NOTE: The FindBZip2.cmake included with CMake has no support for static libraries, so we use our | ||
| # own. | ||
| # | ||
| # Set BZip2_USE_STATIC_LIBS=ON to look for static libraries. | ||
| # | ||
| # Once done this will define: | ||
| # BZip2_FOUND - Whether BZip2 was found on the system | ||
| # BZip2_INCLUDE_DIR - The BZip2 include directories | ||
| # BZip2_VERSION - The version of BZip2 installed on the system | ||
| # | ||
| # Conventions: | ||
| # - Variables only for use within the script are prefixed with "bzip2_" | ||
| # - Variables that should be externally visible are prefixed with "BZip2_" | ||
|
|
||
| include(cmake/Modules/FindLibraryDependencies.cmake) | ||
|
|
||
| set(bzip2_LIBNAME "bz2") | ||
| set(bzip2_LOCAL_PREFIX "bzip2") | ||
| set(bzip2_PKGCONFIG_NAME "bzip2") | ||
|
|
||
| if(DEFINED BZip2_ROOT) | ||
| set(bzip2_PKGCONFIG_DIR "${BZip2_ROOT}/lib/pkgconfig") | ||
| set(ENV{bzip2_ORIG_PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}") | ||
| set(ENV{PKG_CONFIG_PATH} "${bzip2_PKGCONFIG_DIR};$ENV{PKG_CONFIG_PATH}") | ||
| endif() | ||
|
|
||
| # Run pkg-config | ||
| find_package(PkgConfig) | ||
| pkg_check_modules(bzip2_PKGCONF QUIET "${bzip2_PKGCONFIG_NAME}") | ||
|
|
||
| # Set include directory | ||
| find_path(BZip2_INCLUDE_DIR bzlib.h | ||
| HINTS ${bzip2_PKGCONF_INCLUDEDIR} | ||
| PATH_SUFFIXES include | ||
| ) | ||
|
|
||
| # Handle static libraries | ||
| if(BZip2_USE_STATIC_LIBS) | ||
| set(bzip2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) | ||
| set(CMAKE_FIND_LIBRARY_SUFFIXES .a) | ||
| endif() | ||
|
|
||
| # Find library | ||
| find_library(BZip2_LIBRARY | ||
| NAMES "${bzip2_LIBNAME}" | ||
| HINTS ${bzip2_PKGCONF_LIBDIR} | ||
| PATH_SUFFIXES lib | ||
| ) | ||
|
|
||
| if(BZip2_USE_STATIC_LIBS) | ||
| FindStaticLibraryDependencies(${bzip2_LIBNAME} ${bzip2_LOCAL_PREFIX} | ||
| "${bzip2_PKGCONF_STATIC_LIBRARIES}") | ||
|
|
||
| # Restore original value of CMAKE_FIND_LIBRARY_SUFFIXES | ||
| set(CMAKE_FIND_LIBRARY_SUFFIXES ${bzip2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) | ||
| unset(bzip2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) | ||
| endif() | ||
|
|
||
| FindDynamicLibraryDependencies(${bzip2_LOCAL_PREFIX} "${bzip2_DYNAMIC_LIBS}") | ||
Bill-hbrhbr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Set version | ||
| set(BZip2_VERSION ${bzip2_PKGCONF_VERSION}) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(BZip2 | ||
| REQUIRED_VARS BZip2_LIBRARY BZip2_INCLUDE_DIR | ||
| VERSION_VAR BZip2_VERSION | ||
| ) | ||
|
|
||
| if(NOT TARGET BZip2::BZip2) | ||
| # Add library to build | ||
| if (BZip2_FOUND) | ||
| if (BZip2_USE_STATIC_LIBS) | ||
| add_library(BZip2::BZip2 STATIC IMPORTED) | ||
| else() | ||
| # NOTE: We use UNKNOWN so that if the user doesn't have the SHARED | ||
| # libraries installed, we can still use the STATIC libraries | ||
| add_library(BZip2::BZip2 UNKNOWN IMPORTED) | ||
| endif() | ||
| endif() | ||
|
|
||
| # Set include directories for library | ||
| if(BZip2_INCLUDE_DIR) | ||
| set_target_properties(BZip2::BZip2 | ||
| PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${BZip2_INCLUDE_DIR}" | ||
| ) | ||
| endif() | ||
|
|
||
| # Set location of library | ||
| if(EXISTS "${BZip2_LIBRARY}") | ||
| set_target_properties(BZip2::BZip2 | ||
| PROPERTIES | ||
| IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
| IMPORTED_LOCATION "${BZip2_LIBRARY}" | ||
| ) | ||
|
|
||
| # Add component's dependencies for linking | ||
| if(BZip2_LIBRARY_DEPENDENCIES) | ||
| set_target_properties(BZip2::BZip2 | ||
| PROPERTIES | ||
| INTERFACE_LINK_LIBRARIES "${BZip2_LIBRARY_DEPENDENCIES}" | ||
| ) | ||
Bill-hbrhbr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| # Restore original value of PKG_CONFIG_PATH | ||
| if(DEFINED BZip2_ROOT) | ||
| set(ENV{PKG_CONFIG_PATH} "$ENV{bzip2_ORIG_PKG_CONFIG_PATH}") | ||
| unset(ENV{bzip2_ORIG_PKG_CONFIG_PATH}) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.