1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Merge pull request #12773 from roberth/config-h-low-hanging-fruit

Unexpose config headers (low hanging fruit only)
This commit is contained in:
John Ericson 2025-03-28 12:43:28 -04:00 committed by GitHub
commit c36a9b8e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 25 additions and 82 deletions

View file

@ -63,9 +63,7 @@ add_project_arguments(
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
# '-include', 'config-fetchers.h',
'-include', 'config-expr.hh', '-include', 'config-expr.hh',
'-include', 'config-main.hh',
'-include', 'config-cmd.hh', '-include', 'config-cmd.hh',
language : 'cpp', language : 'cpp',
) )
@ -93,7 +91,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'built-path.hh', 'built-path.hh',
'command-installable-value.hh', 'command-installable-value.hh',
'command.hh', 'command.hh',
@ -119,6 +117,7 @@ subdir('nix-meson-build-support/windows-version')
this_library = library( this_library = library(
'nixcmd', 'nixcmd',
sources, sources,
config_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args: linker_export_flags,

View file

@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists') subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -27,14 +25,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-expr.h',
)
add_project_arguments( add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. # TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
@ -44,10 +34,6 @@ add_project_arguments(
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-expr.hh', '-include', 'config-expr.hh',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-expr.h',
language : 'cpp', language : 'cpp',
) )
@ -61,7 +47,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'nix_api_expr.h', 'nix_api_expr.h',
'nix_api_external.h', 'nix_api_external.h',
'nix_api_value.h', 'nix_api_value.h',

View file

@ -41,9 +41,6 @@ add_project_arguments(
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-expr.hh', '-include', 'config-expr.hh',
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-expr.h',
language : 'cpp', language : 'cpp',
) )

View file

@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists') subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -29,14 +27,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-flake.h',
)
add_project_arguments( add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. # TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
@ -48,11 +38,6 @@ add_project_arguments(
# not generated (yet?) # not generated (yet?)
# '-include', 'config-flake.hh', # '-include', 'config-flake.hh',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-expr.h',
'-include', 'config-flake.h',
language : 'cpp', language : 'cpp',
) )
@ -64,7 +49,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'nix_api_flake.h', 'nix_api_flake.h',
) )

View file

@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists') subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -27,14 +25,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-main.h',
)
add_project_arguments( add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. # TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
@ -42,12 +32,7 @@ add_project_arguments(
# From C++ libraries, only for internals # From C++ libraries, only for internals
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-main.hh',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-main.h',
language : 'cpp', language : 'cpp',
) )
@ -59,7 +44,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'nix_api_main.h', 'nix_api_main.h',
) )

View file

@ -74,7 +74,7 @@ endif
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'common-args.hh', 'common-args.hh',
'loggers.hh', 'loggers.hh',
'plugin.hh', 'plugin.hh',
@ -88,6 +88,7 @@ subdir('nix-meson-build-support/windows-version')
this_library = library( this_library = library(
'nixmain', 'nixmain',
sources, sources,
config_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args: linker_export_flags,

View file

@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists') subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -25,14 +23,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-store.h',
)
add_project_arguments( add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. # TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
@ -41,9 +31,6 @@ add_project_arguments(
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
'-include', 'config-store.h',
language : 'cpp', language : 'cpp',
) )
@ -55,7 +42,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'nix_api_store.h', 'nix_api_store.h',
) )

View file

@ -45,8 +45,6 @@ add_project_arguments(
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-util.h',
'-include', 'config-store.h',
language : 'cpp', language : 'cpp',
) )

View file

@ -67,6 +67,7 @@ endforeach
has_acl_support = cxx.has_header('sys/xattr.h') \ has_acl_support = cxx.has_header('sys/xattr.h') \
and cxx.has_function('llistxattr') \ and cxx.has_function('llistxattr') \
and cxx.has_function('lremovexattr') and cxx.has_function('lremovexattr')
# TODO: used in header - make proper public header and make sure it's included. Affects ABI!
configdata.set('HAVE_ACL_SUPPORT', has_acl_support.to_int()) configdata.set('HAVE_ACL_SUPPORT', has_acl_support.to_int())
if host_machine.system() == 'darwin' if host_machine.system() == 'darwin'

View file

@ -23,7 +23,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file( config_h = configure_file(
@ -38,8 +37,6 @@ add_project_arguments(
# From C++ libraries, only for internals # From C++ libraries, only for internals
'-include', 'config-util.hh', '-include', 'config-util.hh',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
language : 'cpp', language : 'cpp',
) )
@ -51,7 +48,7 @@ sources = files(
include_dirs = [include_directories('.')] include_dirs = [include_directories('.')]
headers = [config_h] + files( headers = files(
'nix_api_util.h', 'nix_api_util.h',
) )
@ -64,6 +61,7 @@ subdir('nix-meson-build-support/windows-version')
this_library = library( this_library = library(
'nixutilc', 'nixutilc',
sources, sources,
config_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args: linker_export_flags,

View file

@ -7,6 +7,8 @@
#include <cxxabi.h> #include <cxxabi.h>
#include <typeinfo> #include <typeinfo>
#include "config-util.h"
nix_c_context * nix_c_context_create() nix_c_context * nix_c_context_create()
{ {
return new nix_c_context(); return new nix_c_context();

View file

@ -32,11 +32,16 @@ deps_private += rapidcheck
gtest = dependency('gtest', main : true) gtest = dependency('gtest', main : true)
deps_private += gtest deps_private += gtest
configdata = configuration_data()
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-util-tests.hh',
)
add_project_arguments( add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. '-include', 'config-util-tests.hh',
# It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh',
'-include', 'config-util.h',
language : 'cpp', language : 'cpp',
) )
@ -79,6 +84,7 @@ include_dirs = [include_directories('.')]
this_exe = executable( this_exe = executable(
meson.project_name(), meson.project_name(),
sources, sources,
config_h,
dependencies : deps_private_subproject + deps_private + deps_other, dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson # TODO: -lrapidcheck, see ../libutil-support/build.meson

View file

@ -33,12 +33,14 @@ check_funcs = [
'pipe2', 'pipe2',
# Optionally used to preallocate files to be large enough before # Optionally used to preallocate files to be large enough before
# writing to them. # writing to them.
# WARNING: define also used in libstore
'posix_fallocate', 'posix_fallocate',
# Optionally used to get more information about processes failing due # Optionally used to get more information about processes failing due
# to a signal on Unix. # to a signal on Unix.
'strsignal', 'strsignal',
# Optionally used to try to close more file descriptors (e.g. before # Optionally used to try to close more file descriptors (e.g. before
# forking) on Unix. # forking) on Unix.
# WARNING: also used in libexpr
'sysconf', 'sysconf',
# Optionally used for changing the mtime of files and symlinks. # Optionally used for changing the mtime of files and symlinks.
'utimensat', 'utimensat',

View file

@ -57,9 +57,6 @@ add_project_arguments(
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-expr.hh', '-include', 'config-expr.hh',
#'-include', 'config-fetchers.hh',
'-include', 'config-main.hh',
'-include', 'config-cmd.hh',
'-include', 'config-nix-cli.hh', '-include', 'config-nix-cli.hh',
language : 'cpp', language : 'cpp',
) )

View file

@ -6,7 +6,6 @@ libplugintest = shared_module(
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
# '-include', 'config-fetchers.hh',
'-include', 'config-expr.hh', '-include', 'config-expr.hh',
], ],
dependencies : [ dependencies : [