diff options
author | Gabor X Toth <*@tg-x.net> | 2016-10-06 16:01:48 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2016-10-06 16:01:48 +0000 |
commit | a150b5db213e2fd9474ff7f4a6f639b22ece63ef (patch) | |
tree | dd1ab4ed863e0e5bf242cf3a156a6c0e21f30516 | |
parent | 810bc9ef12ddcc67cfc7cd762759ee13ecd14a8d (diff) | |
download | gnunet-a150b5db213e2fd9474ff7f4a6f639b22ece63ef.tar.gz gnunet-a150b5db213e2fd9474ff7f4a6f639b22ece63ef.zip |
nix: debug build, ccache
-rw-r--r-- | default.nix | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/default.nix b/default.nix index 4e4a117c2..ef3ed2c6d 100644 --- a/default.nix +++ b/default.nix | |||
@@ -34,8 +34,23 @@ | |||
34 | # c) use nixpkgs at a given path | 34 | # c) use nixpkgs at a given path |
35 | # --arg pkgs /path/to/nixpkgs | 35 | # --arg pkgs /path/to/nixpkgs |
36 | # | 36 | # |
37 | ## CCACHE | ||
38 | # | ||
39 | # To enable ccache, use the following: | ||
40 | # | ||
41 | # --argstr ccache_dir /var/cache/ccache | ||
37 | 42 | ||
38 | { pkgs ? null }: | 43 | # or when using nix-shell: |
44 | # --argstr ccache_dir ~/.ccache | ||
45 | # | ||
46 | # and make sure the given directory is writable by the nixpkgs group when using nix-build or nix-env -i, | ||
47 | # or the current user when using nix-shell | ||
48 | # | ||
49 | |||
50 | { | ||
51 | pkgs ? null, | ||
52 | ccache_dir ? "", | ||
53 | }: | ||
39 | 54 | ||
40 | let | 55 | let |
41 | syspkgs = import <nixpkgs> { }; | 56 | syspkgs = import <nixpkgs> { }; |
@@ -54,13 +69,14 @@ let | |||
54 | import <nixpkgs> { } | 69 | import <nixpkgs> { } |
55 | else | 70 | else |
56 | import pkgs {}; | 71 | import pkgs {}; |
72 | stdenv = usepkgs.stdenvAdapters.keepDebugInfo usepkgs.stdenv; | ||
57 | 73 | ||
58 | in with usepkgs; usepkgs.stdenv.mkDerivation rec { | 74 | in with usepkgs; stdenv.mkDerivation rec { |
59 | src = ./.; | 75 | src = ./.; |
60 | name = "gnunet-dev"; | 76 | name = "gnunet-dev"; |
61 | 77 | ||
62 | buildInputs = [ | 78 | buildInputs = [ |
63 | makeWrapper pkgconfig | 79 | makeWrapper pkgconfig autoconf automake ccache |
64 | adns curl gettext gmp gnutls gss ncurses openldap zlib sqlite mariadb postgresql | 80 | adns curl gettext gmp gnutls gss ncurses openldap zlib sqlite mariadb postgresql |
65 | libextractor libgcrypt libgnurl libidn libmicrohttpd | 81 | libextractor libgcrypt libgnurl libidn libmicrohttpd |
66 | libpsl libtool libunistring libxml2 | 82 | libpsl libtool libunistring libxml2 |
@@ -70,6 +86,8 @@ in with usepkgs; usepkgs.stdenv.mkDerivation rec { | |||
70 | test -e Makefile && make distclean | 86 | test -e Makefile && make distclean |
71 | ''; | 87 | ''; |
72 | 88 | ||
89 | NIX_CFLAGS_COMPILE = "-ggdb -O0"; | ||
90 | |||
73 | configureFlags = [ | 91 | configureFlags = [ |
74 | "--enable-gcc-hardening" | 92 | "--enable-gcc-hardening" |
75 | "--enable-linker-hardening" | 93 | "--enable-linker-hardening" |
@@ -82,6 +100,13 @@ in with usepkgs; usepkgs.stdenv.mkDerivation rec { | |||
82 | preConfigure = '' | 100 | preConfigure = '' |
83 | ./bootstrap | 101 | ./bootstrap |
84 | configureFlags="$configureFlags --with-nssdir=$out/lib" | 102 | configureFlags="$configureFlags --with-nssdir=$out/lib" |
103 | |||
104 | if [ -n "${ccache_dir}" ]; then | ||
105 | export CC='ccache gcc' | ||
106 | export CCACHE_COMPRESS=1 | ||
107 | export CCACHE_DIR="${ccache_dir}" | ||
108 | export CCACHE_UMASK=007 | ||
109 | fi | ||
85 | ''; | 110 | ''; |
86 | 111 | ||
87 | doCheck = false; | 112 | doCheck = false; |