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`)')
# 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

View file

@ -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')