Skip to content
Snippets Groups Projects
Commit 838adb4d authored by cyberta's avatar cyberta
Browse files

add build script that helps to speed up development

parent cba80662
No related branches found
No related tags found
1 merge request!10Update obfsvpn
#!/bin/bash
# This script is meant to be used during development of any component related to bitmaskcore
# Make sure you have run build_core.sh at least once before using this script, so that
# golang dev environment is correctly setup, all patches have been applied to the submodules etc.
# This script only builds the different go submodules together as they are currently checked out.
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
......@@ -13,65 +18,9 @@ function showtitle {
echo -e "\n\n${GREEN}--- $1 ...${NC}\n"
}
# -------- install golang ---------------
showtitle "Installing golang"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
GO_VERSION=go1.19.8.linux-amd64
EXPECTED_FP=e1a0bf0ab18c8218805a1003fd702a41e2e807710b770e787e5979d1cf947aba
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
ARCH=`uname -a | rev | cut -d " " -f 1 | rev`
if [[ "$ARCH" = "x86_64" ]]; then
GO_VERSION=go1.19.8.darwin-amd64
EXPECTED_FP=d63e12909b3639df24f2614284868869ce14fdea2059ed365752da82ca59f994
else
GO_VERSION=go1.19.8.darwin-arm64
EXPECTED_FP=12df6263329794c55b1d63160cda9dd62de4ecd65fe52ddca33bc96a57c38ea6
fi
else
echo "$OSTYPE is currently not supported."
exit 1
fi
if [[ $(ls -A ${GO_VERSION}.tar.gz) ]]
then
echo "Reusing downloaded golang bundle"
else
echo "Installing go lang bundle ${GO_VERSION}.tar.gz from https://golang.org/dl/$GO_VERSION.tar.gz"
curl -L -o "${GO_VERSION}.tar.gz" "https://golang.org/dl/${GO_VERSION}.tar.gz"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ACTUAL_FP=`sha256sum $GO_VERSION.tar.gz | cut -d " " -f1`
else
ACTUAL_FP=`shasum -a 256 $GO_VERSION.tar.gz | cut -d " " -f1`
fi
if [[ ! $ACTUAL_FP == $EXPECTED_FP ]]
then
quit "Download seems to be corrupted. Cancelling build."
fi
fi
if [[ -d ./golang ]]
then
if [[ $(ls -A ./golang/*) ]]
then
rm -r ./golang/*
fi
else
mkdir ./golang
fi
tar -C ./golang -xzf $GO_VERSION.tar.gz || quit "Could not untar $GO_VERSION.tar.gz"
# -------- update submodules ---------------
showtitle "Updating submodules"
# git submodule sync --recursive || quit "git submodule sync --recursive"
# git submodule update --init --recursive || quit "git submodule update --init --recursive"
# -------- init environment variables ---------------
showtitle "Initializing go environment"
cd ./golang
export GOPATH=`pwd`
export GO_LANG=`pwd`/go/bin
......@@ -82,40 +31,6 @@ go env -w GOFLAGS=-mod=mod
go env
cd ..
# -------- init gomobile ---------------
showtitle "Getting gomobile"
#./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile || quit "./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile"
showtitle "initiating gomobile"
#./golang/bin/gomobile init || quit "./golang/bin/gomobile init"
# -------- prepare snowflake ---------------
showtitle "Checking out snowflake repository"
cd ./IPtProxy/snowflake
git checkout --force --quiet 36f03dfd4483922b3e7400dedc71df9cf2f30b6b || quit "Failed to checkout snowflake at commit 36f03dfd4483922b3e7400dedc71df9cf2f30b6b"
git submodule update --init --recursive || quit "Failed to update snowflake submodules"
cd ..
showtitle "Applying patches to snowflake"
patch --directory=snowflake --strip=1 < snowflake.patch || quit
cd ..
showtitle "Applying patch to IPtProxy"
patch --directory=IPtProxy --strip=1 < iptproxy.patch || quit
# -------- preparing obfsvpn ---------------
showtitle "Applying patch to obfsvpn"
patch --directory=obfsvpn --strip=1 < obfsvpn.patch || quit
# -------- preparing shapeshifter ---------------
showtitle "Applying patch to shapeshifter"
patch --directory=shapeshifter --strip=1 < shapeshifter.patch || quit
# -------- preparing motd ---------------
showtitle "Applying patch to motd (message of the day)"
patch --directory=motd --strip=1 < motd.patch || quit
# -------- build core ---------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment