#!/bin/sh

source ./VERSIONS

mkdir -p checkout
cd checkout


echo "Downloading RDKit source"
curl -L https://github.com/rdkit/rdkit/archive/refs/tags/$rdkit_release.tar.gz -o "$rdkit_release.tar.gz"
echo


echo "Downloading graphene source"
curl -L https://github.com/ebassi/graphene/archive/refs/tags/$graphene_release.tar.gz -o graphene_$graphene_release.tar.gz
echo


echo "Downloading libsigc++ source"
curl -L https://github.com/libsigcplusplus/libsigcplusplus/archive/refs/tags/$libsigcpp_release.tar.gz -o libsigcplusplus_$libsigcpp_release.tar.gz
echo

echo "Unpacking RDKit source"
tar xf "$rdkit_release.tar.gz"
echo

echo "Unpacking libsigc++ source"
tar xf "libsigcplusplus_$libsigcpp_release.tar.gz"
echo

echo "Unpacking graphene source"
tar xf "graphene_$graphene_release.tar.gz"
echo

# #Get RDKit
# echo "Downloading RDKit_minimal js/wasm"
# echo
# curl -L https://unpkg.com/@rdkit/rdkit/Code/MinimalLib/dist/RDKit_minimal.wasm -o web_example/RDKit_minimal.wasm
# curl -L https://unpkg.com/@rdkit/rdkit/Code/MinimalLib/dist/RDKit_minimal.js -o web_example/RDKit_minimal.js

echo "Checking out boost"
curl -L https://github.com/boostorg/boost/releases/download/boost-$boost_release/boost-$boost_release.tar.gz  -o boost_$boost_release.tar.gz
tar xf boost_$boost_release.tar.gz

ln -s boost-$boost_release boost
ln -s "rdkit-$rdkit_release" rdkit


patch -p0 < ../patches/boost-emscripten.patch

cd ..



