@@ -16,6 +16,7 @@ main() {
1616 -r|--repo) shift ; NOIRUP_REPO=$1 ;;
1717 -b|--branch) shift ; NOIRUP_BRANCH=$1 ;;
1818 -v|--version) shift ; NOIRUP_VERSION=$1 ;;
19+ -f|--features) shift ; NOIRUP_FEATURES=$1 ;;
1920 -p|--path) shift ; NOIRUP_LOCAL_REPO=$1 ;;
2021 -P|--pr) shift ; NOIRUP_PR=$1 ;;
2122 -C|--commit) shift ; NOIRUP_COMMIT=$1 ;;
@@ -28,6 +29,16 @@ main() {
2829 esac ; shift
2930 done
3031
32+ # Input string is a space delimited list of features
33+ # Build a string of feature flags to pass to cargo
34+ FEATURES=" "
35+ if [ -n " $NOIRUP_FEATURES " ]; then
36+ # "aztec bn254" -> "--features aztec --features bn254"
37+ for feature in $NOIRUP_FEATURES ; do
38+ FEATURES+=" --features $feature "
39+ done
40+ fi
41+
3142 if [ -n " $NOIRUP_PR " ]; then
3243 if [ -z " $NOIRUP_BRANCH " ]; then
3344 NOIRUP_BRANCH=" refs/pull/$NOIRUP_PR /head"
@@ -48,7 +59,7 @@ main() {
4859 # Enter local repo and build
4960 say " installing from $NOIRUP_LOCAL_REPO "
5061 cd $NOIRUP_LOCAL_REPO
51- RUSTFLAGS=" -C target-cpu=native" ensure cargo build --release # need 4 speed
62+ RUSTFLAGS=" -C target-cpu=native" ensure cargo build --release $FEATURES # need 4 speed
5263
5364 # Remove prior installations if they exist
5465 rm -f " $NARGO_BIN_DIR /nargo"
@@ -60,6 +71,10 @@ main() {
6071 exit 0
6172 fi
6273
74+ if [ -n " ${NOIRUP_FEATURES} " ]; then
75+ echo " Warning: [-f | --features] flag has no effect when installing a prebuilt binary"
76+ fi
77+
6378 NOIRUP_REPO=${NOIRUP_REPO-noir-lang/ noir}
6479 if [[ " $NOIRUP_REPO " == " noir-lang/noir" && -z " $NOIRUP_BRANCH " && -z " $NOIRUP_COMMIT " ]]; then
6580 PLATFORM=" $( uname -s) "
@@ -146,7 +161,7 @@ main() {
146161 ensure git checkout ${NOIRUP_COMMIT}
147162 fi
148163
149- RUSTFLAGS=" -C target-cpu=native" ensure cargo build --release
164+ RUSTFLAGS=" -C target-cpu=native" ensure cargo build --release $FEATURES
150165
151166 # Remove prior installations if they exist
152167 rm -f " $NARGO_BIN_DIR /nargo"
@@ -177,6 +192,7 @@ OPTIONS:
177192 -C, --commit Install a specific commit
178193 -r, --repo Install from a remote GitHub repo (uses default branch if no other options are set)
179194 -p, --path Install a local repository
195+ -f, --features Activates feature flags when building from source: "feature1 feature2"
180196EOF
181197}
182198
0 commit comments