# Copyright (c) 2020-present, UMD Database Group.
#
# This program is free software: you can use, redistribute, and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# or later ("AGPL"), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#!/usr/bin/env sh

set -e

brew tap messense/macos-cross-toolchains
# install aarch64-unknown-linux-musl toolchain
brew install aarch64-unknown-linux-musl

brew install zstd

export CC_aarch64_unknown_linux_musl=aarch64-unknown-linux-musl-gcc
export CXX_aarch64_unknown_linux_musl=aarch64-unknown-linux-musl-g++
export AR_aarch64_unknown_linux_musl=aarch64-unknown-linux-musl-ar
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-unknown-linux-musl-gcc

cargo +nightly build --target aarch64-unknown-linux-musl
