-
Notifications
You must be signed in to change notification settings - Fork 12
build!: Install ystdlib as a CMake package to avoid issues when projects use both Spider and ystdlib through add_subdirectory.
#160
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a63aaa9
Install ystdlib as package
sitaowang1998 a0dbb9b
Update ci to install later cmake; Update cmake min version
sitaowang1998 649b03f
Bug fix for ci script
sitaowang1998 c77c662
Fix file permission for install-cmake script
sitaowang1998 87b973e
Improve cmake install script based on code rabbit suggestions
sitaowang1998 c99c31e
Remove unnecessary check in cmake
sitaowang1998 61cb255
Merge branch 'main' into ystdlib_package
sitaowang1998 75a28fc
Remove cmake 0144 policy
sitaowang1998 d2ceaf5
Merge branch 'main' into ystdlib_package
sitaowang1998 0bb4e39
Update ystdlib to use latest yscope-dev-utils
sitaowang1998 49e8759
Merge branch 'main' into ystdlib_package
sitaowang1998 a1f0a0c
Merge branch 'main' into ystdlib_package
sitaowang1998 3995742
Merge branch 'main' into ystdlib_package
sitaowang1998 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
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,47 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Exit on error | ||
| set -euo pipefail | ||
|
|
||
| cUsage="Usage: ${BASH_SOURCE[0]} <version>" | ||
| if [ "$#" -lt 1 ] ; then | ||
| echo $cUsage | ||
| exit 1 | ||
| fi | ||
| version=$1 | ||
|
|
||
| echo "Checking for elevated privileges..." | ||
| if [ ${EUID:-$(id -u)} -ne 0 ] ; then | ||
| sudo echo "Script can elevate privileges." | ||
| fi | ||
|
|
||
| # Get number of cpu cores | ||
| num_cpus=$(nproc 2>/dev/null || grep -c ^processor /proc/cpuinfo) | ||
|
|
||
| package_name=cmake | ||
|
|
||
| # Create temp dir for installation | ||
| temp_dir=/tmp/${package_name}-installation | ||
| mkdir -p $temp_dir | ||
|
|
||
| # Clean up | ||
| trap 'rm -rf "$temp_dir"' EXIT | ||
|
|
||
| cd $temp_dir | ||
|
|
||
| # Download source | ||
| tar_filename=cmake-${version}.tar.gz | ||
| curl -fsSL https://github.com/Kitware/CMake/releases/download/v${version}/${tar_filename} -o ${tar_filename} | ||
| tar xzf ${tar_filename} | ||
| cd cmake-${version} | ||
|
Comment on lines
+33
to
+36
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. No integrity check on downloaded tarball Blindly piping an archive into the build chain is a supply-chain risk. Fetch the official SHA256 from the same release and validate: curl -fsSL -O https://github.com/Kitware/CMake/releases/download/v${version}/${tar_filename}.sha256
sha256sum -c ${tar_filename}.sha256🤖 Prompt for AI Agents |
||
|
|
||
| # Build | ||
| ./bootstrap | ||
| make -j${num_cpus} | ||
|
|
||
| # Install | ||
| if [ ${EUID:-$(id -u)} -ne 0 ] ; then | ||
| sudo make install | ||
| else | ||
| make install | ||
| fi | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Race-safe temporary directory
A fixed
/tmp/cmake-installationcan collide with parallel runs. Leveragemktemp:🤖 Prompt for AI Agents