summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-05 16:04:32 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-05 17:15:50 -0400
commit81cb0afb2b0163d95a435583041dce1064eec65c (patch)
tree69f13e56ecb7e0dd899636ef70185c9416ac2448 /src
parent4eac5c6ce6f19829bf1aed46e8d3d72fa3ae1a74 (diff)
downloadtor-81cb0afb2b0163d95a435583041dce1064eec65c.tar.gz
tor-81cb0afb2b0163d95a435583041dce1064eec65c.zip
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".
Diffstat (limited to 'src')
-rw-r--r--src/app/include.am38
-rw-r--r--src/app/ntmain.c (renamed from src/or/ntmain.c)2
-rw-r--r--src/app/ntmain.h (renamed from src/or/ntmain.h)0
-rw-r--r--src/app/tor_main.c (renamed from src/or/tor_main.c)0
-rw-r--r--src/core/include.am (renamed from src/or/include.am)60
-rw-r--r--src/include.am5
-rw-r--r--src/or/main.c2
-rwxr-xr-xsrc/test/test_zero_length_keys.sh6
8 files changed, 57 insertions, 56 deletions
diff --git a/src/app/include.am b/src/app/include.am
new file mode 100644
index 0000000000..bbbffb3e59
--- /dev/null
+++ b/src/app/include.am
@@ -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
diff --git a/src/or/ntmain.c b/src/app/ntmain.c
index f6b57753d3..63d82f686e 100644
--- a/src/or/ntmain.c
+++ b/src/app/ntmain.c
@@ -22,7 +22,7 @@
#include "or/or.h"
#include "or/config.h"
#include "or/main.h"
-#include "or/ntmain.h"
+#include "app/ntmain.h"
#include "lib/log/win32err.h"
#include "lib/fs/winlib.h"
#include "lib/evloop/compat_libevent.h"
diff --git a/src/or/ntmain.h b/src/app/ntmain.h
index 223d9e318b..223d9e318b 100644
--- a/src/or/ntmain.h
+++ b/src/app/ntmain.h
diff --git a/src/or/tor_main.c b/src/app/tor_main.c
index 8c497fff8a..8c497fff8a 100644
--- a/src/or/tor_main.c
+++ b/src/app/tor_main.c
diff --git a/src/or/include.am b/src/core/include.am
index ad7ee69bf5..d6162196fc 100644
--- a/src/or/include.am
+++ b/src/core/include.am
@@ -1,22 +1,11 @@
-bin_PROGRAMS+= src/or/tor
+
noinst_LIBRARIES += \
- src/or/libtor-app.a
+ src/core/libtor-app.a
if UNITTESTS_ENABLED
noinst_LIBRARIES += \
- src/or/libtor-app-testing.a
-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=
+ src/core/libtor-app-testing.a
endif
-EXTRA_DIST+= src/or/ntmain.c src/or/Makefile.nmake
-
LIBTOR_APP_A_SOURCES = \
src/or/addressmap.c \
src/or/address_set.c \
@@ -110,8 +99,7 @@ LIBTOR_APP_A_SOURCES = \
src/or/torcert.c \
src/or/tor_api.c \
src/or/voting_schedule.c \
- src/or/onion_ntor.c \
- $(tor_platform_source)
+ src/or/onion_ntor.c
#
# 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)
endif
-src_or_libtor_app_a_SOURCES = $(LIBTOR_APP_A_SOURCES)
+src_core_libtor_app_a_SOURCES = $(LIBTOR_APP_A_SOURCES)
if UNITTESTS_ENABLED
# Add the sources of the modules that are needed for tests to work here.
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
-src_or_libtor_app_testing_a_SOURCES =
+src_core_libtor_app_testing_a_SOURCES =
endif
-src_or_tor_SOURCES = src/or/tor_main.c
-
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)\"" \
-DLOCALSTATEDIR="\"$(localstatedir)\"" \
-DBINDIR="\"$(bindir)\""
-src_or_libtor_app_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
-src_or_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
+src_core_libtor_app_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
+src_core_libtor_app_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
ORHEADERS = \
src/or/addressmap.h \
@@ -267,7 +228,6 @@ ORHEADERS = \
src/or/nodelist.h \
src/or/node_st.h \
src/or/ns_detached_signatures_st.h \
- src/or/ntmain.h \
src/or/onion.h \
src/or/onion_fast.h \
src/or/onion_ntor.h \
diff --git a/src/include.am b/src/include.am
index 950f9cc0fe..b5cca7e30a 100644
--- a/src/include.am
+++ b/src/include.am
@@ -33,7 +33,10 @@ include src/lib/tls/include.am
include src/lib/trace/include.am
include src/lib/wallclock/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/test/include.am
include src/tools/include.am
diff --git a/src/or/main.c b/src/or/main.c
index 7e3eb2b595..2a57aa587a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -88,7 +88,7 @@
#include "or/microdesc.h"
#include "or/networkstatus.h"
#include "or/nodelist.h"
-#include "or/ntmain.h"
+#include "app/ntmain.h"
#include "or/onion.h"
#include "or/periodic.h"
#include "or/policies.h"
diff --git a/src/test/test_zero_length_keys.sh b/src/test/test_zero_length_keys.sh
index f85edb68db..84ca513b0a 100755
--- a/src/test/test_zero_length_keys.sh
+++ b/src/test/test_zero_length_keys.sh
@@ -3,8 +3,8 @@
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/or/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" -z || 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/app/tor" -e || exitcode=1
exit ${exitcode}