| 1 | # Builds the macOS artifacts (nodejs binaries). |
| 2 | # Usage: ./ci/build_macos_artifacts_nodejs.sh [target] |
| 3 | # Targets supported: x86_64-apple-darwin aarch64-apple-darwin |
| 4 | set -e |
| 5 | |
| 6 | prebuild_rust() { |
| 7 | # Building here for the sake of easier debugging. |
| 8 | pushd rust/lancedb |
| 9 | echo "Building rust library for $1" |
| 10 | export RUST_BACKTRACE=1 |
| 11 | cargo build --release --target $1 |
| 12 | popd |
| 13 | } |
| 14 | |
| 15 | build_node_binaries() { |
| 16 | pushd nodejs |
| 17 | echo "Building nodejs library for $1" |
| 18 | export RUST_TARGET=$1 |
| 19 | npm run build-release |
| 20 | popd |
| 21 | } |
| 22 | |
| 23 | if [ -n "$1" ]; then |
| 24 | targets=$1 |
| 25 | else |
| 26 | targets="x86_64-apple-darwin aarch64-apple-darwin" |
| 27 | fi |
| 28 | |
| 29 | echo "Building artifacts for targets: $targets" |
| 30 | for target in $targets |
| 31 | do |
| 32 | prebuild_rust $target |
| 33 | build_node_binaries $target |
| 34 | done |