-
Notifications
You must be signed in to change notification settings - Fork 89
build: Add --nix flag to build rust in nix-shell
#143
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
Conversation
#### Problem Recreation of anza-xyz#139. More information at anza-xyz/platform-tools#109, but Rust is currently built with a few additional shared libraries. #### Summary of changes Add a `--nix` flag to build.sh to optionally build with nix-shell.
| ./x.py build --stage 1 --target ${HOST_TRIPLE},sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana | ||
|
|
||
| if [ -n "${WITH_NIX}" ]; then | ||
| nix-shell src/tools/nix-dev-shell/shell.nix --pure --run "x build --stage 1 --target sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana" |
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.
Shouldn't this be x.py?
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.
nope! x is also a rust binary just for building in the nix environment: https://github.com/anza-xyz/rust/blob/solana-1.89.0/src/tools/nix-dev-shell/x/x.rs
build.sh
Outdated
| case "$1" in | ||
| --nix) | ||
| WITH_NIX=1 | ||
| shift | ||
| ;; | ||
| --llvm) | ||
| REBUILD_LLVM=1 | ||
| shift | ||
| ;; | ||
| --help) | ||
| echo "--llvm to rebuild llvm, --nix to use nix"; | ||
| exit; | ||
| esac |
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.
This means --nix and --llvm can't be used together. I don't think this is much of a hassle, so if you are OK with that, we can merge as it is.
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.
Oops sorry, you're right, wrapped this in a while loop!
Problem
Recreation of #139.
More information at anza-xyz/platform-tools#109, but Rust is currently built with a few additional shared libraries.
Summary of changes
Add a
--nixflag to build.sh to optionally build with nix-shell.