Just a script to build the obfs4proxy package for 4 android architectures.
![]() |
2 years ago | |
---|---|---|
README.md | 2 years ago |
git clone https://gitlab.com/yawning/obfs4.git
#docker is optional and you can run on virtually any distro with changing how to install packages #replace the first Android with the directory of your ANDROID_HOME
docker run -v $(pwd)/:/obfs4 -v /Android:/Android --network=host -it debian /bin/bash
#replace the ndk home with your own #make sure ndk directory exists
export ANDROID_NDK_HOME=/Android/Sdk/ndk/21.3.6528147
export ANDROID_HOME=/Android
apt-get update && apt-get install autotools-dev libsystemd-dev -y && apt-get install automake autogen autoconf libtool gettext-base systemd* -y && apt-get install autopoint git make pkg-config systemd build-essential -y && apt-get install automake libevent-dev libssl-dev zlib1g-dev libsystemd* -y && apt-get install gcc-arm-linux-gnueabihf -y && apt-get install golang -y && apt-get install python -y &&
cd obfs4
export ARCH=arm export TOOLCHAIN_DIR=$(pwd)/$ARCH
#building the ndk-toolchain using
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch ${ARCH} --api 21 --install-dir ${TOOLCHAIN_DIR}
#Then i needed to cross compile the golang std itself.
CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go install std
#Then build my own tool using.
CGO_ENABLED=1 CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go build -v -o obfs4proxy/obfs4proxy.${ARCH}.so ./obfs4proxy
export ARCH=arm64 export TOOLCHAIN_DIR=$(pwd)/$ARCH
#building the ndk-toolchain using
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch ${ARCH} --api 21 --install-dir ${TOOLCHAIN_DIR}
#Then i needed to cross compile the golang std itself.
CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go install std
#Then build my own tool using.
CGO_ENABLED=1 CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go build -v -o obfs4proxy/obfs4proxy.${ARCH}.so ./obfs4proxy
export ARCH=386 # this one has to be 386 because the build command doesn't know what x86 is export TOOLCHAIN_DIR=$(pwd)/$ARCH
#building the ndk-toolchain using
#this one has to be x86
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir ${TOOLCHAIN_DIR}
#Then i needed to cross compile the golang std itself.
CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go install std
#Then build my own tool using.
CGO_ENABLED=1 CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go build -v -o obfs4proxy/obfs4proxy.x86.so ./obfs4proxy
#this one has to be amd64 because the build command doesn't know what x86_64 is
export ARCH=amd64 export TOOLCHAIN_DIR=$(pwd)/$ARCH
#building the ndk-toolchain using
#this one has to be x86_64
$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir ${TOOLCHAIN_DIR}
#Then i needed to cross compile the golang std itself.
CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go install std
#Then build my own tool using.
CGO_ENABLED=1 CC=$TOOLCHAIN_DIR/bin/clang CXX=$TOOLCHAIN_DIR/bin/clang GOOS=android GOARCH=$ARCH go build -v -o obfs4proxy/obfs4proxy.x86_64.so ./obfs4proxy