Repository navigation
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
Changes from 6 commits
a63aaa9
a0dbb9b
649b03f
c77c662
87b973e
c99c31e
61cb255
75a28fc
d2ceaf5
0bb4e39
49e8759
a1f0a0c
3995742
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,47 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Exit on error | ||
| set -euo pipefail | ||
|
|
||
|
sitaowang1998 marked this conversation as resolved.
Resolved
|
||
| 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 | ||
|
Comment on lines
+24
to
+25
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. 🛠️ Refactor suggestion Race-safe temporary directory A fixed -temp_dir=/tmp/${package_name}-installation
-mkdir -p $temp_dir
+temp_dir=$(mktemp -d /tmp/${package_name}-installation-XXXXXX)🤖 Prompt for AI Agents |
||
|
|
||
| # 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 | ||
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.
Previously we discussed whether
CMAKE_POSITION_INDEPENDENT_CODEandCMAKE_POLICY_DEFAULT_CMP0144. Iirc it wasn't clear they were necessary.I remember I couldn't reproduce needing
CMAKE_POLICY_DEFAULT_CMP0144and iirc I don't think you could either.If they are necessary the reasons need to be documented in the description.
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.
PIC is required because
Spiderproduces a shared library.CMP0144is removed.