about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authorp01arst0rm <polar@ever3st.com>2019-10-24T10·15+0100
committerVincent Ambo <tazjin@google.com>2020-05-17T14·55+0100
commit9974eca8a01e1c9567afea558aaf428d7fe07b5d (patch)
treef6d6c39a6012e1a70156f9829eacff59eda2422c /third_party/nix
parent055139ac6aaecc7193972b65d2bcca022969c61d (diff)
feat(3p/nix): minor improvements r/727
(cherry picked from commit f6f7046acfaf90c19c597687d384b491c852b4c6)
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/meson.build67
-rw-r--r--third_party/nix/meson_options.txt11
2 files changed, 49 insertions, 29 deletions
diff --git a/third_party/nix/meson.build b/third_party/nix/meson.build
index 2d1a481bc60c..fac6c4fd30fb 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 2c8bb676d408..b7aa5bd27949 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')