From 9974eca8a01e1c9567afea558aaf428d7fe07b5d Mon Sep 17 00:00:00 2001 From: p01arst0rm Date: Thu, 24 Oct 2019 11:15:22 +0100 Subject: feat(3p/nix): minor improvements (cherry picked from commit f6f7046acfaf90c19c597687d384b491c852b4c6) --- third_party/nix/meson.build | 67 +++++++++++++++++++++++---------------- third_party/nix/meson_options.txt | 11 ++++++- 2 files changed, 49 insertions(+), 29 deletions(-) (limited to 'third_party') diff --git a/third_party/nix/meson.build b/third_party/nix/meson.build index 2d1a481bc6..fac6c4fd30 100644 --- a/third_party/nix/meson.build +++ b/third_party/nix/meson.build @@ -132,27 +132,6 @@ config_h.set( description : 'platform identifier (`cpu-os`)') -# Check whether the store optimiser can optimise symlinks. -#------------------------------------------------- -gen_header = ''' -ln -s bla tmp_link -if ln tmp_link tmp_link2 2> /dev/null; then - echo 1 -else - echo 0 -fi -''' - - -run_command('sh', '-c', 'rm tmp_link*') -can_link_symlink = run_command('sh', '-c', gen_header).stdout().strip() -if can_link_symlink.to_int() == 1 - run_command('sh', '-c', 'rm tmp_link*') -endif - -config_h.set('CAN_LINK_SYMLINK', can_link_symlink, -description : 'Whether link() works on symlinks') - # checking headers @@ -335,6 +314,9 @@ endif # look for required programs #-------------------------------------------------- cat = find_program('cat', required : true) +ln = find_program('ln', required : true) +cp = find_program('cp', required : true) +rm = find_program('rm', required : true) bash = find_program('bash', required : true) echo = find_program('echo', required : true) patch = find_program('patch', required : true) @@ -352,6 +334,27 @@ tr = find_program('tr', required : true) coreutils = run_command('dirname', cat.path()).stdout().strip() +# Check whether the store optimiser can optimise symlinks. +#------------------------------------------------- +gen_header = ''' +ln -s bla tmp_link +if ln tmp_link tmp_link2 2> /dev/null; then + echo 1 +else + echo 0 +fi +''' + +run_command('sh', '-c', 'rm tmp_link*') +can_link_symlink = run_command('sh', '-c', gen_header).stdout().strip() +if can_link_symlink.to_int() == 1 + run_command('sh', '-c', 'rm tmp_link*') +endif + +config_h.set('CAN_LINK_SYMLINK', can_link_symlink, +description : 'Whether link() works on symlinks') + + # Look for boost, a required dependency. #-------------------------------------------------- boost_dep = declare_dependency( @@ -468,7 +471,7 @@ endif if (get_option('with_gc')) gc_dep = declare_dependency( dependencies : dependency('bdw-gc'), - link_args : get_option('sodium_link_args')) + link_args : get_option('gc_link_args')) config_h.set( 'HAVE_BOEHMGC', 1, description : 'Whether to use the Boehm garbage collector.') @@ -476,6 +479,7 @@ else gc_dep = declare_dependency() endif + # Look for aws-cpp-sdk-s3. #-------------------------------------------------- if (get_option('with_s3')) @@ -533,9 +537,16 @@ install_headers( src_inc = [include_directories('.', 'src')] -subdir('src') -subdir('scripts') -subdir('corepkgs') -subdir('misc') -subdir('doc') -subdir('tests') +project_dirs = [ + 'src', + 'scripts', + 'corepkgs', + 'misc', + 'doc', + 'tests' +] + + +foreach dir : project_dirs + subdir(dir) +endforeach \ No newline at end of file diff --git a/third_party/nix/meson_options.txt b/third_party/nix/meson_options.txt index 2c8bb676d4..b7aa5bd279 100644 --- a/third_party/nix/meson_options.txt +++ b/third_party/nix/meson_options.txt @@ -4,13 +4,15 @@ # dirs #============================================================================ - option( 'nixstoredir', type : 'string', value : '/nix/store', description : 'path of the Nix store (defaults to /nix/store)') + + + # compiler args #============================================================================ @@ -134,6 +136,13 @@ option( '-lsqlite3'], description : 'link args for sqlite3') +option( + 'gc_link_args', + type : 'array', + value : [ + '-L/usr/local/lib', + '-lgc'], + description : 'link args for boehm garbage collector') -- cgit 1.4.1