From 3227c1d215ce1897bb72ab72333fa1bdd0cd1154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 8 Dec 2013 20:11:40 +0100 Subject: [PATCH] ncurses: fix includedir setting ${out} in configureFlags isn't expanded, so ncursesw5-config ends up expanding ${out} at *runtime*. Here is the relevant ncursesw5-config snippet showing how includedir gets its value at runtime. bindir="${exec_prefix}/bin" includedir="${out}/include" libdir="${exec_prefix}/lib" datadir="${prefix}/share" mandir="${prefix}/man" When running in a plain shell you get this: $ ncursesw5-config --cflags -I/include/ncursesw -I/include And when run in a nix-build shell for e.g. gpsd: $ ncursesw5-config --cflags -I/nix/store/HASH-gpsd-3.10/include/ncursesw -I/nix/store/HASH-gpsd-3.10/include This is clearly wrong. Q: How come this has gone undetected for years? A: It seems few packages use ncursesw5-config to get the compiler flags. For example, our python curses module builds its own compiler flags. Fix this by moving the --includedir setting to preConfigure where shell variables are expanded. --- pkgs/development/libraries/ncurses/5_4.nix | 6 +++++- pkgs/development/libraries/ncurses/default.nix | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/ncurses/5_4.nix b/pkgs/development/libraries/ncurses/5_4.nix index 1cf08bd30c69..fd35a1d4887a 100644 --- a/pkgs/development/libraries/ncurses/5_4.nix +++ b/pkgs/development/libraries/ncurses/5_4.nix @@ -19,10 +19,14 @@ stdenv.mkDerivation (rec { }; configureFlags = '' - --with-shared --includedir=''${out}/include --without-debug + --with-shared --without-debug ${if unicode then "--enable-widec" else ""}${if cxx then "" else "--without-cxx-binding"} ''; + preConfigure = '' + export configureFlags="$configureFlags --includedir=$out/include" + ''; + selfNativeBuildInput = true; enableParallelBuilding = true; diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index 8d20a7339b73..9ba21e99a787 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -18,12 +18,16 @@ stdenv.mkDerivation (rec { sha256 = "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"; }; + patches = [ ./patch-ac ]; + configureFlags = '' - --with-shared --includedir=''${out}/include --without-debug + --with-shared --without-debug ${if unicode then "--enable-widec" else ""}${if cxx then "" else "--without-cxx-binding"} ''; - patches = [ ./patch-ac ]; + preConfigure = '' + export configureFlags="$configureFlags --includedir=$out/include" + ''; selfNativeBuildInput = true;