feat(3p/nix): minor improvements

(cherry picked from commit f6f7046acfaf90c19c597687d384b491c852b4c6)
This commit is contained in:
p01arst0rm 2019-10-24 11:15:22 +01:00 committed by Vincent Ambo
parent 055139ac6a
commit 9974eca8a0
2 changed files with 49 additions and 29 deletions

View file

@ -132,27 +132,6 @@ config_h.set(
description : 'platform identifier (`cpu-os`)') 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 # checking headers
@ -335,6 +314,9 @@ endif
# look for required programs # look for required programs
#-------------------------------------------------- #--------------------------------------------------
cat = find_program('cat', required : true) 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) bash = find_program('bash', required : true)
echo = find_program('echo', required : true) echo = find_program('echo', required : true)
patch = find_program('patch', 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() 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. # Look for boost, a required dependency.
#-------------------------------------------------- #--------------------------------------------------
boost_dep = declare_dependency( boost_dep = declare_dependency(
@ -468,7 +471,7 @@ endif
if (get_option('with_gc')) if (get_option('with_gc'))
gc_dep = declare_dependency( gc_dep = declare_dependency(
dependencies : dependency('bdw-gc'), dependencies : dependency('bdw-gc'),
link_args : get_option('sodium_link_args')) link_args : get_option('gc_link_args'))
config_h.set( config_h.set(
'HAVE_BOEHMGC', 1, 'HAVE_BOEHMGC', 1,
description : 'Whether to use the Boehm garbage collector.') description : 'Whether to use the Boehm garbage collector.')
@ -476,6 +479,7 @@ else
gc_dep = declare_dependency() gc_dep = declare_dependency()
endif endif
# Look for aws-cpp-sdk-s3. # Look for aws-cpp-sdk-s3.
#-------------------------------------------------- #--------------------------------------------------
if (get_option('with_s3')) if (get_option('with_s3'))
@ -533,9 +537,16 @@ install_headers(
src_inc = [include_directories('.', 'src')] src_inc = [include_directories('.', 'src')]
subdir('src') project_dirs = [
subdir('scripts') 'src',
subdir('corepkgs') 'scripts',
subdir('misc') 'corepkgs',
subdir('doc') 'misc',
subdir('tests') 'doc',
'tests'
]
foreach dir : project_dirs
subdir(dir)
endforeach

View file

@ -4,13 +4,15 @@
# dirs # dirs
#============================================================================ #============================================================================
option( option(
'nixstoredir', 'nixstoredir',
type : 'string', type : 'string',
value : '/nix/store', value : '/nix/store',
description : 'path of the Nix store (defaults to /nix/store)') description : 'path of the Nix store (defaults to /nix/store)')
# compiler args # compiler args
#============================================================================ #============================================================================
@ -134,6 +136,13 @@ option(
'-lsqlite3'], '-lsqlite3'],
description : 'link args for sqlite3') description : 'link args for sqlite3')
option(
'gc_link_args',
type : 'array',
value : [
'-L/usr/local/lib',
'-lgc'],
description : 'link args for boehm garbage collector')