about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-17T22·58+0100
committerVincent Ambo <tazjin@google.com>2020-05-17T22·58+0100
commit0335b91b9357f517dfcecb1a4681f337634fed31 (patch)
treef743a9ec87473514888ba30fb15459868be34f4d
parentffdeb3bbf136120a25140077d0295b3ff9d326d6 (diff)
feat(3p/nix): Add glog dependency r/750
-rw-r--r--third_party/default.nix1
-rw-r--r--third_party/nix/default.nix1
-rw-r--r--third_party/nix/meson.build13
-rw-r--r--third_party/nix/meson_options.txt7
-rw-r--r--third_party/nix/src/nix/main.cc6
-rw-r--r--third_party/nix/src/nix/meson.build132
6 files changed, 87 insertions, 73 deletions
diff --git a/third_party/default.nix b/third_party/default.nix
index 2660ac34b68f..97a2dae86e76 100644
--- a/third_party/default.nix
+++ b/third_party/default.nix
@@ -54,6 +54,7 @@ let
       freetype
       gettext
       glibc
+      glog
       gnutar
       go
       google-cloud-sdk
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index d3bcc4e65ee7..a62f16b4a25c 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -36,6 +36,7 @@ in stdenv.mkDerivation {
     curl
     editline
     flex
+    glog
     largeBoehm
     libseccomp
     libsodium
diff --git a/third_party/nix/meson.build b/third_party/nix/meson.build
index bd5cd8ce7e96..78b84617a521 100644
--- a/third_party/nix/meson.build
+++ b/third_party/nix/meson.build
@@ -417,8 +417,13 @@ libdl_dep = declare_dependency(
 #--------------------------------------------------
 libbz2_dep = declare_dependency(
     dependencies : cpp.find_library('bz2'),
-    link_args :  get_option('bz2_link_args'))
+    link_args : get_option('bz2_link_args'))
 
+# Look for glog, a required dependency.
+#--------------------------------------
+glog_dep = declare_dependency(
+  dependencies : cpp.find_library('glog'),
+  link_args : get_option('glog_link_args'))
 
 # Look for editline, a required dependency.
 #--------------------------------------------------
@@ -441,8 +446,6 @@ if not (
 endif
 
 
-
-
 # Optional dependancies
 #============================================================================
 
@@ -485,8 +488,6 @@ if (get_option('with_s3'))
 endif
 
 
-
-
 # OS Specific checks
 #============================================================================
 # Look for libsecppomp, required for Linux sandboxing.
@@ -512,8 +513,6 @@ if (sys_name.contains('sunos'))
 endif
 
 
-
-
 # build
 #============================================================================
 
diff --git a/third_party/nix/meson_options.txt b/third_party/nix/meson_options.txt
index 96fced7d376d..663e5c42abc6 100644
--- a/third_party/nix/meson_options.txt
+++ b/third_party/nix/meson_options.txt
@@ -140,6 +140,13 @@ option(
         '-lgc'],
     description : 'link args for boehm garbage collector')
 
+option(
+    'glog_link_args',
+    type : 'array',
+    value : [
+        '-L/usr/local/lib',
+        '-lglog'],
+    description : 'link args for glog')
 
 
 # optional dependancies
diff --git a/third_party/nix/src/nix/main.cc b/third_party/nix/src/nix/main.cc
index 79730c58b994..fac2c78a639e 100644
--- a/third_party/nix/src/nix/main.cc
+++ b/third_party/nix/src/nix/main.cc
@@ -10,6 +10,7 @@
 #include "eval.hh"
 #include "finally.hh"
 #include "globals.hh"
+#include "glog/logging.h"
 #include "legacy.hh"
 #include "progress-bar.hh"
 #include "shared.hh"
@@ -166,7 +167,10 @@ void mainWrapped(int argc, char** argv) {
 
 }  // namespace nix
 
-int main(int argc, char** argv) {
+int main(int argc, char* argv[]) {
+  FLAGS_logtostderr = 1;
+  google::InitGoogleLogging(argv[0]);
+
   return nix::handleExceptions(argv[0],
                                [&]() { nix::mainWrapped(argc, argv); });
 }
diff --git a/third_party/nix/src/nix/meson.build b/third_party/nix/src/nix/meson.build
index 3fc841a48e88..a195ea1f25cd 100644
--- a/third_party/nix/src/nix/meson.build
+++ b/third_party/nix/src/nix/meson.build
@@ -1,78 +1,80 @@
 src_inc += include_directories('.')
 
 nix_src = files(
-    join_paths(meson.source_root(), 'src/nix/add-to-store.cc'),
-    join_paths(meson.source_root(), 'src/nix/build.cc'),
-    join_paths(meson.source_root(), 'src/nix/cat.cc'),
-    join_paths(meson.source_root(), 'src/nix/command.cc'),
-    join_paths(meson.source_root(), 'src/nix/copy.cc'),
-    join_paths(meson.source_root(), 'src/nix/doctor.cc'),
-    join_paths(meson.source_root(), 'src/nix/dump-path.cc'),
-    join_paths(meson.source_root(), 'src/nix/edit.cc'),
-    join_paths(meson.source_root(), 'src/nix/eval.cc'),
-    join_paths(meson.source_root(), 'src/nix/hash.cc'),
-    join_paths(meson.source_root(), 'src/nix/installables.cc'),
-    join_paths(meson.source_root(), 'src/nix/legacy.cc'),
-    join_paths(meson.source_root(), 'src/nix/log.cc'),
-    join_paths(meson.source_root(), 'src/nix/ls.cc'),
-    join_paths(meson.source_root(), 'src/nix/main.cc'),
-    join_paths(meson.source_root(), 'src/nix/optimise-store.cc'),
-    join_paths(meson.source_root(), 'src/nix/path-info.cc'),
-    join_paths(meson.source_root(), 'src/nix/ping-store.cc'),
-    join_paths(meson.source_root(), 'src/nix/progress-bar.cc'),
-    join_paths(meson.source_root(), 'src/nix/repl.cc'),
-    join_paths(meson.source_root(), 'src/nix/run.cc'),
-    join_paths(meson.source_root(), 'src/nix/search.cc'),
-    join_paths(meson.source_root(), 'src/nix/show-config.cc'),
-    join_paths(meson.source_root(), 'src/nix/show-derivation.cc'),
-    join_paths(meson.source_root(), 'src/nix/sigs.cc'),
-    join_paths(meson.source_root(), 'src/nix/upgrade-nix.cc'),
-    join_paths(meson.source_root(), 'src/nix/verify.cc'),
-    join_paths(meson.source_root(), 'src/nix/why-depends.cc'),
+  join_paths(meson.source_root(), 'src/nix/add-to-store.cc'),
+  join_paths(meson.source_root(), 'src/nix/build.cc'),
+  join_paths(meson.source_root(), 'src/nix/cat.cc'),
+  join_paths(meson.source_root(), 'src/nix/command.cc'),
+  join_paths(meson.source_root(), 'src/nix/copy.cc'),
+  join_paths(meson.source_root(), 'src/nix/doctor.cc'),
+  join_paths(meson.source_root(), 'src/nix/dump-path.cc'),
+  join_paths(meson.source_root(), 'src/nix/edit.cc'),
+  join_paths(meson.source_root(), 'src/nix/eval.cc'),
+  join_paths(meson.source_root(), 'src/nix/hash.cc'),
+  join_paths(meson.source_root(), 'src/nix/installables.cc'),
+  join_paths(meson.source_root(), 'src/nix/legacy.cc'),
+  join_paths(meson.source_root(), 'src/nix/log.cc'),
+  join_paths(meson.source_root(), 'src/nix/ls.cc'),
+  join_paths(meson.source_root(), 'src/nix/main.cc'),
+  join_paths(meson.source_root(), 'src/nix/optimise-store.cc'),
+  join_paths(meson.source_root(), 'src/nix/path-info.cc'),
+  join_paths(meson.source_root(), 'src/nix/ping-store.cc'),
+  join_paths(meson.source_root(), 'src/nix/progress-bar.cc'),
+  join_paths(meson.source_root(), 'src/nix/repl.cc'),
+  join_paths(meson.source_root(), 'src/nix/run.cc'),
+  join_paths(meson.source_root(), 'src/nix/search.cc'),
+  join_paths(meson.source_root(), 'src/nix/show-config.cc'),
+  join_paths(meson.source_root(), 'src/nix/show-derivation.cc'),
+  join_paths(meson.source_root(), 'src/nix/sigs.cc'),
+  join_paths(meson.source_root(), 'src/nix/upgrade-nix.cc'),
+  join_paths(meson.source_root(), 'src/nix/verify.cc'),
+  join_paths(meson.source_root(), 'src/nix/why-depends.cc'),
 
-    join_paths(meson.source_root(), 'src/build-remote/build-remote.cc'),
-    join_paths(meson.source_root(), 'src/nix-build/nix-build.cc'),
-    join_paths(meson.source_root(), 'src/nix-channel/nix-channel.cc'),
-    join_paths(meson.source_root(), 'src/nix-collect-garbage/nix-collect-garbage.cc'),
-    join_paths(meson.source_root(), 'src/nix-copy-closure/nix-copy-closure.cc'),
-    join_paths(meson.source_root(), 'src/nix-daemon/nix-daemon.cc'),
-    join_paths(meson.source_root(), 'src/nix-env/nix-env.cc'),
-    join_paths(meson.source_root(), 'src/nix-env/user-env.cc'),
-    join_paths(meson.source_root(), 'src/nix-instantiate/nix-instantiate.cc'),
-    join_paths(meson.source_root(), 'src/nix-prefetch-url/nix-prefetch-url.cc'),
-    join_paths(meson.source_root(), 'src/nix-store/dotgraph.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/build-remote/build-remote.cc'),
+  join_paths(meson.source_root(), 'src/nix-build/nix-build.cc'),
+  join_paths(meson.source_root(), 'src/nix-channel/nix-channel.cc'),
+  join_paths(meson.source_root(), 'src/nix-collect-garbage/nix-collect-garbage.cc'),
+  join_paths(meson.source_root(), 'src/nix-copy-closure/nix-copy-closure.cc'),
+  join_paths(meson.source_root(), 'src/nix-daemon/nix-daemon.cc'),
+  join_paths(meson.source_root(), 'src/nix-env/nix-env.cc'),
+  join_paths(meson.source_root(), 'src/nix-env/user-env.cc'),
+  join_paths(meson.source_root(), 'src/nix-instantiate/nix-instantiate.cc'),
+  join_paths(meson.source_root(), 'src/nix-prefetch-url/nix-prefetch-url.cc'),
+  join_paths(meson.source_root(), 'src/nix-store/dotgraph.cc'),
+  join_paths(meson.source_root(), 'src/nix-store/graphml.cc'),
+  join_paths(meson.source_root(), 'src/nix-store/nix-store.cc'))
 
 nix_headers = files (
-    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/progress-bar.hh'),
-    join_paths(meson.source_root(), 'src/nix-env/user-env.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/command.hh'),
+  join_paths(meson.source_root(), 'src/nix/legacy.hh'),
+  join_paths(meson.source_root(), 'src/nix/progress-bar.hh'),
+  join_paths(meson.source_root(), 'src/nix-env/user-env.hh'),
+  join_paths(meson.source_root(), 'src/nix-store/dotgraph.hh'),
+  join_paths(meson.source_root(), 'src/nix-store/graphml.hh'))
 
 nix_dep_list = [
-    gc_dep,
-    pthread_dep,
-    libdl_dep,
-    boost_dep,
-    editline_dep,
-    libsodium_dep]
+  boost_dep,
+  editline_dep,
+  gc_dep,
+  glog_dep,
+  libdl_dep,
+  libsodium_dep,
+  pthread_dep,
+]
 
 nix_link_list = [
-    libutil_lib,
-    libstore_lib,
-    libmain_lib,
-    libexpr_lib
+  libutil_lib,
+  libstore_lib,
+  libmain_lib,
+  libexpr_lib,
 ]
 
 nix_bin = executable(
-    'nix',
-    install : true,
-    install_mode : 'rwxr-xr-x',
-    install_dir : bindir,
-    include_directories : src_inc,
-    sources : nix_src,
-    link_with : nix_link_list,
-    dependencies : nix_dep_list)
+  'nix',
+  install : true,
+  install_mode : 'rwxr-xr-x',
+  install_dir : bindir,
+  include_directories : src_inc,
+  sources : nix_src,
+  link_with : nix_link_list,
+  dependencies : nix_dep_list)