2014-11-08 20:22:51 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, substituteAll
|
|
|
|
, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
|
2013-09-17 04:08:42 +01:00
|
|
|
, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
|
|
|
|
, libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
|
|
|
|
, libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
|
2013-06-18 21:00:20 +01:00
|
|
|
, buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst_plugins_base
|
|
|
|
, buildWebkit ? stdenv.isLinux
|
2012-09-29 04:20:34 +01:00
|
|
|
, flashplayerFix ? false, gdk_pixbuf
|
2011-12-24 21:52:08 +00:00
|
|
|
, gtkStyle ? false, libgnomeui, gtk, GConf, gnome_vfs
|
2012-11-27 12:48:48 +00:00
|
|
|
, developerBuild ? false
|
2013-05-31 22:42:44 +01:00
|
|
|
, docs ? false
|
|
|
|
, examples ? false
|
|
|
|
, demos ? false
|
2011-12-24 21:52:08 +00:00
|
|
|
}:
|
|
|
|
|
2012-09-29 04:20:34 +01:00
|
|
|
with stdenv.lib;
|
|
|
|
|
2013-07-04 10:37:25 +01:00
|
|
|
let
|
|
|
|
v_maj = "4.8";
|
2014-04-29 08:27:01 +01:00
|
|
|
v_min = "6";
|
2013-07-04 10:37:25 +01:00
|
|
|
vers = "${v_maj}.${v_min}";
|
|
|
|
in
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# * move some plugins (e.g., SQL plugins) to dedicated derivations to avoid
|
|
|
|
# false build-time dependencies
|
|
|
|
|
2013-06-09 09:59:23 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2013-07-04 10:37:25 +01:00
|
|
|
name = "qt-${vers}";
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-07-04 10:37:25 +01:00
|
|
|
url = "http://download.qt-project.org/official_releases/qt/"
|
|
|
|
+ "${v_maj}/${vers}/qt-everywhere-opensource-src-${vers}.tar.gz";
|
2014-04-29 08:27:01 +01:00
|
|
|
sha256 = "0b036iqgmbbv37dgwwfihw3mihjbnw3kb5kaisdy0qi8nn8xs54b";
|
2011-12-24 21:52:08 +00:00
|
|
|
};
|
|
|
|
|
2013-09-30 14:15:25 +01:00
|
|
|
# The version property must be kept because it will be included into the QtSDK package name
|
|
|
|
version = vers;
|
|
|
|
|
2013-06-09 09:59:23 +01:00
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace configure --replace /bin/pwd pwd
|
|
|
|
substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
|
|
|
|
sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
|
2013-09-17 04:08:42 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# remove impure reference to /usr/lib/libstdc++.6.dylib
|
|
|
|
# there might be more references, but this is the only one I could find
|
|
|
|
substituteInPlace tools/macdeployqt/tests/tst_deployment_mac.cpp \
|
2014-12-17 18:11:30 +00:00
|
|
|
--replace /usr/lib/libstdc++.6.dylib "${stdenv.cc}/lib/libstdc++.6.dylib"
|
2013-06-09 09:59:23 +01:00
|
|
|
'';
|
|
|
|
|
2012-09-29 04:20:34 +01:00
|
|
|
patches =
|
|
|
|
[ ./glib-2.32.patch
|
|
|
|
(substituteAll {
|
2011-12-24 21:52:08 +00:00
|
|
|
src = ./dlopen-absolute-paths.diff;
|
|
|
|
inherit cups icu libXfixes;
|
2014-12-17 18:11:30 +00:00
|
|
|
glibc = stdenv.cc.libc;
|
2013-08-23 08:13:51 +01:00
|
|
|
openglDriver = if mesaSupported then mesa.driverLink else "/no-such-path";
|
2011-12-24 21:52:08 +00:00
|
|
|
})
|
2012-09-29 04:20:34 +01:00
|
|
|
] ++ stdenv.lib.optional gtkStyle (substituteAll {
|
2011-12-24 21:52:08 +00:00
|
|
|
src = ./dlopen-gtkstyle.diff;
|
|
|
|
# substituteAll ignores env vars starting with capital letter
|
2012-09-29 04:20:34 +01:00
|
|
|
gconf = GConf;
|
2011-12-24 21:52:08 +00:00
|
|
|
inherit gnome_vfs libgnomeui gtk;
|
2012-09-29 04:20:34 +01:00
|
|
|
})
|
|
|
|
++ stdenv.lib.optional flashplayerFix (substituteAll {
|
2011-12-24 21:52:08 +00:00
|
|
|
src = ./dlopen-webkit-nsplugin.diff;
|
|
|
|
inherit gtk gdk_pixbuf;
|
2014-11-08 20:22:51 +00:00
|
|
|
})
|
|
|
|
++ [(fetchpatch {
|
|
|
|
name = "fix-medium-font.patch";
|
|
|
|
url = "http://anonscm.debian.org/cgit/pkg-kde/qt/qt4-x11.git/plain/debian/patches/"
|
|
|
|
+ "kubuntu_39_fix_medium_font.diff?id=21b342d71c19e6d68b649947f913410fe6129ea4";
|
|
|
|
sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
|
|
|
|
})];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-07-14 03:54:17 +01:00
|
|
|
preConfigure = ''
|
|
|
|
export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
|
|
|
|
configureFlags+="
|
|
|
|
-docdir $out/share/doc/${name}
|
|
|
|
-plugindir $out/lib/qt4/plugins
|
|
|
|
-importdir $out/lib/qt4/imports
|
|
|
|
-examplesdir $out/share/doc/${name}/examples
|
|
|
|
-demosdir $out/share/doc/${name}/demos
|
|
|
|
-datadir $out/share/${name}
|
|
|
|
-translationdir $out/share/${name}/translations
|
|
|
|
"
|
|
|
|
'' + optionalString stdenv.isDarwin ''
|
|
|
|
sed -i 's/QMAKE_CC = gcc/QMAKE_CC = clang/' mkspecs/common/g++-base.conf
|
|
|
|
sed -i 's/QMAKE_CXX = g++/QMAKE_CXX = clang++/' mkspecs/common/g++-base.conf
|
|
|
|
'';
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-06-09 09:59:23 +01:00
|
|
|
prefixKey = "-prefix ";
|
2011-12-24 21:52:08 +00:00
|
|
|
configureFlags =
|
|
|
|
''
|
|
|
|
-v -no-separate-debug-info -release -no-fast -confirm-license -opensource
|
|
|
|
|
|
|
|
-opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig
|
2012-03-17 20:57:28 +00:00
|
|
|
-qdbus -${if cups == null then "no-" else ""}cups -glib -dbus-linked -openssl-linked
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2012-03-17 20:57:28 +00:00
|
|
|
${if mysql != null then "-plugin" else "-no"}-sql-mysql -system-sqlite
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
-exceptions -xmlpatterns
|
|
|
|
|
|
|
|
-make libs -make tools -make translations
|
2013-05-31 22:42:44 +01:00
|
|
|
-${if demos then "" else "no"}make demos
|
|
|
|
-${if examples then "" else "no"}make examples
|
|
|
|
-${if docs then "" else "no"}make docs
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2012-03-17 20:57:28 +00:00
|
|
|
-no-phonon ${if buildWebkit then "" else "-no"}-webkit ${if buildMultimedia then "" else "-no"}-multimedia -audio-backend
|
2012-11-27 12:48:48 +00:00
|
|
|
${if developerBuild then "-developer-build" else ""}
|
2011-12-24 21:52:08 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs =
|
2013-07-14 03:54:17 +01:00
|
|
|
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
|
|
|
|
libSM zlib libpng openssl dbus.libs freetype fontconfig glib ]
|
2013-08-06 09:33:41 +01:00
|
|
|
# Qt doesn't directly need GLU (just GL), but many apps use, it's small and doesn't remain a runtime-dep if not used
|
2013-08-23 08:13:51 +01:00
|
|
|
++ optional mesaSupported mesa_glu
|
2013-06-18 17:34:25 +01:00
|
|
|
++ optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
|
2012-09-29 04:20:34 +01:00
|
|
|
++ optionals (buildWebkit || buildMultimedia) [ gstreamer gst_plugins_base ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
# The following libraries are only used in plugins
|
2012-09-29 04:20:34 +01:00
|
|
|
buildInputs =
|
|
|
|
[ cups # Qt dlopen's libcups instead of linking to it
|
|
|
|
mysql postgresql sqlite libjpeg libmng libtiff icu ]
|
|
|
|
++ optionals gtkStyle [ gtk gdk_pixbuf ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2012-12-28 18:20:09 +00:00
|
|
|
nativeBuildInputs = [ perl pkgconfig which ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-06-17 09:06:23 +01:00
|
|
|
# occasional build problems if one has too many cores (like on Hydra)
|
|
|
|
# @vcunat has been unable to find a *reliable* fix
|
|
|
|
enableParallelBuilding = false;
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-07-14 03:54:17 +01:00
|
|
|
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
|
|
|
|
"-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include";
|
|
|
|
|
|
|
|
NIX_LDFLAGS = optionalString stdenv.isDarwin
|
|
|
|
"-lglib-2.0";
|
|
|
|
|
|
|
|
preBuild = optionalString stdenv.isDarwin ''
|
|
|
|
# resolve "extra qualification on member" error
|
|
|
|
sed -i 's/struct ::TabletProximityRec;/struct TabletProximityRec;/' \
|
|
|
|
src/gui/kernel/qt_cocoa_helpers_mac_p.h
|
|
|
|
'';
|
|
|
|
|
2012-06-05 22:21:21 +01:00
|
|
|
crossAttrs = let
|
2014-03-03 21:31:18 +00:00
|
|
|
isMingw = stdenv.cross.libc == "msvcrt";
|
2012-06-05 22:21:21 +01:00
|
|
|
in {
|
|
|
|
# I've not tried any case other than i686-pc-mingw32.
|
|
|
|
# -nomake tools: it fails linking some asian language symbols
|
|
|
|
# -no-svg: it fails to build on mingw64
|
|
|
|
configureFlags = ''
|
|
|
|
-static -release -confirm-license -opensource
|
|
|
|
-no-opengl -no-phonon
|
|
|
|
-no-svg
|
|
|
|
-make qmake -make libs -nomake tools
|
|
|
|
-nomake demos -nomake examples -nomake docs
|
2012-09-29 04:20:34 +01:00
|
|
|
'' + optionalString isMingw " -xplatform win32-g++-4.6";
|
2012-06-05 22:21:21 +01:00
|
|
|
patches = [];
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i -e 's/ g++/ ${stdenv.cross.config}-g++/' \
|
|
|
|
-e 's/ gcc/ ${stdenv.cross.config}-gcc/' \
|
|
|
|
-e 's/ ar/ ${stdenv.cross.config}-ar/' \
|
|
|
|
-e 's/ strip/ ${stdenv.cross.config}-strip/' \
|
|
|
|
-e 's/ windres/ ${stdenv.cross.config}-windres/' \
|
|
|
|
mkspecs/win32-g++/qmake.conf
|
|
|
|
'';
|
|
|
|
|
|
|
|
# I don't know why it does not install qmake
|
|
|
|
postInstall = ''
|
|
|
|
cp bin/qmake* $out/bin
|
|
|
|
'';
|
|
|
|
dontSetConfigureCross = true;
|
|
|
|
dontStrip = true;
|
2012-09-29 04:20:34 +01:00
|
|
|
} // optionalAttrs isMingw {
|
2012-06-05 22:21:21 +01:00
|
|
|
propagatedBuildInputs = [ ];
|
2012-09-29 04:20:34 +01:00
|
|
|
};
|
2012-06-05 22:21:21 +01:00
|
|
|
|
2012-09-29 04:20:34 +01:00
|
|
|
meta = {
|
2013-07-04 06:05:41 +01:00
|
|
|
homepage = http://qt-project.org/;
|
2011-12-24 21:52:08 +00:00
|
|
|
description = "A cross-platform application framework for C++";
|
2014-04-29 08:27:01 +01:00
|
|
|
license = licenses.lgpl21Plus; # or gpl3
|
2013-07-04 06:05:41 +01:00
|
|
|
maintainers = with maintainers; [ lovek323 phreedom sander urkud ];
|
2013-11-06 09:58:20 +00:00
|
|
|
platforms = platforms.linux;
|
2011-12-24 21:52:08 +00:00
|
|
|
};
|
|
|
|
}
|