nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 368 lines 8.8 kB view raw
1{ 2 stdenv, 3 lib, 4 src, 5 version, 6 bison, 7 flex, 8 gperf, 9 lndir, 10 perl, 11 pkg-config, 12 copyPathToStore, 13 makeSetupHook, 14 which, 15 cmake, 16 ninja, 17 libproxy, 18 libxcb-cursor, 19 libxtst, 20 libxdmcp, 21 zstd, 22 double-conversion, 23 util-linux, 24 systemd, 25 systemdSupport ? stdenv.hostPlatform.isLinux, 26 libb2, 27 md4c, 28 mtdev, 29 lksctp-tools, 30 libselinux, 31 libsepol, 32 vulkan-headers, 33 vulkan-loader, 34 libthai, 35 libdrm, 36 libgbm, 37 libdatrie, 38 lttng-ust, 39 libepoxy, 40 dbus, 41 fontconfig, 42 freetype, 43 glib, 44 harfbuzz, 45 icu, 46 libX11, 47 libXcomposite, 48 libXext, 49 libXi, 50 libXrender, 51 libjpeg, 52 libpng, 53 libxcb, 54 libxkbcommon, 55 libxml2, 56 libxslt, 57 openssl, 58 pcre2, 59 sqlite, 60 udev, 61 xcbutil, 62 xcbutilimage, 63 xcbutilkeysyms, 64 xcbutilrenderutil, 65 xcbutilwm, 66 zlib, 67 at-spi2-core, 68 unixODBC, 69 unixODBCDrivers, 70 libGL, 71 # darwin 72 moltenvk, 73 moveBuildTree, 74 darwinVersionInputs, 75 xcbuild, 76 # mingw 77 pkgsBuildBuild, 78 # optional dependencies 79 cups, 80 libmysqlclient, 81 libpq, 82 withGtk3 ? false, 83 gtk3, 84 withLibinput ? false, 85 libinput, 86 withWayland ? lib.meta.availableOn stdenv.hostPlatform wayland, 87 wayland, 88 wayland-scanner, 89 # options 90 qttranslations ? null, 91}: 92 93let 94 isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; 95 fix_qt_builtin_paths = copyPathToStore ../../hooks/fix-qt-builtin-paths.sh; 96 fix_qt_module_paths = copyPathToStore ../../hooks/fix-qt-module-paths.sh; 97 qtPluginPrefix = "lib/qt-6/plugins"; 98 qtQmlPrefix = "lib/qt-6/qml"; 99in 100stdenv.mkDerivation { 101 pname = "qtbase"; 102 103 inherit src version; 104 105 propagatedBuildInputs = [ 106 libxml2 107 libxslt 108 openssl 109 sqlite 110 zlib 111 libGL 112 vulkan-headers 113 vulkan-loader 114 # Text rendering 115 harfbuzz 116 icu 117 # Image formats 118 libjpeg 119 libpng 120 pcre2 121 zstd 122 libb2 123 md4c 124 double-conversion 125 ] 126 ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ 127 libproxy 128 dbus 129 glib 130 # unixODBC drivers 131 unixODBC 132 unixODBCDrivers.psql 133 unixODBCDrivers.sqlite 134 unixODBCDrivers.mariadb 135 ] 136 ++ lib.optionals systemdSupport [ 137 systemd 138 ] 139 ++ lib.optionals stdenv.hostPlatform.isLinux [ 140 util-linux 141 mtdev 142 lksctp-tools 143 libselinux 144 libsepol 145 lttng-ust 146 libthai 147 libdrm 148 libgbm 149 libdatrie 150 udev 151 # Text rendering 152 fontconfig 153 freetype 154 # X11 libs 155 libX11 156 libXcomposite 157 libXext 158 libXi 159 libXrender 160 libxcb 161 libxkbcommon 162 xcbutil 163 xcbutilimage 164 xcbutilkeysyms 165 xcbutilrenderutil 166 xcbutilwm 167 libxdmcp 168 libxtst 169 libxcb-cursor 170 libepoxy 171 ] 172 ++ lib.optional (cups != null && lib.meta.availableOn stdenv.hostPlatform cups) cups 173 ++ lib.optionals withWayland [ 174 wayland 175 wayland-scanner 176 ]; 177 178 buildInputs = 179 lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [ 180 at-spi2-core 181 ] 182 ++ lib.optionals stdenv.hostPlatform.isDarwin (darwinVersionInputs ++ [ moltenvk ]) 183 ++ lib.optional withGtk3 gtk3 184 ++ lib.optional withLibinput libinput 185 ++ lib.optional (libmysqlclient != null && !stdenv.hostPlatform.isMinGW) libmysqlclient 186 ++ lib.optional (libpq != null && lib.meta.availableOn stdenv.hostPlatform libpq) libpq; 187 188 nativeBuildInputs = [ 189 bison 190 flex 191 gperf 192 lndir 193 perl 194 pkg-config 195 which 196 cmake 197 ninja 198 ] 199 ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ]; 200 201 propagatedNativeBuildInputs = [ 202 lndir 203 ] 204 # I’m not sure if this is necessary, but the macOS mkspecs stuff 205 # tries to call `xcrun xcodebuild`, so better safe than sorry. 206 ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ] 207 # wayland-scanner needs to be propagated as both build 208 # (for the wayland-scanner binary) and host (for the 209 # actual wayland.xml protocol definition) 210 ++ lib.optionals withWayland [ 211 wayland 212 wayland-scanner 213 ]; 214 215 strictDeps = true; 216 217 enableParallelBuilding = true; 218 219 patches = [ 220 # look for Qt plugins in directories on PATH 221 ./derive-plugin-load-path-from-PATH.patch 222 223 # allow translations to be found outside of install prefix, as is the case in our split builds 224 ./allow-translations-outside-prefix.patch 225 226 # make internal find_package calls between Qt components work with split builds 227 ./use-cmake-path.patch 228 229 # always link to libraries by name in qmake-generated build scripts 230 ./qmake-always-use-libname.patch 231 # always explicitly list includedir in qmake-generated pkg-config files 232 ./qmake-fix-includedir.patch 233 234 # don't generate SBOM files by default, they don't work with our split installs anyway 235 ./no-sbom.patch 236 237 # use cmake from PATH in qt-cmake wrapper, to avoid qtbase runtime-depending on cmake 238 ./use-cmake-from-path.patch 239 240 # macdeployqt fixes 241 # get qmlimportscanner location from environment variable 242 ./find-qmlimportscanner.patch 243 # pass QML2_IMPORT_PATH from environment to qmlimportscanner 244 ./qmlimportscanner-import-path.patch 245 # don't pass qtbase's QML directory to qmlimportscanner if it's empty 246 ./skip-missing-qml-directory.patch 247 ]; 248 249 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 250 # TODO: Verify that this catches all the occurrences? 251 for file in \ 252 cmake/QtPublicAppleHelpers.cmake \ 253 mkspecs/features/mac/asset_catalogs.prf \ 254 mkspecs/features/mac/default_pre.prf \ 255 mkspecs/features/mac/sdk.mk \ 256 mkspecs/features/mac/sdk.prf \ 257 mkspecs/features/permissions.prf \ 258 src/corelib/Qt6CoreMacros.cmake 259 do 260 substituteInPlace "$file" \ 261 --replace-quiet /usr/bin/xcrun '${lib.getExe' xcbuild "xcrun"}' \ 262 --replace-quiet /usr/bin/xcode-select '${lib.getExe' xcbuild "xcode-select"}' \ 263 --replace-quiet /usr/libexec/PlistBuddy '${lib.getExe' xcbuild "PlistBuddy"}' 264 done 265 266 substituteInPlace mkspecs/common/macx.conf \ 267 --replace-fail 'CONFIG += ' 'CONFIG += no_default_rpath ' 268 ''; 269 270 preHook = '' 271 . ${fix_qt_builtin_paths} 272 . ${fix_qt_module_paths} 273 ''; 274 275 cmakeFlags = [ 276 # makes Qt print the configure summary 277 "--log-level=STATUS" 278 279 "-DQT_EMBED_TOOLCHAIN_COMPILER=OFF" 280 "-DINSTALL_PLUGINSDIR=${qtPluginPrefix}" 281 "-DINSTALL_QMLDIR=${qtQmlPrefix}" 282 "-DQT_FEATURE_libproxy=ON" 283 "-DQT_FEATURE_system_sqlite=ON" 284 "-DQT_FEATURE_openssl_linked=ON" 285 "-DQT_FEATURE_vulkan=ON" 286 # don't leak OS version into the final output 287 # https://bugreports.qt.io/browse/QTBUG-136060 288 "-DCMAKE_SYSTEM_VERSION=" 289 ] 290 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ 291 "-DQT_FEATURE_sctp=ON" 292 "-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}" 293 ] 294 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 295 "-DQT_FEATURE_rpath=OFF" 296 "-DQT_NO_XCODE_MIN_VERSION_CHECK=ON" 297 # This is only used for the min version check, which we disabled above. 298 # When this variable is not set, cmake tries to execute xcodebuild 299 # to query the version. 300 "-DQT_INTERNAL_XCODE_VERSION=0.1" 301 ] 302 ++ lib.optionals isCrossBuild [ 303 "-DQT_HOST_PATH=${pkgsBuildBuild.qt6.qtbase}" 304 "-DQt6HostInfo_DIR=${pkgsBuildBuild.qt6.qtbase}/lib/cmake/Qt6HostInfo" 305 ] 306 ++ lib.optional ( 307 qttranslations != null && !isCrossBuild 308 ) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations"; 309 310 env.NIX_CFLAGS_COMPILE = "-DNIXPKGS_QT_PLUGIN_PREFIX=\"${qtPluginPrefix}\""; 311 312 outputs = [ 313 "out" 314 "dev" 315 ]; 316 separateDebugInfo = true; 317 318 moveToDev = false; 319 320 postFixup = '' 321 moveToOutput "mkspecs/modules" "$dev" 322 fixQtModulePaths "$dev/mkspecs/modules" 323 fixQtBuiltinPaths "$out" '*.pr?' 324 '' 325 + lib.optionalString stdenv.hostPlatform.isLinux '' 326 # FIXME: not sure why this isn't added automatically? 327 patchelf --add-rpath "${libmysqlclient}/lib/mariadb" $out/${qtPluginPrefix}/sqldrivers/libqsqlmysql.so 328 patchelf --add-rpath "${vulkan-loader}/lib" --add-needed "libvulkan.so" $out/lib/libQt6Gui.so 329 ''; 330 331 dontWrapQtApps = true; 332 333 setupHook = 334 let 335 hook = makeSetupHook { 336 name = "qtbase6-setup-hook"; 337 substitutions = { 338 inherit 339 fix_qt_builtin_paths 340 fix_qt_module_paths 341 qtPluginPrefix 342 qtQmlPrefix 343 ; 344 }; 345 } ../../hooks/qtbase-setup-hook.sh; 346 in 347 "${hook}/nix-support/setup-hook"; 348 349 passthru = { 350 inherit qtPluginPrefix qtQmlPrefix; 351 }; 352 353 meta = { 354 homepage = "https://www.qt.io/"; 355 description = "Cross-platform application framework for C++"; 356 license = with lib.licenses; [ 357 fdl13Plus 358 gpl2Plus 359 lgpl21Plus 360 lgpl3Plus 361 ]; 362 maintainers = with lib.maintainers; [ 363 nickcao 364 LunNova 365 ]; 366 platforms = lib.platforms.unix ++ lib.platforms.windows; 367 }; 368}