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

Clean some header related things.

Revert most of "Hack together a fix for the public headers"

- The `libmain` change is kept, and one more libmain change is made.
  (Need to update Meson and Nix per the package alike).

- The S3 situation is fixed in a different way: the variable is public
  now, used in the header, and fixed accordingly.

- Fix TODO for `HAVE_EMBEDDED_SANDBOX_SHELL`

This reverts commit 2b51250534.
This commit is contained in:
John Ericson 2025-04-06 17:17:54 -04:00
parent 3fcdccb8ce
commit 3294b22a68
13 changed files with 32 additions and 48 deletions

View file

@ -1,3 +0,0 @@
// TODO: Remove this damn file while keeping public config headers working
#error \
"This file is a placeholder. It only exists so that meson accepts the symbolic link include/nix/expr/config.hh to this file, but we expect meson to overwrite it with the real file. Apparently that did not happen. I deeply apologize for this mess."

View file

@ -1 +0,0 @@
../../../expr-config.hh

View file

@ -10,7 +10,6 @@ config_pub_h = configure_file(
headers = [config_pub_h] + files( headers = [config_pub_h] + files(
'attr-path.hh', 'attr-path.hh',
'attr-set.hh', 'attr-set.hh',
'config.hh',
'eval-cache.hh', 'eval-cache.hh',
'eval-error.hh', 'eval-error.hh',
'eval-gc.hh', 'eval-gc.hh',

View file

@ -79,11 +79,6 @@ config_priv_h = configure_file(
output : 'expr-config-private.hh', output : 'expr-config-private.hh',
) )
config_pub_h = configure_file(
configuration : configdata_pub,
output : 'expr-config.hh',
)
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
parser_tab = custom_target( parser_tab = custom_target(
@ -168,8 +163,6 @@ subdir('primops')
subdir('nix-meson-build-support/export-all-symbols') subdir('nix-meson-build-support/export-all-symbols')
subdir('nix-meson-build-support/windows-version') subdir('nix-meson-build-support/windows-version')
headers += [config_pub_h]
this_library = library( this_library = library(
'nixexpr', 'nixexpr',
sources, sources,
@ -188,8 +181,4 @@ install_headers(headers, subdir : 'nix/expr', preserve_path : true)
libraries_private = [] libraries_private = []
nixexpr_dep = declare_dependency(
include_directories : include_directories('.'),
link_with : this_library,
)
subdir('nix-meson-build-support/export') subdir('nix-meson-build-support/export')

View file

@ -17,12 +17,14 @@ subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data() configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
# This dependency may be very limited; was introduced for NIX_USE_BOEHMGC macro dependency
dependency('nix-expr'),
] ]
deps_public_maybe_subproject = [ deps_public_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
# FIXME: This is only here for the NIX_USE_BOEHMGC macro dependency
# Removing nix-expr will make the build more concurrent and is
# architecturally nice, perhaps.
dependency('nix-expr'),
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')

View file

@ -40,9 +40,6 @@ deps_private += gtest
configdata = configuration_data() configdata = configuration_data()
configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
configdata.set('ENABLE_S3', aws_s3.found().to_int())
config_priv_h = configure_file( config_priv_h = configure_file(
configuration : configdata, configuration : configdata,
output : 'store-tests-config.hh', output : 'store-tests-config.hh',

View file

@ -1,10 +1,9 @@
#include "store-tests-config.hh" #include "nix/store/s3-binary-cache-store.hh"
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
# include <gtest/gtest.h> # include <gtest/gtest.h>
# include "nix/store/s3-binary-cache-store.hh"
namespace nix { namespace nix {
TEST(S3BinaryCacheStore, constructConfig) TEST(S3BinaryCacheStore, constructConfig)

View file

@ -9,7 +9,7 @@
#include "nix/util/signals.hh" #include "nix/util/signals.hh"
#include "store-config-private.hh" #include "store-config-private.hh"
#if ENABLE_S3 #if NIX_WITH_S3_SUPPORT
#include <aws/core/client/ClientConfiguration.h> #include <aws/core/client/ClientConfiguration.h>
#endif #endif
@ -756,7 +756,7 @@ struct curlFileTransfer : public FileTransfer
#endif #endif
} }
#if ENABLE_S3 #if NIX_WITH_S3_SUPPORT
std::tuple<std::string, std::string, Store::Params> parseS3Uri(std::string uri) std::tuple<std::string, std::string, Store::Params> parseS3Uri(std::string uri)
{ {
auto [path, params] = splitUriAndParams(uri); auto [path, params] = splitUriAndParams(uri);
@ -779,7 +779,7 @@ struct curlFileTransfer : public FileTransfer
if (hasPrefix(request.uri, "s3://")) { if (hasPrefix(request.uri, "s3://")) {
// FIXME: do this on a worker thread // FIXME: do this on a worker thread
try { try {
#if ENABLE_S3 #if NIX_WITH_S3_SUPPORT
auto [bucketName, key, params] = parseS3Uri(request.uri); auto [bucketName, key, params] = parseS3Uri(request.uri);
std::string profile = getOr(params, "profile", ""); std::string profile = getOr(params, "profile", "");

View file

@ -1,9 +1,13 @@
#pragma once #pragma once
///@file ///@file
#include "nix/store/binary-cache-store.hh" #include "nix/store/config.hh"
#include <atomic> #if NIX_WITH_S3_SUPPORT
# include "nix/store/binary-cache-store.hh"
# include <atomic>
namespace nix { namespace nix {
@ -125,3 +129,5 @@ public:
}; };
} }
#endif

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "store-config-private.hh" #include "store-config-private.hh"
#if ENABLE_S3 #if NIX_WITH_S3_SUPPORT
#include "nix/util/ref.hh" #include "nix/util/ref.hh"

View file

@ -126,7 +126,8 @@ deps_private += sqlite
# AWS C++ SDK has bad pkg-config. See # AWS C++ SDK has bad pkg-config. See
# https://github.com/aws/aws-sdk-cpp/issues/2673 for details. # https://github.com/aws/aws-sdk-cpp/issues/2673 for details.
aws_s3 = dependency('aws-cpp-sdk-s3', required : false) aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
configdata_priv.set('ENABLE_S3', aws_s3.found().to_int()) # The S3 store definitions in the header will be hidden based on this variables.
configdata_pub.set('NIX_WITH_S3_SUPPORT', aws_s3.found().to_int())
if aws_s3.found() if aws_s3.found()
aws_s3 = declare_dependency( aws_s3 = declare_dependency(
include_directories: include_directories(aws_s3.get_variable('includedir')), include_directories: include_directories(aws_s3.get_variable('includedir')),
@ -153,13 +154,13 @@ endforeach
busybox = find_program(get_option('sandbox-shell'), required : false) busybox = find_program(get_option('sandbox-shell'), required : false)
# This one goes in config.h
# The path to busybox is passed as a -D flag when compiling this_library.
# This solution is inherited from the old make buildsystem
# TODO: do this differently?
configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', get_option('embedded-sandbox-shell').to_int())
if get_option('embedded-sandbox-shell') if get_option('embedded-sandbox-shell')
# This one goes in config.h
# The path to busybox is passed as a -D flag when compiling this_library.
# This solution is inherited from the old make buildsystem
# TODO: do this differently?
# TODO: at least define it unconditionally, so we get checking from -Wundef
configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', 1)
hexdump = find_program('hexdump', native : true) hexdump = find_program('hexdump', native : true)
embedded_sandbox_shell_gen = custom_target( embedded_sandbox_shell_gen = custom_target(
'embedded-sandbox-shell.gen.hh', 'embedded-sandbox-shell.gen.hh',
@ -182,11 +183,6 @@ config_priv_h = configure_file(
output : 'store-config-private.hh', output : 'store-config-private.hh',
) )
config_pub_h = configure_file(
configuration : configdata_pub,
output : 'store-config.hh',
)
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
sources = files( sources = files(
@ -369,7 +365,7 @@ this_library = library(
install : true, install : true,
) )
install_headers(headers + [ config_pub_h ], subdir : 'nix/store', preserve_path : true) install_headers(headers, subdir : 'nix/store', preserve_path : true)
libraries_private = [] libraries_private = []

View file

@ -1,10 +1,10 @@
#include "store-config-private.hh" #include "nix/store/s3-binary-cache-store.hh"
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
#include <assert.h> #include <assert.h>
#include "nix/store/s3.hh" #include "nix/store/s3.hh"
#include "nix/store/s3-binary-cache-store.hh"
#include "nix/store/nar-info.hh" #include "nix/store/nar-info.hh"
#include "nix/store/nar-info-disk-cache.hh" #include "nix/store/nar-info-disk-cache.hh"
#include "nix/store/globals.hh" #include "nix/store/globals.hh"

View file

@ -2017,7 +2017,7 @@ void LocalDerivationGoal::runChild()
for (auto & i : pathsInChroot) { for (auto & i : pathsInChroot) {
if (i.second.source == "/proc") continue; // backwards compatibility if (i.second.source == "/proc") continue; // backwards compatibility
#ifdef HAVE_EMBEDDED_SANDBOX_SHELL #if HAVE_EMBEDDED_SANDBOX_SHELL
if (i.second.source == "__embedded_sandbox_shell__") { if (i.second.source == "__embedded_sandbox_shell__") {
static unsigned char sh[] = { static unsigned char sh[] = {
#include "embedded-sandbox-shell.gen.hh" #include "embedded-sandbox-shell.gen.hh"