 #!/bin/bash

cd "$( dirname "${BASH_SOURCE[0]}" )"

lyrebird_branch=prod
lyrebird_commit=4a5f7ca25e13b5db78c2437efd409456ad8fb9c4

dnscryptproxy_branch=master
dnscryptproxy_commit=634168b3abe287b761d89df8ae3bab7c3d1539b4

snowflake_branch=feat/check-dns-ip
snowflake_commit=0bdc069f2e06fb9f61c040b02af3a65b1a40db38

libzmq_version=v4.3.5

conjure_branch=prod
conjure_commit=ed87f43293b54d8c510f4b56200c7168a24d263c

webtunnel_branch=prod
webtunnel_commit=738ccbd3d15c2144f8d4c5dbddbbde6a687ca104

tor_branch=prod
tor_commit=6076a44be860ff1654f2cdae6caccf0ec97acf68
tor_openssl_version=openssl-3.5.3
libevent_version=release-2.1.12-stable
zstd_version=v1.4.9
xz_version=v5.2.4

i2pd_version=2.58.0
i2pd_openssl_version=openssl-3.5.2
miniupnpc_version=miniupnpc_2_2_8

git clone --single-branch --branch $lyrebird_branch https://gitlab.torproject.org/Gedsh/lyrebird
pushd lyrebird/
git checkout -f $lyrebird_commit -b $lyrebird_commit
popd

git clone --single-branch --branch $dnscryptproxy_branch https://github.com/Gedsh/dnscrypt-proxy
pushd dnscrypt-proxy/
git checkout -f $dnscryptproxy_commit -b $dnscryptproxy_commit
popd


git clone --single-branch --branch $snowflake_branch https://gitlab.torproject.org/Gedsh/snowflake.git
pushd snowflake/
git checkout -f $snowflake_commit -b $snowflake_commit
popd

git clone --single-branch --branch $libzmq_version https://github.com/zeromq/libzmq

git clone --single-branch --branch $conjure_branch https://gitlab.torproject.org/Gedsh/conjure
pushd conjure/
git checkout -f $conjure_commit -b $conjure_commit
popd

git clone --single-branch --branch $webtunnel_branch https://gitlab.torproject.org/Gedsh/webtunnel
pushd webtunnel/
git checkout -f $webtunnel_commit -b $webtunnel_commit
popd

git clone https://github.com/Gedsh/Nflog-android

pushd ../../TorBuildScript/external/
git clone --single-branch --branch $tor_openssl_version https://github.com/openssl/openssl.git
git clone --single-branch --branch $libevent_version https://github.com/libevent/libevent.git
git clone --single-branch --branch $zstd_version https://github.com/facebook/zstd.git
git clone --single-branch --branch $xz_version https://git.tukaani.org/xz.git
git clone --single-branch --branch $tor_branch https://gitlab.torproject.org/Gedsh/tor.git
pushd tor/
git checkout -f $tor_commit -b $tor_commit
popd
popd

pushd ../../PurpleI2PBuildScript/external/
mkdir -p libs
pushd libs/
git clone --single-branch --branch $i2pd_openssl_version https://github.com/openssl/openssl.git
git clone https://github.com/moritz-wundke/Boost-for-Android.git
git clone https://github.com/miniupnp/miniupnp.git
pushd miniupnp/
git checkout -f $miniupnpc_version -b $miniupnpc_version
popd
git clone https://github.com/PurpleI2P/android-ifaddrs.git
popd
git clone https://github.com/PurpleI2P/i2pd.git
pushd i2pd/
git checkout -f $i2pd_version -b $i2pd_version
popd
popd
