I don't like having so many reinterpret_cast statements that have to actually be looked at to determine if they are UB. A huge number of the reinterpret_cast instances in Lix are actually casting to some pointer of some character type, which is always valid no matter the source type. However, it is also worth looking at if it is not casting both *from* a character type and also *to* a character type, since IMO splatting a struct into a character array should be a very deliberate action instead of just being about dealing with bad APIs. So let's write a template that encapsulates this invariant so we can not worry about the trivially safe reinterpret_cast invocations. Change-Id: Ia4e2f1fa0c567123a96604ddadb3bdd7449660a4
172 lines
3.3 KiB
Meson
172 lines
3.3 KiB
Meson
libutil_sources = files(
|
|
'archive.cc',
|
|
'args.cc',
|
|
'canon-path.cc',
|
|
'cgroup.cc',
|
|
'compression.cc',
|
|
'compute-levels.cc',
|
|
'config.cc',
|
|
'current-process.cc',
|
|
'english.cc',
|
|
'environment-variables.cc',
|
|
'error.cc',
|
|
'escape-char.cc',
|
|
'escape-string.cc',
|
|
'exit.cc',
|
|
'experimental-features.cc',
|
|
'file-descriptor.cc',
|
|
'file-system.cc',
|
|
'git.cc',
|
|
'hash.cc',
|
|
'hilite.cc',
|
|
'json-utils.cc',
|
|
'logging.cc',
|
|
'namespaces.cc',
|
|
'position.cc',
|
|
'print-elided.cc',
|
|
'processes.cc',
|
|
'references.cc',
|
|
'regex.cc',
|
|
'serialise.cc',
|
|
'shlex.cc',
|
|
'signals.cc',
|
|
'source-path.cc',
|
|
'strings.cc',
|
|
'suggestions.cc',
|
|
'tarfile.cc',
|
|
'terminal.cc',
|
|
'thread-pool.cc',
|
|
'unix-domain-socket.cc',
|
|
'url.cc',
|
|
'url-name.cc',
|
|
'users.cc',
|
|
'xml-writer.cc',
|
|
)
|
|
|
|
libutil_headers = files(
|
|
'abstract-setting-to-json.hh',
|
|
'ansicolor.hh',
|
|
'archive.hh',
|
|
'args/root.hh',
|
|
'args.hh',
|
|
'box_ptr.hh',
|
|
'canon-path.hh',
|
|
'cgroup.hh',
|
|
'charptr-cast.hh',
|
|
'checked-arithmetic.hh',
|
|
'chunked-vector.hh',
|
|
'closure.hh',
|
|
'comparator.hh',
|
|
'compression.hh',
|
|
'compute-levels.hh',
|
|
'concepts.hh',
|
|
'config-impl.hh',
|
|
'config.hh',
|
|
'current-process.hh',
|
|
'english.hh',
|
|
'environment-variables.hh',
|
|
'error.hh',
|
|
'escape-char.hh',
|
|
'escape-string.hh',
|
|
'exit.hh',
|
|
'experimental-features.hh',
|
|
'experimental-features-json.hh',
|
|
'file-descriptor.hh',
|
|
'file-system.hh',
|
|
'finally.hh',
|
|
'fmt.hh',
|
|
'generator.hh',
|
|
'git.hh',
|
|
'hash.hh',
|
|
'hilite.hh',
|
|
'input-accessor.hh',
|
|
'json-impls.hh',
|
|
'json-utils.hh',
|
|
'logging.hh',
|
|
'logging-json.hh',
|
|
'lru-cache.hh',
|
|
'monitor-fd.hh',
|
|
'namespaces.hh',
|
|
'pool.hh',
|
|
'position.hh',
|
|
'print-elided.hh',
|
|
'processes.hh',
|
|
'ref.hh',
|
|
'references.hh',
|
|
'regex-combinators.hh',
|
|
'regex.hh',
|
|
'repair-flag.hh',
|
|
'serialise.hh',
|
|
'shlex.hh',
|
|
'signals.hh',
|
|
'source-path.hh',
|
|
'split.hh',
|
|
'strings.hh',
|
|
'suggestions.hh',
|
|
'sync.hh',
|
|
'tarfile.hh',
|
|
'terminal.hh',
|
|
'thread-pool.hh',
|
|
'topo-sort.hh',
|
|
'types.hh',
|
|
'unix-domain-socket.hh',
|
|
'url-parts.hh',
|
|
'url-name.hh',
|
|
'url.hh',
|
|
'users.hh',
|
|
'variant-wrapper.hh',
|
|
'xml-writer.hh',
|
|
)
|
|
|
|
libutil = library(
|
|
'lixutil',
|
|
libutil_sources,
|
|
dependencies : [
|
|
aws_sdk,
|
|
aws_s3,
|
|
boehm,
|
|
boost,
|
|
cpuid,
|
|
seccomp,
|
|
libarchive,
|
|
brotli,
|
|
openssl,
|
|
nlohmann_json,
|
|
],
|
|
cpp_pch : cpp_pch,
|
|
implicit_include_directories : true,
|
|
install : true,
|
|
)
|
|
|
|
install_headers(libutil_headers, subdir : 'lix/libutil', preserve_path : true)
|
|
|
|
# FIXME: not using the pkg-config module because it creates way too many deps
|
|
# while meson migration is in progress, and we want to not include boost here
|
|
configure_file(
|
|
input : 'lix-util.pc.in',
|
|
output : 'lix-util.pc',
|
|
install_dir : libdir / 'pkgconfig',
|
|
configuration : {
|
|
'prefix' : prefix,
|
|
'libdir' : libdir,
|
|
'includedir' : includedir,
|
|
'PACKAGE_VERSION' : meson.project_version(),
|
|
},
|
|
)
|
|
|
|
# Used by libstore and libfetchers.
|
|
liblixutil = declare_dependency(
|
|
include_directories : include_directories('.'),
|
|
link_with : libutil
|
|
)
|
|
|
|
# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed.
|
|
if is_static
|
|
liblixutil_mstatic = declare_dependency(
|
|
include_directories : include_directories('.'),
|
|
link_whole : libutil,
|
|
)
|
|
else
|
|
liblixutil_mstatic = liblixutil
|
|
endif
|