mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
Build one big .a library full of Tor's implementation.
This is experimental and probably will break some platforms
This commit is contained in:
parent
e8a4482335
commit
e9dbb5e395
21
Makefile.am
21
Makefile.am
@ -14,6 +14,7 @@ CLEANFILES=
|
||||
TESTS=
|
||||
noinst_PROGRAMS=
|
||||
DISTCLEANFILES=
|
||||
MOSTLYCLEANFILES=
|
||||
bin_SCRIPTS=
|
||||
AM_CPPFLAGS=\
|
||||
-I$(top_srcdir)/src \
|
||||
@ -137,6 +138,13 @@ TOR_INTERNAL_LIBS = \
|
||||
src/trunnel/libor-trunnel.a \
|
||||
src/lib/libtor-trace.a
|
||||
|
||||
libtor.a: $(TOR_INTERNAL_LIBS)
|
||||
$(AM_V_AR) export AR="$(AR)"; \
|
||||
export ARFLAGS="$(ARFLAGS)"; \
|
||||
$(top_srcdir)/scripts/build/combine_libs libtor.a $(TOR_INTERNAL_LIBS)
|
||||
|
||||
MOSTLYCLEANFILES += libtor.a
|
||||
|
||||
# Variants of the above for linking the testing variant of tor (for coverage
|
||||
# and tests)
|
||||
if UNITTESTS_ENABLED
|
||||
@ -148,6 +156,14 @@ TOR_INTERNAL_TESTING_LIBS = \
|
||||
$(TOR_UTIL_TESTING_LIBS) \
|
||||
src/trunnel/libor-trunnel-testing.a \
|
||||
src/lib/libtor-trace.a
|
||||
|
||||
src/test/libtor-testing.a: $(TOR_INTERNAL_TESTING_LIBS)
|
||||
$(AM_V_AR) export AR="$(AR)"; \
|
||||
export ARFLAGS="$(ARFLAGS)"; \
|
||||
export RANLIB="$(RANLIB)"; \
|
||||
$(top_srcdir)/scripts/build/combine_libs src/test/libtor-testing.a $(TOR_INTERNAL_TESTING_LIBS)
|
||||
|
||||
MOSTLYCLEANFILES += src/test/libtor-testing.a
|
||||
endif
|
||||
|
||||
TOR_LDFLAGS_CRYPTLIB=@TOR_LDFLAGS_openssl@
|
||||
@ -175,6 +191,7 @@ EXTRA_DIST+= \
|
||||
Makefile.nmake \
|
||||
README \
|
||||
ReleaseNotes \
|
||||
scripts/build/combine_libs \
|
||||
scripts/maint/checkIncludes.py \
|
||||
scripts/maint/checkSpace.pl \
|
||||
scripts/maint/checkSpaceTest.sh \
|
||||
@ -701,7 +718,7 @@ show-distdir-core:
|
||||
file $(distdir)/_build/core; fi
|
||||
|
||||
show-libs:
|
||||
@echo $(TOR_INTERNAL_LIBS)
|
||||
@echo libtor.a
|
||||
|
||||
show-testing-libs:
|
||||
@echo $(TOR_INTERNAL_TESTING_LIBS)
|
||||
@echo src/test/libtor-testing.a
|
||||
|
35
scripts/build/combine_libs
Executable file
35
scripts/build/combine_libs
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
TMPDIR="$(mktemp -d -t tor_lib_combining.XXXXXX)"
|
||||
ORIGDIR="$(pwd)"
|
||||
|
||||
trap 'cd "$ORIGDIR" && rm -rf "$TMPDIR"' 0
|
||||
|
||||
abspath() {
|
||||
echo "$(cd "$(dirname "$1")">/dev/null && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
TARGET=$(abspath "$1")
|
||||
|
||||
#echo ORIGDIR="$ORIGDIR"
|
||||
#echo AR="$AR"
|
||||
#echo ARFLAGS="$AFLAGS"
|
||||
|
||||
shift
|
||||
|
||||
for input in "$@"; do
|
||||
cd "$ORIGDIR"
|
||||
abs=$(abspath "$input")
|
||||
dir="$TMPDIR"/$(basename "$input" .a)
|
||||
mkdir "$dir"
|
||||
cd "$dir">/dev/null
|
||||
ar x "$abs"
|
||||
done
|
||||
|
||||
cd "$TMPDIR" >/dev/null
|
||||
#echo "${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
|
||||
"${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
|
||||
"${RANLIB:-ranlib}" library.tmp.a
|
||||
mv -f library.tmp.a "$TARGET"
|
@ -31,7 +31,7 @@ FUZZING_CFLAGS = \
|
||||
FUZZING_LDFLAG = \
|
||||
@TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
|
||||
FUZZING_LIBS = \
|
||||
$(TOR_INTERNAL_TESTING_LIBS) \
|
||||
src/test/libtor-testing.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
@TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
|
||||
@ -41,7 +41,7 @@ FUZZING_LIBS = \
|
||||
@TOR_ZSTD_LIBS@
|
||||
|
||||
oss-fuzz-prereqs: \
|
||||
$(TOR_INTERNAL_TESTING_LIBS)
|
||||
src/test/libtor-testing.a
|
||||
|
||||
noinst_HEADERS += \
|
||||
src/test/fuzz/fuzzing.h
|
||||
|
@ -15,7 +15,7 @@ src_app_tor_SOURCES = src/app/main/tor_main.c
|
||||
# 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_CRYPTLIB) @TOR_LDFLAGS_libevent@
|
||||
src_app_tor_LDADD = $(TOR_INTERNAL_LIBS) \
|
||||
src_app_tor_LDADD = libtor.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@ -27,7 +27,7 @@ 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_CRYPTLIB) @TOR_LDFLAGS_libevent@
|
||||
src_app_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
|
||||
src_app_tor_cov_LDADD = src/test/libtor-testing.a \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
|
||||
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
||||
|
@ -310,7 +310,7 @@ src_test_test_switch_id_LDADD = \
|
||||
src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
|
||||
@TOR_LDFLAGS_libevent@
|
||||
src_test_test_LDADD = \
|
||||
$(TOR_INTERNAL_TESTING_LIBS) \
|
||||
src/test/libtor-testing.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@ -339,7 +339,7 @@ src_test_test_memwipe_LDFLAGS = $(src_test_test_LDFLAGS) @CFLAGS_BUGTRAP@
|
||||
src_test_bench_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
|
||||
@TOR_LDFLAGS_libevent@
|
||||
src_test_bench_LDADD = \
|
||||
$(TOR_INTERNAL_LIBS) \
|
||||
libtor.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@ -349,7 +349,7 @@ src_test_bench_LDADD = \
|
||||
src_test_test_workqueue_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
|
||||
@TOR_LDFLAGS_libevent@
|
||||
src_test_test_workqueue_LDADD = \
|
||||
$(TOR_INTERNAL_TESTING_LIBS) \
|
||||
src/test/libtor-testing.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@ -398,7 +398,7 @@ noinst_PROGRAMS+= src/test/test-hs-ntor-cl
|
||||
src_test_test_ntor_cl_SOURCES = src/test/test_ntor_cl.c
|
||||
src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
|
||||
src_test_test_ntor_cl_LDADD = \
|
||||
$(TOR_INTERNAL_LIBS) \
|
||||
libtor.a \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@ -409,7 +409,7 @@ src_test_test_ntor_cl_AM_CPPFLAGS = \
|
||||
src_test_test_hs_ntor_cl_SOURCES = src/test/test_hs_ntor_cl.c
|
||||
src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
|
||||
src_test_test_hs_ntor_cl_LDADD = \
|
||||
$(TOR_INTERNAL_LIBS) \
|
||||
libtor.a \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
|
||||
@CURVE25519_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
Loading…
Reference in New Issue
Block a user