lol
at v206 78 lines 2.2 kB view raw
1{ stdenv, fetchurl 2, bzip2, curl, expat, libarchive, xz, zlib 3, useNcurses ? false, ncurses, useQt4 ? false, qt4 4, wantPS ? false, ps ? null 5}: 6 7with stdenv.lib; 8 9assert wantPS -> (ps != null); 10 11let 12 os = stdenv.lib.optionalString; 13 majorVersion = "3.3"; 14 minorVersion = "2"; 15 version = "${majorVersion}.${minorVersion}"; 16in 17 18stdenv.mkDerivation rec { 19 name = "cmake-${os useNcurses "cursesUI-"}${os useQt4 "qt4UI-"}${version}"; 20 21 inherit majorVersion; 22 23 src = fetchurl { 24 url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz"; 25 sha256 = "08pwy9ip9cgwgynhn5vrjw8drw29gijy1rmziq22n65zds6ifnp7"; 26 }; 27 28 enableParallelBuilding = true; 29 30 patches = 31 # Don't search in non-Nix locations such as /usr, but do search in 32 # Nixpkgs' Glibc. 33 optional (stdenv ? glibc) ./search-path-3.2.patch ++ 34 optional (stdenv ? cross) (fetchurl { 35 name = "fix-darwin-cross-compile.patch"; 36 url = "http://public.kitware.com/Bug/file_download.php?" 37 + "file_id=4981&type=bug"; 38 sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv"; 39 }) ++ stdenv.lib.optional stdenv.isCygwin ./3.2.2-cygwin.patch; 40 41 buildInputs = 42 [ bzip2 curl expat libarchive xz zlib ] 43 ++ optional useNcurses ncurses 44 ++ optional useQt4 qt4; 45 46 propagatedBuildInputs = optional wantPS ps; 47 48 CMAKE_PREFIX_PATH = stdenv.lib.concatStringsSep ":" buildInputs; 49 50 configureFlags = 51 [ "--docdir=/share/doc/${name}" 52 "--mandir=/share/man" 53 "--no-system-jsoncpp" 54 ] 55 ++ optional (!stdenv.isCygwin) "--system-libs" 56 ++ optional useQt4 "--qt-gui" 57 ++ ["--"] 58 ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF"; 59 60 setupHook = ./setup-hook.sh; 61 62 dontUseCmakeConfigure = true; 63 64 preConfigure = optionalString (stdenv ? glibc) 65 '' 66 source $setupHook 67 fixCmakeFiles . 68 substituteInPlace Modules/Platform/UnixPaths.cmake \ 69 --subst-var-by glibc ${stdenv.glibc} 70 ''; 71 72 meta = { 73 homepage = http://www.cmake.org/; 74 description = "Cross-Platform Makefile Generator"; 75 platforms = if useQt4 then qt4.meta.platforms else stdenv.lib.platforms.all; 76 maintainers = with stdenv.lib.maintainers; [ urkud mornfall ttuegel ]; 77 }; 78}