Skip to content

Commit b86a760

Browse files
committed
Unexpose config headers (low hanging fruit only)
- Some headers were completely redundant and have been removed. - Other headers have been turned private. - Unnecessary meson.build code has been removed. - libutil-tests now has a private config header, where previously it had none. This removes the need to expose a package version macro publicly.
1 parent 83ec817 commit b86a760

15 files changed

Lines changed: 25 additions & 82 deletions

File tree

src/libcmd/meson.build

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ add_project_arguments(
6363
# It would be nice for our headers to be idempotent instead.
6464
'-include', 'config-util.hh',
6565
'-include', 'config-store.hh',
66-
# '-include', 'config-fetchers.h',
6766
'-include', 'config-expr.hh',
68-
'-include', 'config-main.hh',
6967
'-include', 'config-cmd.hh',
7068
language : 'cpp',
7169
)
@@ -93,7 +91,7 @@ sources = files(
9391

9492
include_dirs = [include_directories('.')]
9593

96-
headers = [config_h] + files(
94+
headers = files(
9795
'built-path.hh',
9896
'command-installable-value.hh',
9997
'command.hh',
@@ -116,6 +114,7 @@ headers = [config_h] + files(
116114
this_library = library(
117115
'nixcmd',
118116
sources,
117+
config_h,
119118
dependencies : deps_public + deps_private + deps_other,
120119
prelink : true, # For C++ static initializers
121120
install : true,

src/libexpr-c/meson.build

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
1414

1515
subdir('nix-meson-build-support/deps-lists')
1616

17-
configdata = configuration_data()
18-
1917
deps_private_maybe_subproject = [
2018
dependency('nix-util'),
2119
dependency('nix-store'),
@@ -27,14 +25,6 @@ deps_public_maybe_subproject = [
2725
]
2826
subdir('nix-meson-build-support/subprojects')
2927

30-
# TODO rename, because it will conflict with downstream projects
31-
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
32-
33-
config_h = configure_file(
34-
configuration : configdata,
35-
output : 'config-expr.h',
36-
)
37-
3828
add_project_arguments(
3929
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
4030
# It would be nice for our headers to be idempotent instead.
@@ -44,10 +34,6 @@ add_project_arguments(
4434
'-include', 'config-store.hh',
4535
'-include', 'config-expr.hh',
4636

47-
# From C libraries, for our public, installed headers too
48-
'-include', 'config-util.h',
49-
'-include', 'config-store.h',
50-
'-include', 'config-expr.h',
5137
language : 'cpp',
5238
)
5339

@@ -61,7 +47,7 @@ sources = files(
6147

6248
include_dirs = [include_directories('.')]
6349

64-
headers = [config_h] + files(
50+
headers = files(
6551
'nix_api_expr.h',
6652
'nix_api_external.h',
6753
'nix_api_value.h',

src/libexpr-tests/meson.build

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ add_project_arguments(
4141
'-include', 'config-util.hh',
4242
'-include', 'config-store.hh',
4343
'-include', 'config-expr.hh',
44-
'-include', 'config-util.h',
45-
'-include', 'config-store.h',
46-
'-include', 'config-expr.h',
4744
language : 'cpp',
4845
)
4946

src/libflake-c/meson.build

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
1414

1515
subdir('nix-meson-build-support/deps-lists')
1616

17-
configdata = configuration_data()
18-
1917
deps_private_maybe_subproject = [
2018
dependency('nix-util'),
2119
dependency('nix-store'),
@@ -29,14 +27,6 @@ deps_public_maybe_subproject = [
2927
]
3028
subdir('nix-meson-build-support/subprojects')
3129

32-
# TODO rename, because it will conflict with downstream projects
33-
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
34-
35-
config_h = configure_file(
36-
configuration : configdata,
37-
output : 'config-flake.h',
38-
)
39-
4030
add_project_arguments(
4131
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
4232
# It would be nice for our headers to be idempotent instead.
@@ -48,11 +38,6 @@ add_project_arguments(
4838
# not generated (yet?)
4939
# '-include', 'config-flake.hh',
5040

51-
# From C libraries, for our public, installed headers too
52-
'-include', 'config-util.h',
53-
'-include', 'config-store.h',
54-
'-include', 'config-expr.h',
55-
'-include', 'config-flake.h',
5641
language : 'cpp',
5742
)
5843

@@ -64,7 +49,7 @@ sources = files(
6449

6550
include_dirs = [include_directories('.')]
6651

67-
headers = [config_h] + files(
52+
headers = files(
6853
'nix_api_flake.h',
6954
)
7055

src/libmain-c/meson.build

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
1414

1515
subdir('nix-meson-build-support/deps-lists')
1616

17-
configdata = configuration_data()
18-
1917
deps_private_maybe_subproject = [
2018
dependency('nix-util'),
2119
dependency('nix-store'),
@@ -27,27 +25,14 @@ deps_public_maybe_subproject = [
2725
]
2826
subdir('nix-meson-build-support/subprojects')
2927

30-
# TODO rename, because it will conflict with downstream projects
31-
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
32-
33-
config_h = configure_file(
34-
configuration : configdata,
35-
output : 'config-main.h',
36-
)
37-
3828
add_project_arguments(
3929
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
4030
# It would be nice for our headers to be idempotent instead.
4131

4232
# From C++ libraries, only for internals
4333
'-include', 'config-util.hh',
4434
'-include', 'config-store.hh',
45-
'-include', 'config-main.hh',
4635

47-
# From C libraries, for our public, installed headers too
48-
'-include', 'config-util.h',
49-
'-include', 'config-store.h',
50-
'-include', 'config-main.h',
5136
language : 'cpp',
5237
)
5338

@@ -59,7 +44,7 @@ sources = files(
5944

6045
include_dirs = [include_directories('.')]
6146

62-
headers = [config_h] + files(
47+
headers = files(
6348
'nix_api_main.h',
6449
)
6550

src/libmain/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ endif
7474

7575
include_dirs = [include_directories('.')]
7676

77-
headers = [config_h] + files(
77+
headers = files(
7878
'common-args.hh',
7979
'loggers.hh',
8080
'plugin.hh',
@@ -85,6 +85,7 @@ headers = [config_h] + files(
8585
this_library = library(
8686
'nixmain',
8787
sources,
88+
config_h,
8889
dependencies : deps_public + deps_private + deps_other,
8990
prelink : true, # For C++ static initializers
9091
install : true,

src/libstore-c/meson.build

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
1414

1515
subdir('nix-meson-build-support/deps-lists')
1616

17-
configdata = configuration_data()
18-
1917
deps_private_maybe_subproject = [
2018
dependency('nix-util'),
2119
dependency('nix-store'),
@@ -25,14 +23,6 @@ deps_public_maybe_subproject = [
2523
]
2624
subdir('nix-meson-build-support/subprojects')
2725

28-
# TODO rename, because it will conflict with downstream projects
29-
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
30-
31-
config_h = configure_file(
32-
configuration : configdata,
33-
output : 'config-store.h',
34-
)
35-
3626
add_project_arguments(
3727
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
3828
# It would be nice for our headers to be idempotent instead.
@@ -41,9 +31,6 @@ add_project_arguments(
4131
'-include', 'config-util.hh',
4232
'-include', 'config-store.hh',
4333

44-
# From C libraries, for our public, installed headers too
45-
'-include', 'config-util.h',
46-
'-include', 'config-store.h',
4734
language : 'cpp',
4835
)
4936

@@ -55,7 +42,7 @@ sources = files(
5542

5643
include_dirs = [include_directories('.')]
5744

58-
headers = [config_h] + files(
45+
headers = files(
5946
'nix_api_store.h',
6047
)
6148

src/libstore-tests/meson.build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ add_project_arguments(
4545
# It would be nice for our headers to be idempotent instead.
4646
'-include', 'config-util.hh',
4747
'-include', 'config-store.hh',
48-
'-include', 'config-util.h',
49-
'-include', 'config-store.h',
5048
language : 'cpp',
5149
)
5250

src/libstore/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ endforeach
6767
has_acl_support = cxx.has_header('sys/xattr.h') \
6868
and cxx.has_function('llistxattr') \
6969
and cxx.has_function('lremovexattr')
70+
# TODO: used in header - make proper public header and make sure it's included. Affects ABI!
7071
configdata.set('HAVE_ACL_SUPPORT', has_acl_support.to_int())
7172

7273
if host_machine.system() == 'darwin'

src/libutil-c/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ deps_public_maybe_subproject = [
2323
]
2424
subdir('nix-meson-build-support/subprojects')
2525

26-
# TODO rename, because it will conflict with downstream projects
2726
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
2827

2928
config_h = configure_file(
@@ -38,8 +37,6 @@ add_project_arguments(
3837
# From C++ libraries, only for internals
3938
'-include', 'config-util.hh',
4039

41-
# From C libraries, for our public, installed headers too
42-
'-include', 'config-util.h',
4340
language : 'cpp',
4441
)
4542

@@ -51,7 +48,7 @@ sources = files(
5148

5249
include_dirs = [include_directories('.')]
5350

54-
headers = [config_h] + files(
51+
headers = files(
5552
'nix_api_util.h',
5653
)
5754

@@ -64,6 +61,7 @@ subdir('nix-meson-build-support/windows-version')
6461
this_library = library(
6562
'nixutilc',
6663
sources,
64+
config_h,
6765
dependencies : deps_public + deps_private + deps_other,
6866
include_directories : include_dirs,
6967
link_args: linker_export_flags,

0 commit comments

Comments
 (0)