2015-04-18 02:00:58 -07:00
|
|
|
{ stdenv, fetchurl, pkgconfig
|
2017-06-11 06:27:33 -07:00
|
|
|
, bzip2, curl, expat, libarchive, xz, zlib, libuv, rhash
|
2016-12-29 10:06:50 -08:00
|
|
|
# darwin attributes
|
|
|
|
, ps
|
|
|
|
, isBootstrap ? false
|
2017-06-01 14:23:56 -07:00
|
|
|
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
|
2016-12-29 10:06:50 -08:00
|
|
|
, useNcurses ? false, ncurses
|
|
|
|
, useQt4 ? false, qt4
|
2012-04-23 08:47:31 -07:00
|
|
|
}:
|
2011-07-21 11:21:38 -07:00
|
|
|
|
|
|
|
with stdenv.lib;
|
2007-07-07 15:31:37 -07:00
|
|
|
|
2010-10-01 22:24:39 -07:00
|
|
|
let
|
|
|
|
os = stdenv.lib.optionalString;
|
2017-09-03 14:59:58 -07:00
|
|
|
majorVersion = "3.9";
|
|
|
|
minorVersion = "1";
|
2010-10-01 22:24:39 -07:00
|
|
|
version = "${majorVersion}.${minorVersion}";
|
|
|
|
in
|
2011-07-21 11:21:38 -07:00
|
|
|
|
2008-11-13 13:05:01 -08:00
|
|
|
stdenv.mkDerivation rec {
|
2016-12-29 10:06:50 -08:00
|
|
|
name = "cmake-${os isBootstrap "boot-"}${os useNcurses "cursesUI-"}${os useQt4 "qt4UI-"}${version}";
|
2009-02-13 06:43:01 -08:00
|
|
|
|
2010-10-01 22:24:39 -07:00
|
|
|
inherit majorVersion;
|
2009-04-17 06:48:22 -07:00
|
|
|
|
2008-11-13 13:05:01 -08:00
|
|
|
src = fetchurl {
|
2010-10-01 22:24:39 -07:00
|
|
|
url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
|
2017-09-03 14:59:58 -07:00
|
|
|
# from https://cmake.org/files/v3.9/cmake-3.9.1-SHA-256.txt
|
|
|
|
sha256 = "d768ee83d217f91bb597b3ca2ac663da7a8603c97e1f1a5184bc01e0ad2b12bb";
|
2007-07-07 15:31:37 -07:00
|
|
|
};
|
2009-04-17 06:48:22 -07:00
|
|
|
|
2016-12-29 10:06:50 -08:00
|
|
|
prePatch = optionalString (!useSharedLibraries) ''
|
|
|
|
substituteInPlace Utilities/cmlibarchive/CMakeLists.txt \
|
|
|
|
--replace '"-framework CoreServices"' '""'
|
|
|
|
'';
|
|
|
|
|
2016-10-13 05:58:54 -07:00
|
|
|
# Don't search in non-Nix locations such as /usr, but do search in our libc.
|
2017-09-03 14:59:58 -07:00
|
|
|
patches = [ ./search-path-3.9.patch ]
|
2015-11-28 23:56:40 -08:00
|
|
|
++ optional stdenv.isCygwin ./3.2.2-cygwin.patch;
|
2011-07-21 11:21:38 -07:00
|
|
|
|
2016-05-04 06:23:39 -07:00
|
|
|
outputs = [ "out" ];
|
2015-04-18 13:30:26 -07:00
|
|
|
setOutputFlags = false;
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2015-03-22 15:00:46 -07:00
|
|
|
buildInputs =
|
2016-12-29 10:06:50 -08:00
|
|
|
[ setupHook pkgconfig ]
|
2017-06-11 06:27:33 -07:00
|
|
|
++ optionals useSharedLibraries [ bzip2 curl expat libarchive xz zlib libuv rhash ]
|
2011-02-09 13:08:53 -08:00
|
|
|
++ optional useNcurses ncurses
|
|
|
|
++ optional useQt4 qt4;
|
2010-09-15 11:37:21 -07:00
|
|
|
|
2016-12-29 10:06:50 -08:00
|
|
|
propagatedBuildInputs = optional stdenv.isDarwin ps;
|
2015-04-06 19:48:44 -07:00
|
|
|
|
2016-12-29 10:06:50 -08:00
|
|
|
preConfigure = ''
|
|
|
|
fixCmakeFiles .
|
|
|
|
substituteInPlace Modules/Platform/UnixPaths.cmake \
|
|
|
|
--subst-var-by libc_bin ${getBin stdenv.cc.libc} \
|
|
|
|
--subst-var-by libc_dev ${getDev stdenv.cc.libc} \
|
|
|
|
--subst-var-by libc_lib ${getLib stdenv.cc.libc}
|
|
|
|
substituteInPlace Modules/FindCxxTest.cmake \
|
|
|
|
--replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell}
|
|
|
|
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [ "--docdir=share/doc/${name}" ]
|
|
|
|
++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup
|
2015-05-15 14:31:40 -07:00
|
|
|
++ optional useQt4 "--qt-gui"
|
2016-12-29 10:06:50 -08:00
|
|
|
++ optionals (!useNcurses) [ "--" "-DBUILD_CursesDialog=OFF" ];
|
2010-09-15 11:37:21 -07:00
|
|
|
|
2012-01-20 07:10:28 -08:00
|
|
|
dontUseCmakeConfigure = true;
|
2015-04-18 13:30:26 -07:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2010-09-15 11:37:21 -07:00
|
|
|
homepage = http://www.cmake.org/;
|
|
|
|
description = "Cross-Platform Makefile Generator";
|
2015-04-18 13:30:26 -07:00
|
|
|
platforms = if useQt4 then qt4.meta.platforms else platforms.all;
|
2017-03-27 10:11:17 -07:00
|
|
|
maintainers = with maintainers; [ mornfall ttuegel lnl7 ];
|
2010-09-15 11:37:21 -07:00
|
|
|
};
|
2007-07-07 15:31:37 -07:00
|
|
|
}
|