chore(3p/nix): Remove symlink setup from Meson build

This belongs in the derivation itself, IMO.
This commit is contained in:
Vincent Ambo 2020-05-17 20:45:47 +01:00
parent aa54512ee2
commit 9d865dbb1f
2 changed files with 11 additions and 86 deletions

View file

@ -13,7 +13,7 @@
project( project(
'nix', 'nix',
'cpp', 'cpp',
default_options : [ default_options : [
'cpp_std=c++17', 'cpp_std=c++17',
'warning_level=3', 'warning_level=3',
@ -24,7 +24,7 @@ project(
license : 'MIT' license : 'MIT'
) )
# init compiler # init compiler
#------------------------------------------------- #-------------------------------------------------
cpp = meson.get_compiler('cpp') cpp = meson.get_compiler('cpp')
@ -116,7 +116,7 @@ sys_name = host_machine.system().to_lower()
cpu_archs = ['x86_64', 'armv6', 'armv7', ''] cpu_archs = ['x86_64', 'armv6', 'armv7', '']
foreach cpu : cpu_archs foreach cpu : cpu_archs
if (host_machine.cpu().contains(cpu)) if (host_machine.cpu().contains(cpu))
if cpu.contains('armv') if cpu.contains('armv')
machine_name = cpu + '1' machine_name = cpu + '1'
@ -363,11 +363,11 @@ else
fi fi
''' '''
run_command('sh', '-c', 'rm tmp_link*') run_command('sh', '-c', 'rm tmp_link*')
can_link_symlink = run_command('sh', '-c', gen_header).stdout().strip() can_link_symlink = run_command('sh', '-c', gen_header).stdout().strip()
if can_link_symlink.to_int() == 1 if can_link_symlink.to_int() == 1
run_command('sh', '-c', 'rm tmp_link*') run_command('sh', '-c', 'rm tmp_link*')
endif endif
config_h.set('CAN_LINK_SYMLINK', can_link_symlink, config_h.set('CAN_LINK_SYMLINK', can_link_symlink,
description : 'Whether link() works on symlinks') description : 'Whether link() works on symlinks')
@ -447,7 +447,7 @@ libbz2_dep = declare_dependency(
# Look for editline, a required dependency. # Look for editline, a required dependency.
#-------------------------------------------------- #--------------------------------------------------
# NOTE: The the libeditline.pc file was added only in libeditline >= 1.15.2, see # NOTE: The the libeditline.pc file was added only in libeditline >= 1.15.2, see
# https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607, # https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607,
# but e.g. Ubuntu 16.04 has an older version, so we fall back to searching for # but e.g. Ubuntu 16.04 has an older version, so we fall back to searching for
# editline.h when the pkg-config approach fails. # editline.h when the pkg-config approach fails.
@ -503,12 +503,12 @@ endif
#-------------------------------------------------- #--------------------------------------------------
if (get_option('with_s3')) if (get_option('with_s3'))
enable_s3 = meson.get_compiler('cpp').check_header('aws/s3/S3Client.h') enable_s3 = meson.get_compiler('cpp').check_header('aws/s3/S3Client.h')
aws_version = meson.get_compiler('cpp').get_define( aws_version = meson.get_compiler('cpp').get_define(
'AWS_SDK_VERSION_STRING', 'AWS_SDK_VERSION_STRING',
prefix : '#include <aws/core/VersionConfig.h>' prefix : '#include <aws/core/VersionConfig.h>'
).strip('"').split('.') ).strip('"').split('.')
conf_data.set('ENABLE_S3', 1, description : 'Whether to enable S3 support via aws-sdk-cpp.') conf_data.set('ENABLE_S3', 1, description : 'Whether to enable S3 support via aws-sdk-cpp.')
conf_data.set('AWS_VERSION_MAJOR', aws_version[0], description : 'Major version of aws-sdk-cpp.') conf_data.set('AWS_VERSION_MAJOR', aws_version[0], description : 'Major version of aws-sdk-cpp.')
conf_data.set('AWS_VERSION_MINOR', aws_version[1], description : 'Minor version of aws-sdk-cpp.') conf_data.set('AWS_VERSION_MINOR', aws_version[1], description : 'Minor version of aws-sdk-cpp.')
@ -517,7 +517,7 @@ endif
# OS Specific checks # OS Specific checks
#============================================================================ #============================================================================
# Look for libsecppomp, required for Linux sandboxing. # Look for libsecppomp, required for Linux sandboxing.
if sys_name.contains('linux') if sys_name.contains('linux')
@ -534,11 +534,11 @@ endif
if (sys_name.contains('freebsd')) if (sys_name.contains('freebsd'))
add_project_arguments('-D_GNU_SOURCE', language : 'cpp') add_project_arguments('-D_GNU_SOURCE', language : 'cpp')
config_h.set('_GNU_SOURCE', 1) config_h.set('_GNU_SOURCE', 1)
endif endif
if (sys_name.contains('sunos')) if (sys_name.contains('sunos'))
# Solaris requires -lsocket -lnsl for network functions # Solaris requires -lsocket -lnsl for network functions
endif endif

View file

@ -1,12 +1,3 @@
# Nix exec build file
#============================================================================
# src files
#============================================================================
src_inc += include_directories('.') src_inc += include_directories('.')
nix_src = files( nix_src = files(
@ -53,20 +44,6 @@ nix_src = files(
join_paths(meson.source_root(), 'src/nix-store/graphml.cc'), join_paths(meson.source_root(), 'src/nix-store/graphml.cc'),
join_paths(meson.source_root(), 'src/nix-store/nix-store.cc')) join_paths(meson.source_root(), 'src/nix-store/nix-store.cc'))
nix_ln_src = [
[ bindir, 'nix-build' ],
[ bindir, 'nix-channel' ],
[ bindir, 'nix-collect-garbage' ],
[ bindir, 'nix-copy-closure' ],
[ bindir, 'nix-daemon' ],
[ bindir, 'nix-env' ],
[ bindir, 'nix-hash' ],
[ bindir, 'nix-instantiate' ],
[ bindir, 'nix-prefetch-url' ],
[ bindir, 'nix-shell' ],
[ bindir, 'nix-store' ],
[ join_paths(libexecdir, 'nix'), 'build-remote' ]]
nix_headers = files ( nix_headers = files (
join_paths(meson.source_root(), 'src/nix/command.hh'), join_paths(meson.source_root(), 'src/nix/command.hh'),
join_paths(meson.source_root(), 'src/nix/legacy.hh'), join_paths(meson.source_root(), 'src/nix/legacy.hh'),
@ -75,9 +52,6 @@ nix_headers = files (
join_paths(meson.source_root(), 'src/nix-store/dotgraph.hh'), join_paths(meson.source_root(), 'src/nix-store/dotgraph.hh'),
join_paths(meson.source_root(), 'src/nix-store/graphml.hh')) join_paths(meson.source_root(), 'src/nix-store/graphml.hh'))
# dependancies
#============================================================================
nix_dep_list = [ nix_dep_list = [
pthread_dep, pthread_dep,
libdl_dep, libdl_dep,
@ -85,13 +59,6 @@ nix_dep_list = [
editline_dep, editline_dep,
libsodium_dep] libsodium_dep]
# Link args
#============================================================================
nix_link_list = [ nix_link_list = [
libutil_lib, libutil_lib,
libstore_lib, libstore_lib,
@ -99,28 +66,6 @@ nix_link_list = [
libexpr_lib libexpr_lib
] ]
nix_link_args = []
# compiler args
#============================================================================
nix_cxx_args = []
# targets
#============================================================================
# build
#============================================================================
nix_bin = executable( nix_bin = executable(
'nix', 'nix',
install : true, install : true,
@ -130,23 +75,3 @@ nix_bin = executable(
sources : nix_src, sources : nix_src,
link_with : nix_link_list, link_with : nix_link_list,
dependencies : nix_dep_list) dependencies : nix_dep_list)
# meson does not yet support installing symlink files.
# this is a simple workaround
foreach name : nix_ln_src
meson.add_install_script(
'ln',
'-sf',
join_paths(bindir, 'nix'),
name[1])
meson.add_install_script(
'cp',
'-r',
name[1],
join_paths(name[0], name[1]))
endforeach
install_headers(
nix_headers,
install_dir : join_paths(includedir, 'nix'))