Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@

set -ex

if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "--llvm to rebuild llvm";
exit;
fi
WITH_NIX=
REBUILD_LLVM=
while [ -n "$1" ]; do
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
done

unameOut="$(uname -s)-$(uname -m)"
case "${unameOut}" in
Expand All @@ -21,7 +34,12 @@ case "${unameOut}" in
*) HOST_TRIPLE=x86_64-unknown-linux-gnu
esac

if [ "$1" == "--llvm" ]; then
if [ -n "${REBUILD_LLVM}" ]; then
rm -f build/${HOST_TRIPLE}/llvm/llvm-finished-building;
fi
./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"
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

else
./x.py build --stage 1 --target sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana
fi
Loading