|
4 | 4 | NARGO_HOME=${NARGO_HOME-"$HOME/.nargo"}
|
5 | 5 | NARGO_BIN_DIR="$NARGO_HOME/bin"
|
6 | 6 |
|
| 7 | +BINARIES=("nargo" "noir-profiler" "noir-inspector") |
| 8 | + |
7 | 9 | main() {
|
8 | 10 | need_cmd git
|
9 | 11 | need_cmd curl
|
@@ -62,10 +64,19 @@ main() {
|
62 | 64 | RUSTFLAGS="-C target-cpu=native" ensure cargo build --release $FEATURES # need 4 speed
|
63 | 65 |
|
64 | 66 | # Remove prior installations if they exist
|
65 |
| - rm -f "$NARGO_BIN_DIR/nargo" |
| 67 | + for bin in "${BINARIES[@]}"; do |
| 68 | + rm -f "$NARGO_BIN_DIR/$bin" |
| 69 | + done |
66 | 70 |
|
67 |
| - # Move the binary into the `nargo/bin` directory |
68 |
| - ensure mv "$PWD/target/release/nargo" "$NARGO_BIN_DIR/nargo" |
| 71 | + # Move binaries into the `.nargo/bin` directory |
| 72 | + for bin in "${BINARIES[@]}"; do |
| 73 | + # Move the binary only if it exists. |
| 74 | + # This ensures compatibility with older versions of Noir, |
| 75 | + # which may not include all binaries listed. |
| 76 | + if [ -f "$PWD/target/release/$bin" ]; then |
| 77 | + ensure mv "$PWD/target/release/$bin" "$NARGO_BIN_DIR/$bin" |
| 78 | + fi |
| 79 | + done |
69 | 80 |
|
70 | 81 | say "done"
|
71 | 82 | exit 0
|
@@ -121,14 +132,22 @@ main() {
|
121 | 132 | NOIRUP_TAG="${NOIRUP_VERSION}"
|
122 | 133 | fi
|
123 | 134 |
|
124 |
| - say "installing nargo (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})" |
| 135 | + say "installing Noir binaries (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})" |
125 | 136 |
|
126 | 137 | RELEASE_URL="https://github.com/${NOIRUP_REPO}/releases/download/${NOIRUP_TAG}"
|
127 | 138 | fi
|
128 |
| - BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz" |
| 139 | + # Current name for the binary tarball created by Noir. |
| 140 | + BIN_TARBALL_URL="${RELEASE_URL}/noir-${ARCHITECTURE}-${PLATFORM}.tar.gz" |
| 141 | + |
| 142 | + # Legacy naming uses the `nargo-` for when noir-lang/noir used to only release a single nargo binary |
| 143 | + # Use the legacy naming if `noir-` does not exist |
| 144 | + # Force curl to follow redirects with `-L` |
| 145 | + if ! curl -L --head --fail --silent "$BIN_TARBALL_URL" >/dev/null 2>&1; then |
| 146 | + BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz" |
| 147 | + fi |
129 | 148 |
|
130 | 149 | # Download the binaries tarball and unpack it into the .nargo bin directory.
|
131 |
| - say "downloading latest nargo to '$NARGO_BIN_DIR'" |
| 150 | + say "downloading latest Noir binaries to '$NARGO_BIN_DIR'" |
132 | 151 | ensure curl -# -L $BIN_TARBALL_URL | tar -xzC $NARGO_BIN_DIR
|
133 | 152 |
|
134 | 153 | # Prior to v0.3.0, Nargo and the std lib were distributed separated.
|
@@ -163,12 +182,22 @@ main() {
|
163 | 182 |
|
164 | 183 | RUSTFLAGS="-C target-cpu=native" ensure cargo build --release $FEATURES
|
165 | 184 |
|
166 |
| - # Remove prior installations if they exist |
167 |
| - rm -f "$NARGO_BIN_DIR/nargo" |
168 | 185 |
|
169 |
| - # Move the binary into the `nargo/bin` directory |
170 |
| - ensure mv "$PWD/target/release/nargo" "$NARGO_BIN_DIR/nargo" |
| 186 | + # Remove prior installations if they exist |
| 187 | + for bin in "${BINARIES[@]}"; do |
| 188 | + rm -f "$NARGO_BIN_DIR/$bin" |
| 189 | + done |
171 | 190 |
|
| 191 | + # Move binaries into the `.nargo/bin` directory |
| 192 | + for bin in "${BINARIES[@]}"; do |
| 193 | + # Move the binary only if it exists. |
| 194 | + # This ensures compatibility with older versions of Noir, |
| 195 | + # which may not include all binaries listed. |
| 196 | + if [ -f "$PWD/target/release/$bin" ]; then |
| 197 | + ensure mv "$PWD/target/release/$bin" "$NARGO_BIN_DIR/$bin" |
| 198 | + fi |
| 199 | + done |
| 200 | + |
172 | 201 | fi
|
173 | 202 |
|
174 | 203 | if [[ $(which nargo) =~ "cargo" ]]; then
|
|
0 commit comments