···
20
-
, SystemConfiguration
22
-
, isBootstrap ? false
23
-
, useOpenSSL ? !isBootstrap
24
-
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
25
-
, uiToolkits ? [] # can contain "ncurses" and/or "qt5"
26
-
, buildDocs ? !(isBootstrap || (uiToolkits == []))
30
-
cursesUI = lib.elem "ncurses" uiToolkits;
31
-
qt5UI = lib.elem "qt5" uiToolkits;
33
-
# Accepts only "ncurses" and "qt5" as possible uiToolkits
34
-
assert lib.subtractLists [ "ncurses" "qt5" ] uiToolkits == [];
35
-
stdenv.mkDerivation rec {
37
-
+ lib.optionalString isBootstrap "-boot"
38
-
+ lib.optionalString cursesUI "-cursesUI"
39
-
+ lib.optionalString qt5UI "-qt5UI";
43
-
url = "https://cmake.org/files/v${lib.versions.majorMinor version}/cmake-${version}.tar.gz";
44
-
sha256 = "sha256-Bv768K2UmJcktW9zMJPCYj9vhDVuW+uVWVf5zj7iiAk=";
48
-
# Don't search in non-Nix locations such as /usr, but do search in our libc.
49
-
./001-search-path.diff
50
-
# Don't depend on frameworks.
51
-
./002-application-services.diff
52
-
# Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d
53
-
./003-libuv-application-services.diff
55
-
++ lib.optional stdenv.isCygwin ./004-cygwin.diff
56
-
# Derived from https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b51
57
-
++ lib.optional (stdenv.isDarwin && isBootstrap) ./005-remove-systemconfiguration-dep.diff
58
-
# On Darwin, always set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG.
59
-
++ lib.optional stdenv.isDarwin ./006-darwin-always-set-runtime-c-flag.diff;
61
-
outputs = [ "out" ] ++ lib.optionals buildDocs [ "man" "info" ];
62
-
setOutputFlags = false;
64
-
setupHook = ./setup-hook.sh;
66
-
depsBuildBuild = [ buildPackages.stdenv.cc ];
68
-
nativeBuildInputs = [
72
-
++ lib.optionals buildDocs [ texinfo ]
73
-
++ lib.optionals qt5UI [ wrapQtAppsHook ];
75
-
buildInputs = lib.optionals useSharedLibraries [
85
-
++ lib.optional useOpenSSL openssl
86
-
++ lib.optional cursesUI ncurses
87
-
++ lib.optional qt5UI qtbase
88
-
++ lib.optional (stdenv.isDarwin && !isBootstrap) SystemConfiguration;
90
-
propagatedBuildInputs = lib.optional stdenv.isDarwin ps;
94
-
substituteInPlace Modules/Platform/UnixPaths.cmake \
95
-
--subst-var-by libc_bin ${lib.getBin stdenv.cc.libc} \
96
-
--subst-var-by libc_dev ${lib.getDev stdenv.cc.libc} \
97
-
--subst-var-by libc_lib ${lib.getLib stdenv.cc.libc}
98
-
# CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake
99
-
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags"
103
-
"CXXFLAGS=-Wno-elaborated-enum-base"
104
-
"--docdir=share/doc/${pname}${version}"
105
-
] ++ (if useSharedLibraries
106
-
then [ "--no-system-jsoncpp" "--system-libs" ]
107
-
else [ "--no-system-libs" ]) # FIXME: cleanup
108
-
++ lib.optional qt5UI "--qt-gui"
109
-
++ lib.optionals buildDocs [
110
-
"--sphinx-build=${sphinx}/bin/sphinx-build"
114
-
# Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20568
115
-
++ lib.optionals stdenv.hostPlatform.is32bit [
116
-
"CFLAGS=-D_FILE_OFFSET_BITS=64"
117
-
"CXXFLAGS=-D_FILE_OFFSET_BITS=64"
121
-
# We should set the proper `CMAKE_SYSTEM_NAME`.
122
-
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
124
-
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
125
-
# strip. Otherwise they are taken to be relative to the source root of the
126
-
# package being built.
127
-
"-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++"
128
-
"-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc"
129
-
"-DCMAKE_AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
130
-
"-DCMAKE_RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
131
-
"-DCMAKE_STRIP=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
133
-
"-DCMAKE_USE_OPENSSL=${if useOpenSSL then "ON" else "OFF"}"
134
-
# Avoid depending on frameworks.
135
-
"-DBUILD_CursesDialog=${if cursesUI then "ON" else "OFF"}"
138
-
# make install attempts to use the just-built cmake
139
-
preInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
140
-
sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
143
-
dontUseCmakeConfigure = true;
144
-
enableParallelBuilding = true;
146
-
# This isn't an autoconf configure script; triples are passed via
147
-
# CMAKE_SYSTEM_NAME, etc.
148
-
configurePlatforms = [ ];
150
-
doCheck = false; # fails
153
-
homepage = "https://cmake.org/";
154
-
description = "Cross-platform, open-source build system generator";
155
-
longDescription = ''
156
-
CMake is an open-source, cross-platform family of tools designed to build,
157
-
test and package software. CMake is used to control the software
158
-
compilation process using simple platform and compiler independent
159
-
configuration files, and generate native makefiles and workspaces that can
160
-
be used in the compiler environment of your choice.
162
-
changelog = "https://cmake.org/cmake/help/v${lib.versions.majorMinor version}/release/${lib.versions.majorMinor version}.html";
163
-
license = licenses.bsd3;
164
-
maintainers = with maintainers; [ ttuegel lnl7 AndersonTorres ];
165
-
platforms = platforms.all;
166
-
broken = (qt5UI && stdenv.isDarwin);