mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
Start splitting src/or
This is a very gentle commit that just lays the groundwork in the build system: it puts the include files to build libtor-app.a into src/core, and to build the tor executable into src/app. The executable is now "src/app/tor".
This commit is contained in:
parent
4eac5c6ce6
commit
81cb0afb2b
19
.gitignore
vendored
19
.gitignore
vendored
@ -206,16 +206,15 @@ uptime-*.json
|
|||||||
/src/lib/libtor-wallclock.a
|
/src/lib/libtor-wallclock.a
|
||||||
/src/lib/libtor-wallclock-testing.a
|
/src/lib/libtor-wallclock-testing.a
|
||||||
|
|
||||||
# /src/or/
|
# /src/tor
|
||||||
/src/or/Makefile
|
/src/core/libtor-app.a
|
||||||
/src/or/Makefile.in
|
/src/core/libtor-app-testing.a
|
||||||
/src/or/tor
|
|
||||||
/src/or/tor.exe
|
# /src/app
|
||||||
/src/or/tor-cov
|
/src/app/tor
|
||||||
/src/or/tor-cov.exe
|
/src/app/tor.exe
|
||||||
/src/or/libtor-app.a
|
/src/app/tor-cov
|
||||||
/src/or/libtor-app-testing.a
|
/src/app/tor-cov.exe
|
||||||
/src/or/libtor.lib
|
|
||||||
|
|
||||||
# /src/rust
|
# /src/rust
|
||||||
/src/rust/.cargo/config
|
/src/rust/.cargo/config
|
||||||
|
@ -25,9 +25,9 @@ AM_CFLAGS=@TOR_SYSTEMD_CFLAGS@ @CFLAGS_BUGTRAP@ @TOR_LZMA_CFLAGS@ @TOR_ZSTD_CFLA
|
|||||||
SHELL=@SHELL@
|
SHELL=@SHELL@
|
||||||
|
|
||||||
if COVERAGE_ENABLED
|
if COVERAGE_ENABLED
|
||||||
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor-cov$(EXEEXT)
|
TESTING_TOR_BINARY=$(top_builddir)/src/app/tor-cov$(EXEEXT)
|
||||||
else
|
else
|
||||||
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
|
TESTING_TOR_BINARY=$(top_builddir)/src/app/tor$(EXEEXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_RUST
|
if USE_RUST
|
||||||
@ -108,7 +108,7 @@ TOR_CRYPTO_TESTING_LIBS = \
|
|||||||
|
|
||||||
# All static libraries used to link tor.
|
# All static libraries used to link tor.
|
||||||
TOR_INTERNAL_LIBS = \
|
TOR_INTERNAL_LIBS = \
|
||||||
src/or/libtor-app.a \
|
src/core/libtor-app.a \
|
||||||
src/lib/libtor-compress.a \
|
src/lib/libtor-compress.a \
|
||||||
src/lib/libtor-evloop.a \
|
src/lib/libtor-evloop.a \
|
||||||
$(TOR_CRYPTO_LIBS) \
|
$(TOR_CRYPTO_LIBS) \
|
||||||
@ -119,7 +119,7 @@ TOR_INTERNAL_LIBS = \
|
|||||||
# Variants of the above for linking the testing variant of tor (for coverage
|
# Variants of the above for linking the testing variant of tor (for coverage
|
||||||
# and tests)
|
# and tests)
|
||||||
TOR_INTERNAL_TESTING_LIBS = \
|
TOR_INTERNAL_TESTING_LIBS = \
|
||||||
src/or/libtor-app-testing.a \
|
src/core/libtor-app-testing.a \
|
||||||
src/lib/libtor-compress-testing.a \
|
src/lib/libtor-compress-testing.a \
|
||||||
src/lib/libtor-evloop-testing.a \
|
src/lib/libtor-evloop-testing.a \
|
||||||
$(TOR_CRYPTO_TESTING_LIBS) \
|
$(TOR_CRYPTO_TESTING_LIBS) \
|
||||||
|
@ -28,7 +28,7 @@ Jenkins
|
|||||||
Valgrind
|
Valgrind
|
||||||
--------
|
--------
|
||||||
|
|
||||||
valgrind --leak-check=yes --error-limit=no --show-reachable=yes src/or/tor
|
valgrind --leak-check=yes --error-limit=no --show-reachable=yes src/app/tor
|
||||||
|
|
||||||
(Note that if you get a zillion openssl warnings, you will also need to
|
(Note that if you get a zillion openssl warnings, you will also need to
|
||||||
pass `--undef-value-errors=no` to valgrind, or rebuild your openssl
|
pass `--undef-value-errors=no` to valgrind, or rebuild your openssl
|
||||||
@ -232,10 +232,10 @@ Beforehand, install google-perftools.
|
|||||||
Now you can run Tor with profiling enabled, and use the pprof utility to look at
|
Now you can run Tor with profiling enabled, and use the pprof utility to look at
|
||||||
performance! See the gperftools manual for more info, but basically:
|
performance! See the gperftools manual for more info, but basically:
|
||||||
|
|
||||||
2. Run `env CPUPROFILE=/tmp/profile src/or/tor -f <path/torrc>`. The profile file
|
2. Run `env CPUPROFILE=/tmp/profile src/app/tor -f <path/torrc>`. The profile file
|
||||||
is not written to until Tor finishes execuction.
|
is not written to until Tor finishes execuction.
|
||||||
|
|
||||||
3. Run `pprof src/or/tor /tm/profile` to start the REPL.
|
3. Run `pprof src/app/tor /tm/profile` to start the REPL.
|
||||||
|
|
||||||
Generating and analyzing a callgraph
|
Generating and analyzing a callgraph
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
@ -7,7 +7,7 @@ my %torrcSampleOptions = ();
|
|||||||
my %manPageOptions = ();
|
my %manPageOptions = ();
|
||||||
|
|
||||||
# Load the canonical list as actually accepted by Tor.
|
# Load the canonical list as actually accepted by Tor.
|
||||||
open(F, "@abs_top_builddir@/src/or/tor --list-torrc-options |") or die;
|
open(F, "@abs_top_builddir@/src/app/tor --list-torrc-options |") or die;
|
||||||
while (<F>) {
|
while (<F>) {
|
||||||
next if m!\[notice\] Tor v0\.!;
|
next if m!\[notice\] Tor v0\.!;
|
||||||
if (m!^([A-Za-z0-9_]+)!) {
|
if (m!^([A-Za-z0-9_]+)!) {
|
||||||
|
38
src/app/include.am
Normal file
38
src/app/include.am
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
bin_PROGRAMS+= src/app/tor
|
||||||
|
|
||||||
|
if COVERAGE_ENABLED
|
||||||
|
noinst_PROGRAMS+= src/app/tor-cov
|
||||||
|
endif
|
||||||
|
|
||||||
|
noinst_HEADERS += \
|
||||||
|
src/app/ntmain.h
|
||||||
|
|
||||||
|
src_app_tor_SOURCES = src/app/tor_main.c
|
||||||
|
if BUILD_NT_SERVICES
|
||||||
|
src_app_tor_SOURCES += src/app/ntmain.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -L flags need to go in LDFLAGS. -l flags need to go in LDADD.
|
||||||
|
# This seems to matter nowhere but on windows, but I assure you that it
|
||||||
|
# matters a lot there, and is quite hard to debug if you forget to do it.
|
||||||
|
|
||||||
|
src_app_tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
|
||||||
|
src_app_tor_LDADD = $(TOR_INTERNAL_LIBS) \
|
||||||
|
$(rust_ldadd) \
|
||||||
|
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
|
||||||
|
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||||
|
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
||||||
|
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||||
|
|
||||||
|
if COVERAGE_ENABLED
|
||||||
|
src_app_tor_cov_SOURCES = $(src_app_tor_SOURCES)
|
||||||
|
src_app_tor_cov_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
||||||
|
src_app_tor_cov_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
||||||
|
src_app_tor_cov_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
|
||||||
|
src_app_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
|
||||||
|
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
|
||||||
|
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ \
|
||||||
|
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
||||||
|
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||||
|
endif
|
@ -22,7 +22,7 @@
|
|||||||
#include "or/or.h"
|
#include "or/or.h"
|
||||||
#include "or/config.h"
|
#include "or/config.h"
|
||||||
#include "or/main.h"
|
#include "or/main.h"
|
||||||
#include "or/ntmain.h"
|
#include "app/ntmain.h"
|
||||||
#include "lib/log/win32err.h"
|
#include "lib/log/win32err.h"
|
||||||
#include "lib/fs/winlib.h"
|
#include "lib/fs/winlib.h"
|
||||||
#include "lib/evloop/compat_libevent.h"
|
#include "lib/evloop/compat_libevent.h"
|
@ -1,21 +1,10 @@
|
|||||||
bin_PROGRAMS+= src/or/tor
|
|
||||||
noinst_LIBRARIES += \
|
noinst_LIBRARIES += \
|
||||||
src/or/libtor-app.a
|
src/core/libtor-app.a
|
||||||
if UNITTESTS_ENABLED
|
if UNITTESTS_ENABLED
|
||||||
noinst_LIBRARIES += \
|
noinst_LIBRARIES += \
|
||||||
src/or/libtor-app-testing.a
|
src/core/libtor-app-testing.a
|
||||||
endif
|
endif
|
||||||
if COVERAGE_ENABLED
|
|
||||||
noinst_PROGRAMS+= src/or/tor-cov
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_NT_SERVICES
|
|
||||||
tor_platform_source=src/or/ntmain.c
|
|
||||||
else
|
|
||||||
tor_platform_source=
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST+= src/or/ntmain.c src/or/Makefile.nmake
|
|
||||||
|
|
||||||
LIBTOR_APP_A_SOURCES = \
|
LIBTOR_APP_A_SOURCES = \
|
||||||
src/or/addressmap.c \
|
src/or/addressmap.c \
|
||||||
@ -110,8 +99,7 @@ LIBTOR_APP_A_SOURCES = \
|
|||||||
src/or/torcert.c \
|
src/or/torcert.c \
|
||||||
src/or/tor_api.c \
|
src/or/tor_api.c \
|
||||||
src/or/voting_schedule.c \
|
src/or/voting_schedule.c \
|
||||||
src/or/onion_ntor.c \
|
src/or/onion_ntor.c
|
||||||
$(tor_platform_source)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Modules are conditionnally compiled in tor starting here. We add the C files
|
# Modules are conditionnally compiled in tor starting here. We add the C files
|
||||||
@ -131,53 +119,26 @@ if BUILD_MODULE_DIRAUTH
|
|||||||
LIBTOR_APP_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
|
LIBTOR_APP_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
src_or_libtor_app_a_SOURCES = $(LIBTOR_APP_A_SOURCES)
|
src_core_libtor_app_a_SOURCES = $(LIBTOR_APP_A_SOURCES)
|
||||||
if UNITTESTS_ENABLED
|
if UNITTESTS_ENABLED
|
||||||
|
|
||||||
# Add the sources of the modules that are needed for tests to work here.
|
# Add the sources of the modules that are needed for tests to work here.
|
||||||
LIBTOR_APP_TESTING_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
|
LIBTOR_APP_TESTING_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
|
||||||
|
|
||||||
src_or_libtor_app_testing_a_SOURCES = $(LIBTOR_APP_TESTING_A_SOURCES)
|
src_core_libtor_app_testing_a_SOURCES = $(LIBTOR_APP_TESTING_A_SOURCES)
|
||||||
else
|
else
|
||||||
src_or_libtor_app_testing_a_SOURCES =
|
src_core_libtor_app_testing_a_SOURCES =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
src_or_tor_SOURCES = src/or/tor_main.c
|
|
||||||
|
|
||||||
src/or/git_revision.$(OBJEXT) \
|
src/or/git_revision.$(OBJEXT) \
|
||||||
src/or/src_or_libtor_app_testing_a-git_revision.$(OBJEXT): micro-revision.i
|
src/or/src_core_libtor_app_testing_a-git_revision.$(OBJEXT): micro-revision.i
|
||||||
|
|
||||||
AM_CPPFLAGS += -DSHARE_DATADIR="\"$(datadir)\"" \
|
AM_CPPFLAGS += -DSHARE_DATADIR="\"$(datadir)\"" \
|
||||||
-DLOCALSTATEDIR="\"$(localstatedir)\"" \
|
-DLOCALSTATEDIR="\"$(localstatedir)\"" \
|
||||||
-DBINDIR="\"$(bindir)\""
|
-DBINDIR="\"$(bindir)\""
|
||||||
|
|
||||||
src_or_libtor_app_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
src_core_libtor_app_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
||||||
src_or_libtor_app_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
src_core_libtor_app_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
||||||
|
|
||||||
# -L flags need to go in LDFLAGS. -l flags need to go in LDADD.
|
|
||||||
# This seems to matter nowhere but on windows, but I assure you that it
|
|
||||||
# matters a lot there, and is quite hard to debug if you forget to do it.
|
|
||||||
|
|
||||||
|
|
||||||
src_or_tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
|
|
||||||
src_or_tor_LDADD = $(TOR_INTERNAL_LIBS) \
|
|
||||||
$(rust_ldadd) \
|
|
||||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
|
|
||||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
|
||||||
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
|
||||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
|
||||||
|
|
||||||
if COVERAGE_ENABLED
|
|
||||||
src_or_tor_cov_SOURCES = src/or/tor_main.c
|
|
||||||
src_or_tor_cov_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
|
||||||
src_or_tor_cov_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
|
||||||
src_or_tor_cov_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
|
|
||||||
src_or_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
|
|
||||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
|
|
||||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ \
|
|
||||||
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
|
||||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
|
||||||
endif
|
|
||||||
|
|
||||||
ORHEADERS = \
|
ORHEADERS = \
|
||||||
src/or/addressmap.h \
|
src/or/addressmap.h \
|
||||||
@ -267,7 +228,6 @@ ORHEADERS = \
|
|||||||
src/or/nodelist.h \
|
src/or/nodelist.h \
|
||||||
src/or/node_st.h \
|
src/or/node_st.h \
|
||||||
src/or/ns_detached_signatures_st.h \
|
src/or/ns_detached_signatures_st.h \
|
||||||
src/or/ntmain.h \
|
|
||||||
src/or/onion.h \
|
src/or/onion.h \
|
||||||
src/or/onion_fast.h \
|
src/or/onion_fast.h \
|
||||||
src/or/onion_ntor.h \
|
src/or/onion_ntor.h \
|
@ -33,7 +33,10 @@ include src/lib/tls/include.am
|
|||||||
include src/lib/trace/include.am
|
include src/lib/trace/include.am
|
||||||
include src/lib/wallclock/include.am
|
include src/lib/wallclock/include.am
|
||||||
include src/trunnel/include.am
|
include src/trunnel/include.am
|
||||||
include src/or/include.am
|
|
||||||
|
include src/core/include.am
|
||||||
|
include src/app/include.am
|
||||||
|
|
||||||
include src/rust/include.am
|
include src/rust/include.am
|
||||||
include src/test/include.am
|
include src/test/include.am
|
||||||
include src/tools/include.am
|
include src/tools/include.am
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
#include "or/microdesc.h"
|
#include "or/microdesc.h"
|
||||||
#include "or/networkstatus.h"
|
#include "or/networkstatus.h"
|
||||||
#include "or/nodelist.h"
|
#include "or/nodelist.h"
|
||||||
#include "or/ntmain.h"
|
#include "app/ntmain.h"
|
||||||
#include "or/onion.h"
|
#include "or/onion.h"
|
||||||
#include "or/periodic.h"
|
#include "or/periodic.h"
|
||||||
#include "or/policies.h"
|
#include "or/policies.h"
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
exitcode=0
|
exitcode=0
|
||||||
|
|
||||||
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -z || exitcode=1
|
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/app/tor" -z || exitcode=1
|
||||||
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -d || exitcode=1
|
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/app/tor" -d || exitcode=1
|
||||||
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -e || exitcode=1
|
"${SHELL:-sh}" "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/app/tor" -e || exitcode=1
|
||||||
|
|
||||||
exit ${exitcode}
|
exit ${exitcode}
|
||||||
|
Loading…
Reference in New Issue
Block a user