2019-09-19 07:04:54 +00:00
|
|
|
{ mkDerivation, lib, fetchurl, fetchgit, fetchpatch
|
2021-09-29 15:58:07 +00:00
|
|
|
, qtbase, qtquickcontrols, qtscript, qtdeclarative, qmake, llvmPackages_8, elfutils, perf
|
2021-01-21 00:55:55 +00:00
|
|
|
, withDocumentation ? false, withClangPlugins ? true
|
2015-12-20 03:45:37 +00:00
|
|
|
}:
|
2013-09-30 13:15:25 +00:00
|
|
|
|
2019-09-19 07:04:54 +00:00
|
|
|
with lib;
|
2012-10-16 15:30:56 +00:00
|
|
|
|
|
|
|
let
|
2019-05-07 14:18:21 +00:00
|
|
|
# Fetch clang from qt vendor, this contains submodules like this:
|
2019-07-05 15:42:08 +00:00
|
|
|
# clang<-clang-tools-extra<-clazy.
|
2019-08-13 21:52:01 +00:00
|
|
|
clang_qt_vendor = llvmPackages_8.clang-unwrapped.overrideAttrs (oldAttrs: {
|
2022-07-19 14:44:16 +00:00
|
|
|
# file RPATH_CHANGE could not write new RPATH
|
|
|
|
cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ];
|
2019-05-07 14:18:21 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://code.qt.io/clang/clang.git";
|
|
|
|
rev = "c12b012bb7465299490cf93c2ae90499a5c417d5";
|
|
|
|
sha256 = "0mgmnazgr19hnd03xcrv7d932j6dpz88nhhx008b0lv4bah9mqm0";
|
|
|
|
};
|
|
|
|
unpackPhase = "";
|
|
|
|
});
|
2012-10-16 15:30:56 +00:00
|
|
|
in
|
|
|
|
|
2019-09-19 07:04:54 +00:00
|
|
|
mkDerivation rec {
|
2019-05-31 11:56:09 +00:00
|
|
|
pname = "qtcreator";
|
2022-05-18 19:17:02 +00:00
|
|
|
version = "5.0.3";
|
2019-11-05 17:00:42 +00:00
|
|
|
baseVersion = builtins.concatStringsSep "." (lib.take 2 (builtins.splitVersion version));
|
2012-10-16 15:30:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-05-31 11:56:09 +00:00
|
|
|
url = "http://download.qt-project.org/official_releases/${pname}/${baseVersion}/${version}/qt-creator-opensource-src-${version}.tar.xz";
|
2022-05-18 19:17:02 +00:00
|
|
|
sha256 = "1sz21ijzvhf5avblikffykbqa8zdq3sbg32g2dmyxv5w211v3lvz";
|
2012-10-16 15:30:56 +00:00
|
|
|
};
|
|
|
|
|
2021-09-29 15:58:07 +00:00
|
|
|
buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative elfutils.dev ] ++
|
2021-01-21 00:55:55 +00:00
|
|
|
optionals withClangPlugins [ llvmPackages_8.libclang
|
|
|
|
clang_qt_vendor
|
2019-11-05 17:00:42 +00:00
|
|
|
llvmPackages_8.llvm ];
|
2012-10-16 15:30:56 +00:00
|
|
|
|
2019-07-05 15:42:08 +00:00
|
|
|
nativeBuildInputs = [ qmake ];
|
2016-04-16 23:50:41 +00:00
|
|
|
|
2019-07-05 15:42:08 +00:00
|
|
|
# 0001-Fix-clang-libcpp-regexp.patch is for fixing regexp that is used to
|
2019-05-07 14:18:21 +00:00
|
|
|
# find clang libc++ library include paths. By default it's not covering paths
|
|
|
|
# like libc++-version, which is default name for libc++ folder in nixos.
|
2021-01-21 00:55:55 +00:00
|
|
|
# ./0002-Dont-remove-clang-header-paths.patch is for forcing qtcreator to not
|
2019-11-05 17:00:42 +00:00
|
|
|
# remove system clang include paths.
|
2019-07-05 15:42:08 +00:00
|
|
|
patches = [ ./0001-Fix-clang-libcpp-regexp.patch
|
2019-11-05 17:00:42 +00:00
|
|
|
./0002-Dont-remove-clang-header-paths.patch ];
|
2019-05-07 14:18:21 +00:00
|
|
|
|
2016-09-06 11:59:03 +00:00
|
|
|
doCheck = true;
|
2012-10-16 15:30:56 +00:00
|
|
|
|
2016-04-16 23:50:41 +00:00
|
|
|
buildFlags = optional withDocumentation "docs";
|
2014-08-02 18:21:03 +00:00
|
|
|
|
2016-04-16 23:50:41 +00:00
|
|
|
installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
|
2012-10-16 15:30:56 +00:00
|
|
|
|
2021-09-29 15:58:07 +00:00
|
|
|
qtWrapperArgs = [ "--set-default PERFPROFILER_PARSER_FILEPATH ${lib.getBin perf}/bin" ];
|
|
|
|
|
2018-01-04 04:04:03 +00:00
|
|
|
preConfigure = ''
|
|
|
|
substituteInPlace src/plugins/plugins.pro \
|
2021-01-21 00:55:55 +00:00
|
|
|
--replace '$$[QT_INSTALL_QML]/QtQuick/Controls' '${qtquickcontrols}/${qtbase.qtQmlPrefix}/QtQuick/Controls'
|
2021-02-06 16:48:43 +00:00
|
|
|
substituteInPlace src/libs/libs.pro \
|
|
|
|
--replace '$$[QT_INSTALL_QML]/QtQuick/Controls' '${qtquickcontrols}/${qtbase.qtQmlPrefix}/QtQuick/Controls'
|
2019-11-05 17:00:42 +00:00
|
|
|
'' + optionalString withClangPlugins ''
|
2019-05-07 14:18:21 +00:00
|
|
|
# Fix paths for llvm/clang includes directories.
|
|
|
|
substituteInPlace src/shared/clang/clang_defines.pri \
|
|
|
|
--replace '$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)' '${clang_qt_vendor}/lib/clang/8.0.0/include' \
|
|
|
|
--replace '$$clean_path($${LLVM_BINDIR})' '${clang_qt_vendor}/bin'
|
|
|
|
|
|
|
|
# Fix paths to libclang library.
|
|
|
|
substituteInPlace src/shared/clang/clang_installation.pri \
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
--replace 'LIBCLANG_LIBS = -L$${LLVM_LIBDIR}' 'LIBCLANG_LIBS = -L${llvmPackages_8.libclang.lib}/lib' \
|
2019-11-05 17:00:42 +00:00
|
|
|
--replace 'LIBCLANG_LIBS += $${CLANG_LIB}' 'LIBCLANG_LIBS += -lclang' \
|
|
|
|
--replace 'LIBTOOLING_LIBS = -L$${LLVM_LIBDIR}' 'LIBTOOLING_LIBS = -L${clang_qt_vendor}/lib' \
|
|
|
|
--replace 'LLVM_CXXFLAGS ~= s,-gsplit-dwarf,' '${lib.concatStringsSep "\n" ["LLVM_CXXFLAGS ~= s,-gsplit-dwarf," " LLVM_CXXFLAGS += -fno-rtti"]}'
|
2018-01-04 04:04:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-18 00:14:20 +00:00
|
|
|
preBuild = optionalString withDocumentation ''
|
2017-09-27 00:10:16 +00:00
|
|
|
ln -s ${getLib qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
|
2016-12-29 19:30:05 +00:00
|
|
|
'';
|
|
|
|
|
2014-08-02 18:37:39 +00:00
|
|
|
postInstall = ''
|
2021-10-21 21:58:42 +00:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cp share/applications/org.qt-project.qtcreator.desktop $out/share/applications
|
2017-06-18 09:36:41 +00:00
|
|
|
substituteInPlace $out/share/applications/org.qt-project.qtcreator.desktop \
|
|
|
|
--replace "Exec=qtcreator" "Exec=$out/bin/qtcreator"
|
2014-08-02 18:37:39 +00:00
|
|
|
'';
|
|
|
|
|
2012-10-16 15:30:56 +00:00
|
|
|
meta = {
|
2013-10-06 09:49:53 +00:00
|
|
|
description = "Cross-platform IDE tailored to the needs of Qt developers";
|
2012-10-16 15:30:56 +00:00
|
|
|
longDescription = ''
|
2013-10-06 09:49:53 +00:00
|
|
|
Qt Creator is a cross-platform IDE (integrated development environment)
|
|
|
|
tailored to the needs of Qt developers. It includes features such as an
|
|
|
|
advanced code editor, a visual debugger and a GUI designer.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://wiki.qt.io/Category:Tools::QtCreator";
|
2012-10-16 15:30:56 +00:00
|
|
|
license = "LGPL";
|
2017-03-23 02:02:09 +00:00
|
|
|
maintainers = [ maintainers.akaWolf ];
|
2018-08-18 18:18:32 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
|
2012-10-16 15:30:56 +00:00
|
|
|
};
|
|
|
|
}
|