meson: can now build libutil!
Change-Id: I6088a5a68637e19f85fcb4660b03ed9d1fc5f3a1
This commit is contained in:
parent
bace7379b7
commit
8c54e1ac26
89
meson.build
89
meson.build
|
@ -3,6 +3,7 @@ project('lix', 'cpp',
|
||||||
default_options : [
|
default_options : [
|
||||||
'buildtype=debugoptimized',
|
'buildtype=debugoptimized',
|
||||||
'cpp_std=c++20',
|
'cpp_std=c++20',
|
||||||
|
'warning_level=1',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,15 +12,22 @@ cxx = meson.get_compiler('cpp')
|
||||||
host_system = host_machine.cpu_family() + '-' + host_machine.system()
|
host_system = host_machine.cpu_family() + '-' + host_machine.system()
|
||||||
message('canonical Nix system name:', host_system)
|
message('canonical Nix system name:', host_system)
|
||||||
|
|
||||||
|
all_sources = { }
|
||||||
|
all_deps = { }
|
||||||
|
|
||||||
deps = [ ]
|
deps = [ ]
|
||||||
configdata = { }
|
configdata = { }
|
||||||
#'AWS_VERSION_MAJOR': aws_sdk_version_major,
|
|
||||||
#'AWS_VERSION_MINOR': aws_sdk_version_minor,
|
|
||||||
#'AWS_VERSION_PATCH': aws_sdk_version_patch,
|
|
||||||
#'CAN_LINK_SYMLINK': can_link_symlink.to_int(),
|
|
||||||
|
|
||||||
aws_sdk = dependency('aws-cpp-sdk-core', required : false)
|
aws_sdk = dependency('aws-cpp-sdk-core', required : false)
|
||||||
if aws_sdk.found()
|
if aws_sdk.found()
|
||||||
|
# The AWS pkg-config adds -std=c++11.
|
||||||
|
aws_sdk = aws_sdk.partial_dependency(
|
||||||
|
compile_args : false,
|
||||||
|
includes : true,
|
||||||
|
link_args : true,
|
||||||
|
links : true,
|
||||||
|
sources : true,
|
||||||
|
)
|
||||||
deps += aws_sdk
|
deps += aws_sdk
|
||||||
s = aws_sdk.version().split('.')
|
s = aws_sdk.version().split('.')
|
||||||
configdata += {
|
configdata += {
|
||||||
|
@ -29,12 +37,20 @@ if aws_sdk.found()
|
||||||
}
|
}
|
||||||
endif
|
endif
|
||||||
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
|
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
|
||||||
|
if aws_s3.found()
|
||||||
|
# The AWS pkg-config adds -std=c++11.
|
||||||
|
aws_s3 = aws_s3.partial_dependency(
|
||||||
|
compile_args : false,
|
||||||
|
includes : true,
|
||||||
|
link_args : true,
|
||||||
|
links : true,
|
||||||
|
sources : true,
|
||||||
|
)
|
||||||
|
deps += aws_s3
|
||||||
|
endif
|
||||||
configdata += {
|
configdata += {
|
||||||
'ENABLE_S3': aws_s3.found().to_int(),
|
'ENABLE_S3': aws_s3.found().to_int(),
|
||||||
}
|
}
|
||||||
if aws_s3.found()
|
|
||||||
deps += aws_s3
|
|
||||||
endif
|
|
||||||
|
|
||||||
run_command('ln', '-s', 'bla', 'tmp_link', check : true)
|
run_command('ln', '-s', 'bla', 'tmp_link', check : true)
|
||||||
can_link_symlink = run_command('ln', 'tmp_link', 'tmp_link2', check : false).returncode() == 0
|
can_link_symlink = run_command('ln', 'tmp_link', 'tmp_link2', check : false).returncode() == 0
|
||||||
|
@ -92,7 +108,7 @@ configdata += {
|
||||||
'HAVE_BOEHMGC': boehm.found().to_int(),
|
'HAVE_BOEHMGC': boehm.found().to_int(),
|
||||||
}
|
}
|
||||||
|
|
||||||
boost = dependency('boost', required : true)
|
boost = dependency('boost', required : true, modules : ['context', 'coroutine', 'container'])
|
||||||
deps += boost
|
deps += boost
|
||||||
|
|
||||||
cpuid = dependency('libcpuid', required : get_option('enable-cpuid'))
|
cpuid = dependency('libcpuid', required : get_option('enable-cpuid'))
|
||||||
|
@ -106,6 +122,19 @@ configdata += {
|
||||||
'HAVE_SECCOMP': seccomp.found().to_int(),
|
'HAVE_SECCOMP': seccomp.found().to_int(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
libarchive = dependency('libarchive', required : true)
|
||||||
|
deps += libarchive
|
||||||
|
|
||||||
|
brotli = [
|
||||||
|
dependency('libbrotlicommon', required : true),
|
||||||
|
dependency('libbrotlidec', required : true),
|
||||||
|
dependency('libbrotlienc', required : true),
|
||||||
|
]
|
||||||
|
deps += brotli
|
||||||
|
|
||||||
|
openssl = dependency('libcrypto', required : true)
|
||||||
|
deps += openssl
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
configuration : {
|
configuration : {
|
||||||
'PACKAGE_NAME': '"' + meson.project_name() + '"',
|
'PACKAGE_NAME': '"' + meson.project_name() + '"',
|
||||||
|
@ -118,36 +147,16 @@ configure_file(
|
||||||
output : 'config.h',
|
output : 'config.h',
|
||||||
)
|
)
|
||||||
|
|
||||||
libutil_srcs = [
|
add_project_arguments(
|
||||||
'src/libutil/archive.cc',
|
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
|
||||||
'src/libutil/args.cc',
|
# I would love to remove this.
|
||||||
'src/libutil/canon-path.cc',
|
'-include', 'config.h',
|
||||||
'src/libutil/cgroup.cc',
|
# TODO(Qyriad): would love to remove these
|
||||||
'src/libutil/compression.cc',
|
'-Wno-deprecated-declarations',
|
||||||
'src/libutil/compute-levels.cc',
|
'-Wno-unused-parameter',
|
||||||
'src/libutil/config.cc',
|
'-Wno-missing-field-initializers',
|
||||||
'src/libutil/english.cc',
|
'-Wno-deprecated-copy',
|
||||||
'src/libutil/error.cc',
|
language : 'cpp',
|
||||||
'src/libutil/experimental-features.cc',
|
|
||||||
'src/libutil/filesystem.cc',
|
|
||||||
'src/libutil/git.cc',
|
|
||||||
'src/libutil/hash.cc',
|
|
||||||
'src/libutil/hilite.cc',
|
|
||||||
'src/libutil/json-utils.cc',
|
|
||||||
'src/libutil/logging.cc',
|
|
||||||
'src/libutil/namespaces.cc',
|
|
||||||
'src/libutil/position.cc',
|
|
||||||
'src/libutil/references.cc',
|
|
||||||
'src/libutil/serialise.cc',
|
|
||||||
'src/libutil/source-path.cc',
|
|
||||||
'src/libutil/suggestions.cc',
|
|
||||||
'src/libutil/tarfile.cc',
|
|
||||||
'src/libutil/thread-pool.cc',
|
|
||||||
'src/libutil/url.cc',
|
|
||||||
'src/libutil/util.cc',
|
|
||||||
'src/libutil/xml-writer.cc',
|
|
||||||
]
|
|
||||||
|
|
||||||
library('nixutil', libutil_srcs,
|
|
||||||
implicit_include_directories : true,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subdir('src/libutil')
|
||||||
|
|
|
@ -174,6 +174,11 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
boost
|
boost
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Needed for Meson to find Boost.
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/86131.
|
||||||
|
env.BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
|
||||||
|
env.BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
||||||
|
|
||||||
preConfigure = lib.optionalString (finalAttrs.doBuild && (! stdenv.hostPlatform.isStatic)) ''
|
preConfigure = lib.optionalString (finalAttrs.doBuild && (! stdenv.hostPlatform.isStatic)) ''
|
||||||
# Copy libboost_context so we don't get all of Boost in our closure.
|
# Copy libboost_context so we don't get all of Boost in our closure.
|
||||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
# https://github.com/NixOS/nixpkgs/issues/45462
|
||||||
|
|
52
src/libutil/meson.build
Normal file
52
src/libutil/meson.build
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
|
||||||
|
libutil_sources = files(
|
||||||
|
'archive.cc',
|
||||||
|
'args.cc',
|
||||||
|
'canon-path.cc',
|
||||||
|
'cgroup.cc',
|
||||||
|
'compression.cc',
|
||||||
|
'compute-levels.cc',
|
||||||
|
'config.cc',
|
||||||
|
'english.cc',
|
||||||
|
'error.cc',
|
||||||
|
'experimental-features.cc',
|
||||||
|
'filesystem.cc',
|
||||||
|
'git.cc',
|
||||||
|
'hash.cc',
|
||||||
|
'hilite.cc',
|
||||||
|
'json-utils.cc',
|
||||||
|
'logging.cc',
|
||||||
|
'namespaces.cc',
|
||||||
|
'position.cc',
|
||||||
|
'references.cc',
|
||||||
|
'serialise.cc',
|
||||||
|
'source-path.cc',
|
||||||
|
'suggestions.cc',
|
||||||
|
'tarfile.cc',
|
||||||
|
'thread-pool.cc',
|
||||||
|
'url.cc',
|
||||||
|
'util.cc',
|
||||||
|
'xml-writer.cc',
|
||||||
|
)
|
||||||
|
|
||||||
|
all_sources += {
|
||||||
|
'libutil': libutil_sources,
|
||||||
|
}
|
||||||
|
|
||||||
|
library(
|
||||||
|
'nixutil',
|
||||||
|
libutil_sources,
|
||||||
|
dependencies : [
|
||||||
|
aws_sdk,
|
||||||
|
aws_s3,
|
||||||
|
boehm,
|
||||||
|
boost,
|
||||||
|
cpuid,
|
||||||
|
seccomp,
|
||||||
|
libarchive,
|
||||||
|
brotli,
|
||||||
|
openssl,
|
||||||
|
],
|
||||||
|
implicit_include_directories : true,
|
||||||
|
)
|
Loading…
Reference in a new issue