Deduplicating

This commit is contained in:
John Ericson 2024-06-27 12:17:13 -04:00
parent 17a8c2bfce
commit a81e319528
36 changed files with 128 additions and 476 deletions

View file

@ -0,0 +1,30 @@
requires_private = []
foreach dep : deps_private_subproject
requires_private += dep.name()
endforeach
requires_private += deps_private
requires_public = []
foreach dep : deps_public_subproject
requires_public += dep.name()
endforeach
requires_public += deps_public
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires_public,
requires_private : requires_private,
libraries_private : libraries_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))

36
meson-utils/meson.build Normal file
View file

@ -0,0 +1,36 @@
# These are private dependencies with pkg-config files. What private
# means is that the dependencies are used by the library but they are
# *not* used (e.g. `#include`-ed) in any installed header file, and only
# in regular source code (`*.cc`) or private, uninstalled headers. They
# are thus part of the *implementation* of the library, but not its
# *interface*.
#
# See `man pkg-config` for some details.
deps_private = [ ]
# These are public dependencies with pkg-config files. Public is the
# opposite of private: these dependencies are used in installed header
# files. They are part of the interface (and implementation) of the
# library.
#
# N.B. This concept is mostly unrelated to our own concept of a public
# (stable) API, for consumption outside of the Nix repository.
# `libnixutil` is an unstable C++ library, whose public interface is
# likewise unstable. `libutilc` conversely is a hopefully-soon stable
# C library, whose public interface --- including public but not private
# dependencies --- will also likewise soon be stable.
#
# N.B. For distributions that care about "ABI" stablity and not just
# "API" stability, the private dependencies also matter as they can
# potentially affect the public ABI.
deps_public = [ ]
# These are subproject deps (type == "internal"). They are other
# packages in `/src` in this repo. The private vs public distinction is
# the same as above.
deps_private_subproject = [ ]
deps_public_subproject = [ ]
# These are dependencencies without pkg-config files. Ideally they are
# just private, but they may also be public (e.g. boost).
deps_other = [ ]

1
src/libcmd/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

1
src/libexpr-c/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,20 +14,7 @@ project('nix-expr-c', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -128,32 +115,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires_private = []
foreach dep : deps_private_subproject
requires_private += dep.name()
endforeach
requires_private += deps_private
libraries_private = []
requires_public = []
foreach dep : deps_public_subproject
requires_public += dep.name()
endforeach
requires_public += deps_public
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires_public,
requires_private : requires_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : [],
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-expr-test-support', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -103,26 +93,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,14 +14,7 @@ project('nix-expr-test', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -117,9 +110,3 @@ this_exe = executable(
)
test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data'])
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
))

1
src/libexpr/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-expr', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -186,6 +176,8 @@ sources = files(
'value/context.cc',
)
include_dirs = [include_directories('.')]
headers = [config_h] + files(
'attr-path.hh',
'attr-set.hh',
@ -228,27 +220,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
libraries_private : ['-lboost_container', '-lboost_context'],
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_directories('.'),
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,14 +14,7 @@ project('nix-fetchers-test', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -101,9 +94,3 @@ this_exe = executable(
)
test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data'])
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
))

1
src/libfetchers/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,9 @@ project('nix-fetchers', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
subdir('meson-utils')
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
configdata = configuration_data()
foreach nix_dep : [
dependency('nix-util'),
@ -86,6 +78,8 @@ sources = files(
'tarball.cc',
)
include_dirs = [include_directories('.')]
headers = files(
'attrs.hh',
'cache.hh',
@ -109,26 +103,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_directories('.'),
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,14 +14,7 @@ project('nix-flake-test', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -106,9 +99,3 @@ this_exe = executable(
)
test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data'])
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
))

1
src/libflake/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-flake', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -78,6 +68,8 @@ sources = files(
'flake/lockfile.cc',
)
include_dirs = [include_directories('.')]
headers = files(
'flake-settings.hh',
'flake/flake.hh',
@ -95,26 +87,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_directories('.'),
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

1
src/libmain/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

1
src/libstore-c/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,20 +14,7 @@ project('nix-store-c', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -120,32 +107,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires_private = []
foreach dep : deps_private_subproject
requires_private += dep.name()
endforeach
requires_private += deps_private
libraries_private = []
requires_public = []
foreach dep : deps_public_subproject
requires_public += dep.name()
endforeach
requires_public += deps_public
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires_public,
requires_private : requires_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : [],
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-store-test-support', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -105,26 +95,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,14 +14,7 @@ project('nix-store-test', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -115,9 +108,3 @@ this_exe = executable(
)
test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data'])
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
))

1
src/libstore/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-store', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -436,27 +426,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = ['-lboost_container']
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
libraries_private : ['-lboost_container'],
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

1
src/libutil-c/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,20 +14,7 @@ project('nix-util-c', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -120,32 +107,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires_private = []
foreach dep : deps_private_subproject
requires_private += dep.name()
endforeach
requires_private += deps_private
libraries_private = []
requires_public = []
foreach dep : deps_public_subproject
requires_public += dep.name()
endforeach
requires_public += deps_public
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires_public,
requires_private : requires_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : [],
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,17 +14,7 @@ project('nix-util-test-support', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_public = [ ]
# See note in ../nix-util/meson.build
deps_public_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -100,26 +90,6 @@ this_library = library(
install_headers(headers, subdir : 'nix', preserve_path : true)
requires = []
foreach dep : deps_public_subproject
requires += dep.name()
endforeach
requires += deps_public
libraries_private = []
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : requires,
requires_private : deps_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : deps_public_subproject + deps_public,
))
subdir('meson-utils/export')

View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,14 +14,7 @@ project('nix-util-test', 'cpp',
cxx = meson.get_compiler('cpp')
# See note in ../nix-util/meson.build
deps_private = [ ]
# See note in ../nix-util/meson.build
deps_private_subproject = [ ]
# See note in ../nix-util/meson.build
deps_other = [ ]
subdir('meson-utils')
foreach nix_dep : [
dependency('nix-util'),
@ -115,9 +108,3 @@ this_exe = executable(
)
test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data'])
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_exe,
compile_args : ['-std=c++2a'],
))

1
src/libutil/meson-utils Symbolic link
View file

@ -0,0 +1 @@
../../meson-utils

View file

@ -14,36 +14,7 @@ project('nix-util', 'cpp',
cxx = meson.get_compiler('cpp')
# These are private dependencies with pkg-config files. What private
# means is that the dependencies are used by the library but they are
# *not* used (e.g. `#include`-ed) in any installed header file, and only
# in regular source code (`*.cc`) or private, uninstalled headers. They
# are thus part of the *implementation* of the library, but not its
# *interface*.
#
# See `man pkg-config` for some details.
deps_private = [ ]
# These are public dependencies with pkg-config files. Public is the
# opposite of private: these dependencies are used in installed header
# files. They are part of the interface (and implementation) of the
# library.
#
# N.B. This concept is mostly unrelated to our own concept of a public
# (stable) API, for consumption outside of the Nix repository.
# `libnixutil` is an unstable C++ library, whose public interface is
# likewise unstable. `libutilc` conversely is a hopefully-soon stable
# C library, whose public interface --- including public but not private
# dependencies --- will also likewise soon be stable.
#
# N.B. For distributions that care about "ABI" stablity and not just
# "API" stability, the private dependencies also matter as they can
# potentially affect the public ABI.
deps_public = [ ]
# These are dependencencies without pkg-config files. Ideally they are
# just private, but they may also be public (e.g. boost).
deps_other = [ ]
subdir('meson-utils')
configdata = configuration_data()
@ -315,21 +286,4 @@ if host_machine.system() == 'windows'
libraries_private += ['-lws2_32']
endif
import('pkgconfig').generate(
this_library,
filebase : meson.project_name(),
name : 'Nix',
description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'],
requires : deps_public,
requires_private : deps_private,
libraries_private : libraries_private,
)
meson.override_dependency(meson.project_name(), declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
dependencies : [],
))
subdir('meson-utils/export')