diff options
-rw-r--r-- | .gitmodules | 12 | ||||
-rw-r--r-- | README.md | 28 | ||||
-rwxr-xr-x | build.sh | 58 | ||||
-rwxr-xr-x | clean.sh | 11 | ||||
m--------- | libevent | 0 | ||||
m--------- | openssl | 0 | ||||
m--------- | tor | 0 | ||||
m--------- | zlib | 0 |
8 files changed, 109 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ca55977 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "tor"] + path = tor + url = https://git.torproject.org/tor.git +[submodule "openssl"] + path = openssl + url = git://git.openssl.org/openssl.git +[submodule "libevent"] + path = libevent + url = https://github.com/libevent/libevent +[submodule "zlib"] + path = zlib + url = https://github.com/madler/zlib diff --git a/README.md b/README.md new file mode 100644 index 0000000..29d88a9 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +This project helps build a static binary for Tor. + +Some inspiration is taken from the +[tor-static](https://github.com/cretz/tor-static) Go library. + +# Versions + +This repo builds: + +- Libevent 2.1.8 +- OpenSSL 1.1.1b +- Tor 0.4.0.5 +- zlib v1.2.11 + +# Requirements + +- A proper C compiler toolchain. +- Make +- Autotools + +The build has only been tested on Linux so far. + +# Usage + +- Make sure you have all the required dependencies.. +- Run `./build.sh` +- Wait. +- Discover that you suddenly have a working `tor-static` binary. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..917aa4d --- /dev/null +++ b/build.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +set -e + +mkdir -p build +PWD=`pwd` +PREFIX="$PWD/build" + +build_zlib() { + cd zlib + ./configure --prefix="$PREFIX" + make -j4 + make install + cd .. +} + +build_openssl() { + cd openssl + ./config --prefix="$PREFIX" no-shared no-dso no-zlib + make build_libs + make install_dev + cd .. +} + +build_libevent() { + cd libevent + ./autogen.sh + ./configure --prefix="$PREFIX" --disable-shared --enable-static --with-pic\ + --disable-samples -disable-libevent-regress\ + "CPPFLAGS=-I$PREFIX/include", "LDFLAGS=-L$PREFIX/lib" + make -j4 + make install + cd .. +} + +build_tor() { + cd tor + ./autogen.sh + # TODO: See if we can enable some more features (seccomp, rust, zstd, lzma, scrypt (what's that used for?)) + ./configure --prefix="$PREFIX" --disable-asciidoc --disable-unittests\ + --enable-static-libevent --with-libevent-dir="$PREFIX"\ + --enable-static-openssl --with-openssl-dir="$PREFIX"\ + --enable-static-zlib --with-zlib-dir="$PREFIX"\ + --disable-systemd --disable-lzma --disable-zstd --disable-rust\ + --disable-seccomp --disable-libscrypt\ + "CPPFLAGS=-I$PREFIX/include" "LDFLAGS=-L$PREFIX/lib" + make -j4 V=1 + make install + cd .. +} + +build_zlib +build_openssl +build_libevent +build_tor + +cp "$PREFIX/bin/tor" tor-static +strip tor-static diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..377553a --- /dev/null +++ b/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +rm -rf build/ tor-static + +for d in zlib tor openssl libevent +do + git -C "$d" clean -fdx + git -C "$d" reset --hard HEAD +done diff --git a/libevent b/libevent new file mode 160000 +Subproject e7ff4ef2b4fc950a765008c18e74281cdb5e766 diff --git a/openssl b/openssl new file mode 160000 +Subproject 50eaac9f3337667259de725451f201e78459968 diff --git a/tor b/tor new file mode 160000 +Subproject bf071e34aa26e0965910d1adf424e8134b8d45d diff --git a/zlib b/zlib new file mode 160000 +Subproject cacf7f1d4e3d44d871b605da3b647f07d718623 |