diff --git a/meson-utils/export-all-symbols/meson.build b/meson-utils/export-all-symbols/meson.build new file mode 100644 index 000000000..d7c086749 --- /dev/null +++ b/meson-utils/export-all-symbols/meson.build @@ -0,0 +1,11 @@ +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 50616d0d8..b242c2d8e 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -79,17 +79,7 @@ headers = [config_h] + files( 'nix_api_value.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixexprc', diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 5dbc6b1b5..4209a4464 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -63,17 +63,7 @@ headers = files( 'tests/value/context.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-expr-test-support', diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index cf1c48729..11ab5c6e2 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -31,17 +31,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index 7f35cbeca..846d2d70a 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -29,17 +29,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index 1a488ec13..e4665ce9c 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -32,17 +32,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 3e59050fd..b86209720 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -71,17 +71,7 @@ headers = [config_h] + files( 'nix_api_store.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixstorec', diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 959125561..9c798e9cb 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -65,17 +65,7 @@ headers = files( 'tests/protocol.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-store-test-support', diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 4469c6d6a..3ec7fbbd7 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -28,17 +28,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libstore/meson.build b/src/libstore/meson.build index d5dcb1931..a552fc819 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -401,12 +401,7 @@ foreach name, value : cpp_str_defines ] endforeach -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # See note in `../nix-util/meson.build` - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixstore', diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 35338cbbc..b8c74bf11 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -68,17 +68,7 @@ headers = [config_h] + files( 'nix_api_util.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixutilc', diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 1b8a14355..4239003c5 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -60,17 +60,7 @@ headers = files( 'tests/string_callback.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-util-test-support', diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index 36e8c2288..8d9d32151 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -25,17 +25,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libutil/meson.build b/src/libutil/meson.build index d0e9f02c4..84e47b4b4 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -257,17 +257,7 @@ else subdir('unix') endif -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixutil',