nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 216 lines 6.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 replaceVars, 6 buildPackages, 7 bzip2, 8 curlMinimal, 9 expat, 10 libarchive, 11 libuv, 12 ncurses, 13 openssl, 14 pkg-config, 15 ps, 16 sysctl, 17 rhash, 18 sphinx, 19 texinfo, 20 xz, 21 zlib, 22 darwin, 23 isBootstrap ? null, 24 isMinimalBuild ? ( 25 if isBootstrap != null then 26 lib.warn "isBootstrap argument is deprecated and will be removed; use isMinimalBuild instead" isBootstrap 27 else 28 false 29 ), 30 useOpenSSL ? !isMinimalBuild, 31 useSharedLibraries ? (!isMinimalBuild && !stdenv.hostPlatform.isCygwin), 32 uiToolkits ? [ ], # can contain "ncurses" and/or "qt5" 33 buildDocs ? !(isMinimalBuild || (uiToolkits == [ ])), 34 libsForQt5, 35 gitUpdater, 36}: 37 38let 39 inherit (libsForQt5) qtbase wrapQtAppsHook; 40 cursesUI = lib.elem "ncurses" uiToolkits; 41 qt5UI = lib.elem "qt5" uiToolkits; 42in 43# Accepts only "ncurses" and "qt5" as possible uiToolkits 44assert lib.subtractLists [ "ncurses" "qt5" ] uiToolkits == [ ]; 45# Minimal, bootstrap cmake does not have toolkits 46assert isMinimalBuild -> (uiToolkits == [ ]); 47stdenv.mkDerivation (finalAttrs: { 48 pname = 49 "cmake" 50 + lib.optionalString isMinimalBuild "-minimal" 51 + lib.optionalString cursesUI "-cursesUI" 52 + lib.optionalString qt5UI "-qt5UI"; 53 version = "4.1.2"; 54 55 src = fetchurl { 56 url = "https://cmake.org/files/v${lib.versions.majorMinor finalAttrs.version}/cmake-${finalAttrs.version}.tar.gz"; 57 hash = "sha256-ZD8EGCt7oyOrMfUm94UTT7ecujGIqFIgbvBHP+4oKhU="; 58 }; 59 60 patches = [ 61 # Add NIXPKGS_CMAKE_PREFIX_PATH to cmake which is like CMAKE_PREFIX_PATH 62 # except it is not searched for programs 63 ./nixpkgs-cmake-prefix-path.patch 64 65 # Add the libc paths from the compiler wrapper. 66 ./add-nixpkgs-libc-paths.patch 67 ] 68 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 69 (replaceVars ./darwin-binary-paths.patch { 70 sw_vers = lib.getExe' darwin.DarwinTools "sw_vers"; 71 vm_stat = lib.getExe' darwin.system_cmds "vm_stat"; 72 }) 73 ] 74 ++ lib.optionals (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isFreeBSD) [ 75 (replaceVars ./darwin-bsd-binary-paths.patch { 76 # `ps(1)` is theoretically used on Linux too, but only when 77 # `/proc` is inaccessible, so we can skip the dependency. 78 ps = lib.getExe ps; 79 sysctl = lib.getExe sysctl; 80 }) 81 ] 82 ++ [ 83 # Remove references to non‐Nix search paths. 84 ./remove-impure-search-paths.patch 85 ]; 86 87 outputs = [ 88 "out" 89 ] 90 ++ lib.optionals buildDocs [ 91 "man" 92 "info" 93 ]; 94 separateDebugInfo = true; 95 setOutputFlags = false; 96 97 setupHooks = [ 98 ./setup-hook.sh 99 ./check-pc-files-hook.sh 100 ]; 101 102 depsBuildBuild = [ buildPackages.stdenv.cc ]; 103 104 nativeBuildInputs = 105 finalAttrs.setupHooks 106 ++ [ 107 pkg-config 108 ] 109 ++ lib.optionals buildDocs [ texinfo ] 110 ++ lib.optionals qt5UI [ wrapQtAppsHook ]; 111 112 buildInputs = 113 lib.optionals useSharedLibraries [ 114 bzip2 115 curlMinimal 116 expat 117 libarchive 118 xz 119 zlib 120 libuv 121 rhash 122 ] 123 ++ lib.optional useOpenSSL openssl 124 ++ lib.optional cursesUI ncurses 125 ++ lib.optional qt5UI qtbase; 126 127 preConfigure = '' 128 substituteInPlace Modules/Platform/UnixPaths.cmake \ 129 --subst-var-by libc_bin ${lib.getBin stdenv.cc.libc} \ 130 --subst-var-by libc_dev ${lib.getDev stdenv.cc.libc} \ 131 --subst-var-by libc_lib ${lib.getLib stdenv.cc.libc} 132 # CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake 133 configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags $cmakeFlags" 134 ''; 135 136 # The configuration script is not autoconf-based, although being similar; 137 # triples and other interesting info are passed via CMAKE_* environment 138 # variables and commandline switches 139 configurePlatforms = [ ]; 140 141 configureFlags = [ 142 "--docdir=share/doc/${finalAttrs.pname}-${finalAttrs.version}" 143 ] 144 ++ ( 145 if useSharedLibraries then 146 [ 147 "--no-system-cppdap" 148 "--no-system-jsoncpp" 149 "--system-libs" 150 ] 151 else 152 [ 153 "--no-system-libs" 154 ] 155 ) # FIXME: cleanup 156 ++ lib.optional qt5UI "--qt-gui" 157 ++ lib.optionals buildDocs [ 158 "--sphinx-build=${sphinx}/bin/sphinx-build" 159 "--sphinx-info" 160 "--sphinx-man" 161 ] 162 ++ [ 163 "--" 164 # We should set the proper `CMAKE_SYSTEM_NAME`. 165 # http://www.cmake.org/Wiki/CMake_Cross_Compiling 166 # 167 # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and 168 # strip. Otherwise they are taken to be relative to the source root of the 169 # package being built. 170 (lib.cmakeFeature "CMAKE_CXX_COMPILER" "${stdenv.cc.targetPrefix}c++") 171 (lib.cmakeFeature "CMAKE_C_COMPILER" "${stdenv.cc.targetPrefix}cc") 172 (lib.cmakeFeature "CMAKE_AR" "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar") 173 (lib.cmakeFeature "CMAKE_RANLIB" "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib") 174 (lib.cmakeFeature "CMAKE_STRIP" "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip") 175 176 (lib.cmakeBool "CMAKE_USE_OPENSSL" useOpenSSL) 177 (lib.cmakeBool "BUILD_CursesDialog" cursesUI) 178 ]; 179 180 # make install attempts to use the just-built cmake 181 preInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 182 sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile 183 ''; 184 185 dontUseCmakeConfigure = true; 186 enableParallelBuilding = true; 187 188 doCheck = false; # fails 189 190 passthru.updateScript = gitUpdater { 191 url = "https://gitlab.kitware.com/cmake/cmake.git"; 192 rev-prefix = "v"; 193 ignoredVersions = "-"; # -rc1 and friends 194 }; 195 196 meta = { 197 homepage = "https://cmake.org/"; 198 description = "Cross-platform, open-source build system generator"; 199 longDescription = '' 200 CMake is an open-source, cross-platform family of tools designed to build, 201 test and package software. CMake is used to control the software 202 compilation process using simple platform and compiler independent 203 configuration files, and generate native makefiles and workspaces that can 204 be used in the compiler environment of your choice. 205 ''; 206 changelog = "https://cmake.org/cmake/help/v${lib.versions.majorMinor finalAttrs.version}/release/${lib.versions.majorMinor finalAttrs.version}.html"; 207 license = lib.licenses.bsd3; 208 maintainers = with lib.maintainers; [ 209 ttuegel 210 lnl7 211 ]; 212 platforms = lib.platforms.all; 213 mainProgram = "cmake"; 214 broken = (qt5UI && stdenv.hostPlatform.isDarwin); 215 }; 216})