Merge branch 'static-work'

This commit is contained in:
Nick Mathewson 2011-04-04 15:35:23 -04:00
commit 3cf23be712
4 changed files with 45 additions and 0 deletions

27
INSTALL
View File

@ -23,3 +23,30 @@ If it doesn't build for you:
Lastly, check out Lastly, check out
https://www.torproject.org/docs/faq#DoesntWork https://www.torproject.org/docs/faq#DoesntWork
How to do static builds of tor:
Tor supports linking each of the libraries it needs statically. Use the
--enable-static-X ./configure option in conjunction with the --with-X-dir
option for libevent, zlib, and openssl. For this to work sanely, libevent
should be built with --disable-shared --enable-static --with-pic, and
OpenSSL should be built with no-shared no-dso.
If you need to build tor so that system libraries are also statically linked,
use the --enable-static-tor ./configure option. This won't work on OS X
unless you build the required crt0.o yourself. It is also incompatible with
the --enable-gcc-hardening option.
An example of how to build a mostly static tor:
./configure --enable-static-libevent \
--enable-static-openssl \
--enable-static-zlib \
--with-libevent-dir=/tmp/static-tor/libevent-1.4.14b-stable \
--with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \
--with-zlib-dir=/tmp/static-tor/zlib-1.2.5
An example of how to build an entirely static tor:
./configure --enable-static-tor \
--with-libevent-dir=/tmp/static-tor/libevent-1.4.14b-stable \
--with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \
--with-zlib-dir=/tmp/static-tor/zlib-1.2.5

5
changes/bug2702 Normal file
View File

@ -0,0 +1,5 @@
o Minor features:
- Implements --enable-static-tor for configure time. Implements ticket
2702. Idea, general hackery and thoughts from Alexei Czeskis, John
Gilmore, Jacob Appelbaum.

4
changes/static-flag Normal file
View File

@ -0,0 +1,4 @@
o Minor features
- New "--enable-static-tor" configuration flag to try to build Tor
to link statically against as much as possible. Doesn't work on
all platforms.

View File

@ -32,6 +32,15 @@ AC_ARG_ENABLE(static-libevent,
AS_HELP_STRING(--enable-static-libevent, Link against a static libevent library. Requires --with-libevent-dir)) AS_HELP_STRING(--enable-static-libevent, Link against a static libevent library. Requires --with-libevent-dir))
AC_ARG_ENABLE(static-zlib, AC_ARG_ENABLE(static-zlib,
AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir)) AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir))
AC_ARG_ENABLE(static-tor,
AS_HELP_STRING(--enable-static-tor, Create an entirely static Tor binary. Requires --with-openssl-dir and --with-libevent-dir and --with-zlib-dir))
if test "$enable_static_tor" = "yes"; then
enable_static_libevent="yes";
enable_static_openssl="yes";
enable_static_zlib="yes";
CFLAGS="$CFLAGS -static"
fi
if test x$enable_buf_freelists != xno; then if test x$enable_buf_freelists != xno; then
AC_DEFINE(ENABLE_BUF_FREELISTS, 1, AC_DEFINE(ENABLE_BUF_FREELISTS, 1,