Skip to content

Commit

Permalink
build: Export some private functions from libraries, to link tools and
Browse files Browse the repository at this point in the history
tests which uses them, against shared versions.

Now, the tests can be compiled in shared configuration on Windows with CMake,
which was impossible before due to not-exported functions from DLLs.

* build.conf
  (libsvn_fs_fs, libsvn_fs_x, libsvn_fs_base,
   libsvn_subr, libsvn_wc): Add private headers to msvc-export to get
   them into .lib file.
  (executables, tests, and tools, which were forced to be static): Allow them
   to be linked against shared libraries.

* build/generator/extractor.py,
  CMakeLists.txt
  (def file generators): Ignore svn_fs_base__trail_debug, because it is
   under ifdef.

Tested on:
- Windows, vcnet generator, shared libraries, including BDB.
- Windows, CMake, shared libraries, without BDB, because it is not
  implemented in CMake build.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1920771 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
rinrab committed Sep 18, 2024
1 parent f6b6fbc commit 3eacee2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ function(target_exports target_name)
"svn_auth_kwallet_version"
"svn_auth_get_gpg_agent_simple_provider"
"svn_auth_gpg_agent_version"
# Unavailable in release mode
"svn_fs_base__trail_debug"
)

set(def_file_path ${CMAKE_BINARY_DIR}/${target_name}.def)
Expand Down
52 changes: 23 additions & 29 deletions build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ type = lib
path = subversion/libsvn_client
libs = libsvn_wc libsvn_ra libsvn_delta libsvn_diff libsvn_subr apriconv apr
install = lib
msvc-export = svn_client.h private/svn_client_mtcc.h private/svn_client_private.h private/svn_client_shelf.h private/svn_client_shelf2.h
msvc-export = svn_client.h private/svn_client_mtcc.h private/svn_client_private.h
private/svn_client_shelf.h private/svn_client_shelf2.h
../libsvn_client/mergeinfo.h ../libsvn_client/client.h

# Routines for binary diffing and tree-deltas
[libsvn_delta]
Expand Down Expand Up @@ -287,7 +289,12 @@ sources = *.c bdb/*.c util/*.c
install = bdb-lib
libs = libsvn_delta libsvn_subr aprutil apriconv apr bdb libsvn_fs_util
add-install-deps = $(SVN_FS_LIB_INSTALL_DEPS)
msvc-export = ../libsvn_fs_base/fs_init.h
msvc-export = ../libsvn_fs_base/fs_init.h ../libsvn_fs_base/fs.h
../libsvn_fs_base/id.h ../libsvn_fs_base/key-gen.h
../libsvn_fs_base/lock.h ../libsvn_fs_base/trail.h
../libsvn_fs_base/util/fs_skels.h ../libsvn_fs_base/bdb/changes-table.h
../libsvn_fs_base/bdb/txn-table.h ../libsvn_fs_base/bdb/nodes-table.h
../libsvn_fs_base/bdb/strings-table.h ../libsvn_fs_base/bdb/reps-table.h
msvc-delayload = yes

[libsvn_fs_fs]
Expand All @@ -297,6 +304,11 @@ path = subversion/libsvn_fs_fs
install = fsmod-lib
libs = libsvn_delta libsvn_subr aprutil apriconv apr libsvn_fs_util
msvc-export = private/svn_fs_fs_private.h ../libsvn_fs_fs/fs_init.h
../libsvn_fs_fs/fs_fs.h ../libsvn_fs_fs/fs.h
../libsvn_fs_fs/id.h ../libsvn_fs_fs/index.h
../libsvn_fs_fs/low_level.h ../libsvn_fs_fs/pack.h
../libsvn_fs_fs/rep-cache.h ../libsvn_fs_fs/rev_file.h
../libsvn_fs_fs/util.h
msvc-delayload = yes
msvc-libs = ws2_32.lib

Expand All @@ -306,7 +318,9 @@ type = fs-module
path = subversion/libsvn_fs_x
install = fsmod-lib
libs = libsvn_delta libsvn_subr aprutil apriconv apr libsvn_fs_util
msvc-export = ../libsvn_fs_x/fs_init.h
msvc-export = ../libsvn_fs_x/fs_init.h ../libsvn_fs_x/batch_fsync.h
../libsvn_fs_x/fs_init.h ../libsvn_fs_x/fs_x.h ../libsvn_fs_x/fs.h
../libsvn_fs_x/hotcopy.h ../libsvn_fs_x/reps.h ../libsvn_fs_x/string_table.h
msvc-delayload = yes
msvc-libs = ws2_32.lib

Expand Down Expand Up @@ -401,6 +415,7 @@ msvc-export =
private/svn_thread_cond.h private/svn_waitable_counter.h
private/svn_packed_data.h private/svn_object_pool.h private/svn_cert.h
private/svn_config_private.h private/svn_dirent_uri_private.h
../libsvn_subr/crypto.h

# Working copy management lib
[libsvn_wc]
Expand All @@ -409,8 +424,11 @@ type = lib
path = subversion/libsvn_wc
libs = libsvn_delta libsvn_diff libsvn_subr aprutil apriconv apr
install = lib
msvc-export = svn_wc.h private/svn_wc_private.h

msvc-export = svn_wc.h private/svn_wc_private.h ../libsvn_wc/conflicts.h
../libsvn_wc/lock.h ../libsvn_wc/token-map.h
../libsvn_wc/tree_conflicts.h ../libsvn_wc/wc_db_private.h
../libsvn_wc/wc_db.h ../libsvn_wc/wc-queries.h
../libsvn_wc/wc.h ../libsvn_wc/workqueue.h
# Subversion plugin for Apache's mod_dav
[mod_dav_svn]
description = Subversion plug-in for the Apache DAV module
Expand Down Expand Up @@ -786,7 +804,6 @@ sources = fs-base-test.c
install = bdb-test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_base libsvn_delta
libsvn_fs_util libsvn_subr apriconv apr
msvc-force-static = yes

[strings-reps-test]
description = Test strings/reps in libsvn_fs_base
Expand All @@ -796,7 +813,6 @@ sources = strings-reps-test.c
install = bdb-test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_base libsvn_delta
libsvn_subr apriconv apr
msvc-force-static = yes

[changes-test]
description = Test changes in libsvn_fs_base
Expand All @@ -806,7 +822,6 @@ sources = changes-test.c
install = bdb-test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_base libsvn_delta
libsvn_subr apriconv apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# Tests for libsvn_fs_fs
Expand All @@ -818,7 +833,6 @@ sources = fs-fs-pack-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_fs libsvn_delta
libsvn_subr apriconv apr
msvc-force-static = yes

[fs-fs-fuzzy-test]
description = Use fuzzying to test FSFS corruption resilience
Expand All @@ -828,7 +842,6 @@ sources = fs-fs-fuzzy-test.c
install = sub-test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_fs libsvn_delta
libsvn_repos libsvn_subr apriconv apr
msvc-force-static = yes

[fs-fs-private-test]
description = Test FSFS private API
Expand All @@ -838,7 +851,6 @@ sources = fs-fs-private-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_fs libsvn_delta
libsvn_repos libsvn_subr apriconv apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# Tests for libsvn_fs_x
Expand All @@ -850,7 +862,6 @@ sources = fs-x-pack-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_fs_x libsvn_delta
libsvn_subr apriconv apr
msvc-force-static = yes

[string-table-test]
description = Test fsfs string tables
Expand All @@ -859,7 +870,6 @@ path = subversion/tests/libsvn_fs_x
sources = string-table-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_fs_x libsvn_subr apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# Tests for libsvn_fs
Expand All @@ -871,7 +881,6 @@ path = subversion/tests/libsvn_fs
sources = locks-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_fs libsvn_delta libsvn_subr apriconv apr
msvc-force-static = yes

[fs-test]
description = Tests in libsvn_fs
Expand Down Expand Up @@ -952,7 +961,6 @@ path = subversion/tests/libsvn_subr
sources = checksum-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_subr apr zlib
msvc-force-static = yes

[compat-test]
description = Test compatibility functions
Expand All @@ -977,7 +985,6 @@ path = subversion/tests/libsvn_subr
sources = crypto-test.c
install = test
libs = libsvn_test libsvn_wc libsvn_subr aprutil apr
msvc-force-static = yes

[dirent_uri-test]
description = Test dirent_uri library
Expand Down Expand Up @@ -1224,7 +1231,6 @@ path = subversion/tests/libsvn_client
sources = client-test.c
install = test
libs = libsvn_test libsvn_client libsvn_wc libsvn_repos libsvn_ra libsvn_fs libsvn_delta libsvn_subr apriconv apr
msvc-force-static = yes

[mtcc-test]
description = Test Multi Command Context
Expand All @@ -1241,7 +1247,6 @@ path = subversion/tests/libsvn_client
sources = conflicts-test.c ../libsvn_wc/utils.c
install = test
libs = libsvn_test libsvn_client libsvn_wc libsvn_repos libsvn_ra libsvn_fs libsvn_delta libsvn_subr apriconv apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# Tests for libsvn_diff
Expand Down Expand Up @@ -1296,7 +1301,6 @@ path = subversion/tests/libsvn_wc
sources = conflict-data-test.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

[db-test]
description = Test the wc-ng database subsystem
Expand All @@ -1305,7 +1309,6 @@ path = subversion/tests/libsvn_wc
sources = db-test.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

[pristine-store-test]
description = Test the wc-ng pristine text storage subsystem
Expand All @@ -1314,7 +1317,6 @@ path = subversion/tests/libsvn_wc
sources = pristine-store-test.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

[entries-compat-test]
description = Test backwards compat for the entry interface
Expand All @@ -1323,7 +1325,6 @@ path = subversion/tests/libsvn_wc
sources = entries-compat.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

[op-depth-test]
description = Test layered tree changes
Expand All @@ -1332,7 +1333,6 @@ path = subversion/tests/libsvn_wc
sources = op-depth-test.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

[wc-queries-test]
description = Test Sqlite query evaluation
Expand All @@ -1349,7 +1349,6 @@ path = subversion/tests/libsvn_wc
sources = wc-test.c utils.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# Tests for the client's internal functions
Expand All @@ -1361,7 +1360,6 @@ path = subversion/tests/client
sources = filesize-test.c
install = test
libs = libsvn_client libsvn_test libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes

# ----------------------------------------------------------------------------
# These are not unit tests at all, they are small programs that exercise
Expand Down Expand Up @@ -1393,7 +1391,6 @@ path = subversion/tests/cmdline
sources = entries-dump.c
install = test
libs = libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes
testing = skip

[atomic-ra-revprop-change]
Expand All @@ -1418,7 +1415,6 @@ path = subversion/tests/libsvn_wc
sources = wc-lock-tester.c
install = test
libs = libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes
testing = skip

[wc-incomplete-tester]
Expand All @@ -1427,7 +1423,6 @@ path = subversion/tests/libsvn_wc
sources = wc-incomplete-tester.c
install = test
libs = libsvn_wc libsvn_subr apriconv apr
msvc-force-static = yes
testing = skip

[svn-wc-db-tester]
Expand All @@ -1436,7 +1431,6 @@ path = tools/dev/wc-ng
sources = svn-wc-db-tester.c
install = test
libs = libsvn_wc libsvn_subr apr
msvc-force-static = yes
testing = skip

# ----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions build/generator/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def extract_funcs(fname):
'svn_auth_kwallet_version',
'svn_auth_get_gpg_agent_simple_provider',
'svn_auth_gpg_agent_version',

# Unavailable in release mode
'svn_fs_base__trail_debug',
]

if __name__ == '__main__':
Expand Down

0 comments on commit 3eacee2

Please sign in to comment.