#!/bin/bash

set -e

git submodule init
git submodule update

# configure fails with autoconf 2.71, so downgrade
# see https://github.com/asdf-vm/asdf-erlang/issues/195
brew install autoconf@2.69 && \
brew link --overwrite autoconf@2.69 && \
autoconf -V

curl -L -o libdeflate-v1.8.tar.gz https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz
tar xzf libdeflate-v1.8.tar.gz
cd libdeflate-1.8
make
make install
cd ..

cd htslib
autoheader
autoconf
./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2
make
