about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/cmake/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/build-managers/cmake/default.nix')
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix42
1 files changed, 23 insertions, 19 deletions
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index c8ed91b96fb0..9d0ff6e1f174 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, pkgconfig
 , bzip2, curl, expat, libarchive, xz, zlib
 , useNcurses ? false, ncurses, useQt4 ? false, qt4
 , wantPS ? false, ps ? null
@@ -25,26 +25,34 @@ stdenv.mkDerivation rec {
     sha256 = "1yl0z422gr7zfc638chifv343vx0ig5gasvrh7nzf7b15488qgxp";
   };
 
-  enableParallelBuilding = true;
-
   patches =
     # Don't search in non-Nix locations such as /usr, but do search in
     # Nixpkgs' Glibc.
     optional (stdenv ? glibc) ./search-path-3.2.patch
     ++ optional stdenv.isCygwin ./3.2.2-cygwin.patch;
 
+  outputs = [ "out" "doc" ];
+  setOutputFlags = false;
+
+  setupHook = ./setup-hook.sh;
+
   buildInputs =
-    [ bzip2 curl expat libarchive xz zlib ]
+    [ setupHook pkgconfig bzip2 curl expat libarchive xz zlib ]
     ++ optional useNcurses ncurses
     ++ optional useQt4 qt4;
 
   propagatedBuildInputs = optional wantPS ps;
 
-  CMAKE_PREFIX_PATH = stdenv.lib.concatStringsSep ":" buildInputs;
-
+  preConfigure = with stdenv; optionalString (stdenv ? glibc)
+    ''
+      fixCmakeFiles .
+      substituteInPlace Modules/Platform/UnixPaths.cmake \
+        --subst-var-by glibc_bin ${glibc.bin or glibc} \
+        --subst-var-by glibc_dev ${glibc.dev or glibc} \
+        --subst-var-by glibc_lib ${glibc.out or glibc}
+    '';
   configureFlags =
     [ "--docdir=/share/doc/${name}"
-      "--mandir=/share/man"
       "--no-system-jsoncpp"
     ]
     ++ optional (!stdenv.isCygwin) "--system-libs"
@@ -52,22 +60,18 @@ stdenv.mkDerivation rec {
     ++ ["--"]
     ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF";
 
-  setupHook = ./setup-hook.sh;
-
   dontUseCmakeConfigure = true;
 
-  preConfigure = optionalString (stdenv ? glibc)
-    ''
-      source $setupHook
-      fixCmakeFiles .
-      substituteInPlace Modules/Platform/UnixPaths.cmake \
-        --subst-var-by glibc ${stdenv.glibc}
-    '';
+  enableParallelBuilding = true;
+
+  preInstall = ''mkdir "$doc" '';
+
+  postInstall = ''moveToOutput "share/cmake-*/Help" "$doc" '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://www.cmake.org/;
     description = "Cross-Platform Makefile Generator";
-    platforms = if useQt4 then qt4.meta.platforms else stdenv.lib.platforms.all;
-    maintainers = with stdenv.lib.maintainers; [ urkud mornfall ttuegel ];
+    platforms = if useQt4 then qt4.meta.platforms else platforms.all;
+    maintainers = with maintainers; [ urkud mornfall ttuegel ];
   };
 }