From 45851fc39abb0172c8c16b66913e22344da8c3fb Mon Sep 17 00:00:00 2001 From: bbenoist Date: Mon, 30 Sep 2013 15:15:25 +0200 Subject: [PATCH] qtcreator: Make the qt package optional and introduce the QtSDK To give the ability to use a different Qt version than the default one (which can build 3 different times Qt Libraries if we mixed the default one, the qtcreator one and the version including all the examples and the docs). Right now a developer can choose to directly install the QtSDK which includes a "full" (developerBuild + docs + examples) Qt version and uses it to build QtCreator. The possibility to only install QtCreator and its previous behavior has been kept for flexibility purposes (we do not need to force someone on the SDK approach). --- .../libraries/qt-4.x/4.8/default.nix | 3 +++ pkgs/development/qtcreator/default.nix | 27 ++++++++++++------- pkgs/top-level/all-packages.nix | 12 +++++++-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix index 59151d35326..72e08d608d1 100644 --- a/pkgs/development/libraries/qt-4.x/4.8/default.nix +++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix @@ -33,6 +33,9 @@ stdenv.mkDerivation rec { sha256 = "0f51dbgn1dcck8pqimls2qyf1pfmsmyknh767cvw87c3d218ywpb"; }; + # The version property must be kept because it will be included into the QtSDK package name + version = vers; + prePatch = '' substituteInPlace configure --replace /bin/pwd pwd substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix index 6cfe5efbe81..b12f81db9c4 100644 --- a/pkgs/development/qtcreator/default.nix +++ b/pkgs/development/qtcreator/default.nix @@ -1,30 +1,39 @@ -{ stdenv, fetchurl, qt48 }: +{ stdenv, fetchurl, qtLib, sdkBuild ? false }: + +with stdenv.lib; let baseVersion = "2.8"; revision = "1"; version = "${baseVersion}.${revision}"; - qt4_for_qtcreator = qt48.override { - developerBuild = true; - }; in stdenv.mkDerivation rec { - name = "qtcreator-${version}"; + # The package name depends on wether we are just building the QtCreator package or the whole Qt SDK + # If we are building the QtCreator package: qtcreator-version + # If we are building the QtSDK package, the Qt version is also included: qtsdk-version-qt-version + name = "qt${if sdkBuild then "sdk" else "creator"}-${version}" + + optionalString sdkBuild "-qt-${qtLib.version}"; src = fetchurl { url = "http://download.qt-project.org/official_releases/qtcreator/${baseVersion}/${version}/qt-creator-${version}-src.tar.gz"; sha256 = "d5ae007a297a4288d0e95fd605edbfb8aee80f6788c7a6cfb9cb297f50c364b9"; }; - buildInputs = [ qt4_for_qtcreator ]; + # This property can be used in a nix development environment to refer to the Qt package + # eg: export QTDIR=${qtSDK.qt} + qt = qtLib; + + # We must only propagate Qt (including qmake) when building the QtSDK + propagatedBuildInputs = if sdkBuild then [ qtLib ] else []; + buildInputs = if sdkBuild == false then [ qtLib ] else []; doCheck = false; enableParallelBuilding = true; preConfigure = '' - qmake -spec linux-g++ "QT_PRIVATE_HEADERS=${qt4_for_qtcreator}/include" qtcreator.pro + qmake -spec linux-g++ "QT_PRIVATE_HEADERS=${qtLib}/include" qtcreator.pro ''; installFlags = "INSTALL_ROOT=$(out)"; @@ -38,7 +47,7 @@ stdenv.mkDerivation rec { ''; homepage = "http://qt-project.org/wiki/Category:Tools::QtCreator"; license = "LGPL"; - maintainers = [ stdenv.lib.maintainers.bbenoist ]; - platforms = stdenv.lib.platforms.all; + maintainers = [ maintainers.bbenoist ]; + platforms = platforms.all; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6ce6f7efe6..7a6f6d40a88 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5438,6 +5438,16 @@ let docs = true; demos = true; examples = true; + developerBuild = true; + }; + + qt4SDK = qtcreator.override { + sdkBuild = true; + qtLib = qt48Full; + }; + + qtcreator = callPackage ../development/qtcreator { + qtLib = qt48.override { developerBuild = true; }; }; qtscriptgenerator = callPackage ../development/libraries/qtscriptgenerator { }; @@ -8511,8 +8521,6 @@ let qsynth = callPackage ../applications/audio/qsynth { }; - qtcreator = callPackage ../development/qtcreator { }; - qtpfsgui = callPackage ../applications/graphics/qtpfsgui { }; qtractor = callPackage ../applications/audio/qtractor { };