2014-11-08 23:22:51 +03:00
|
|
|
{ stdenv, fetchurl, fetchpatch, substituteAll
|
2017-06-28 20:59:42 +03:00
|
|
|
, hostPlatform
|
2014-11-08 23:22:51 +03:00
|
|
|
, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
|
2013-09-17 07:08:42 +04:00
|
|
|
, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
|
2018-02-24 16:38:25 +03:00
|
|
|
, libmng, which, libGLSupported, libGL, libGLU, openssl, dbus, cups, pkgconfig
|
2013-09-17 07:08:42 +04:00
|
|
|
, libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
|
2017-02-26 23:25:29 +03:00
|
|
|
, buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst-plugins-base
|
2017-01-04 22:23:30 +03:00
|
|
|
, buildWebkit ? (stdenv.isLinux || stdenv.isDarwin)
|
2012-09-29 07:20:34 +04:00
|
|
|
, flashplayerFix ? false, gdk_pixbuf
|
2017-04-13 02:12:35 +03:00
|
|
|
, gtkStyle ? true, gtk2
|
|
|
|
, gnomeStyle ? false, libgnomeui, GConf, gnome_vfs
|
2012-11-27 16:48:48 +04:00
|
|
|
, developerBuild ? false
|
2013-06-01 01:42:44 +04:00
|
|
|
, docs ? false
|
|
|
|
, examples ? false
|
|
|
|
, demos ? false
|
2016-04-15 00:24:52 +03:00
|
|
|
# darwin support
|
|
|
|
, cf-private, libobjc, ApplicationServices, OpenGL, Cocoa, AGL, libcxx
|
2011-12-25 01:52:08 +04:00
|
|
|
}:
|
|
|
|
|
2012-09-29 07:20:34 +04:00
|
|
|
with stdenv.lib;
|
|
|
|
|
2013-07-04 13:37:25 +04:00
|
|
|
let
|
|
|
|
v_maj = "4.8";
|
2015-05-26 21:00:23 +03:00
|
|
|
v_min = "7";
|
2013-07-04 13:37:25 +04:00
|
|
|
vers = "${v_maj}.${v_min}";
|
|
|
|
in
|
2011-12-25 01:52:08 +04:00
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# * move some plugins (e.g., SQL plugins) to dedicated derivations to avoid
|
|
|
|
# false build-time dependencies
|
|
|
|
|
2013-06-09 12:59:23 +04:00
|
|
|
stdenv.mkDerivation rec {
|
2013-07-04 13:37:25 +04:00
|
|
|
name = "qt-${vers}";
|
2011-12-25 01:52:08 +04:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-07-04 13:37:25 +04:00
|
|
|
url = "http://download.qt-project.org/official_releases/qt/"
|
|
|
|
+ "${v_maj}/${vers}/qt-everywhere-opensource-src-${vers}.tar.gz";
|
2015-05-26 21:00:23 +03:00
|
|
|
sha256 = "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272";
|
2011-12-25 01:52:08 +04:00
|
|
|
};
|
|
|
|
|
2016-09-27 15:56:17 +03:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
outputInclude = "out";
|
|
|
|
|
|
|
|
setOutputFlags = false;
|
|
|
|
|
2013-09-30 17:15:25 +04:00
|
|
|
# The version property must be kept because it will be included into the QtSDK package name
|
|
|
|
version = vers;
|
|
|
|
|
2013-06-09 12:59:23 +04: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 07:08:42 +04: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 21:11:30 +03:00
|
|
|
--replace /usr/lib/libstdc++.6.dylib "${stdenv.cc}/lib/libstdc++.6.dylib"
|
2017-03-30 18:02:57 +03:00
|
|
|
'' + stdenv.lib.optionalString stdenv.cc.isClang ''
|
|
|
|
substituteInPlace src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp \
|
|
|
|
--replace 'optionalHeight > 0' 'optionalHeight != NULL'
|
|
|
|
|
|
|
|
substituteInPlace ./tools/linguist/linguist/messagemodel.cpp \
|
|
|
|
--replace 'm->comment()) >= 0' 'm->comment()) != NULL'
|
2013-06-09 12:59:23 +04:00
|
|
|
'';
|
|
|
|
|
2012-09-29 07:20:34 +04:00
|
|
|
patches =
|
|
|
|
[ ./glib-2.32.patch
|
2015-11-29 20:01:20 +03:00
|
|
|
./libressl.patch
|
2017-11-29 12:02:01 +03:00
|
|
|
./parallel-configure.patch
|
2018-02-14 00:16:24 +03:00
|
|
|
./clang-5-darwin.patch
|
2017-12-10 16:43:12 +03:00
|
|
|
./qt-4.8.7-unixmake-darwin.patch
|
2012-09-29 07:20:34 +04:00
|
|
|
(substituteAll {
|
2011-12-25 01:52:08 +04:00
|
|
|
src = ./dlopen-absolute-paths.diff;
|
2017-03-12 20:09:39 +03:00
|
|
|
cups = if cups != null then stdenv.lib.getLib cups else null;
|
2015-10-11 19:00:04 +03:00
|
|
|
icu = icu.out;
|
|
|
|
libXfixes = libXfixes.out;
|
|
|
|
glibc = stdenv.cc.libc.out;
|
2011-12-25 01:52:08 +04:00
|
|
|
})
|
2017-12-10 16:43:12 +03:00
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-medium-font.patch";
|
2018-05-04 01:57:51 +03:00
|
|
|
url = "https://salsa.debian.org/qt-kde-team/qt/qt4-x11/raw/"
|
|
|
|
+ "21b342d71c19e6d68b649947f913410fe6129ea4/debian/patches/kubuntu_39_fix_medium_font.diff";
|
2017-12-10 16:43:12 +03:00
|
|
|
sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "qt4-gcc6.patch";
|
|
|
|
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/qt4-gcc6.patch?h=packages/qt4&id=ca773a144f5abb244ac4f2749eeee9333cac001f";
|
|
|
|
sha256 = "07lrva7bjh6i40p7b3ml26a2jlznri8bh7y7iyx5zmvb1gfxmj34";
|
|
|
|
})
|
|
|
|
]
|
|
|
|
++ stdenv.lib.optional gtkStyle (substituteAll ({
|
2011-12-25 01:52:08 +04:00
|
|
|
src = ./dlopen-gtkstyle.diff;
|
|
|
|
# substituteAll ignores env vars starting with capital letter
|
2016-09-12 00:24:51 +03:00
|
|
|
gtk = gtk2.out;
|
2017-04-13 02:12:35 +03:00
|
|
|
} // stdenv.lib.optionalAttrs gnomeStyle {
|
|
|
|
gconf = GConf.out;
|
2015-10-11 19:00:04 +03:00
|
|
|
libgnomeui = libgnomeui.out;
|
|
|
|
gnome_vfs = gnome_vfs.out;
|
2017-04-13 02:12:35 +03:00
|
|
|
}))
|
2012-09-29 07:20:34 +04:00
|
|
|
++ stdenv.lib.optional flashplayerFix (substituteAll {
|
2011-12-25 01:52:08 +04:00
|
|
|
src = ./dlopen-webkit-nsplugin.diff;
|
2016-09-12 00:24:51 +03:00
|
|
|
gtk = gtk2.out;
|
2015-10-11 19:00:04 +03:00
|
|
|
gdk_pixbuf = gdk_pixbuf.out;
|
2014-11-08 23:22:51 +03:00
|
|
|
})
|
2017-09-17 00:08:10 +03:00
|
|
|
++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
|
|
|
|
url = "https://src.fedoraproject.org/rpms/qt/raw/ecf530486e0fb7fe31bad26805cde61115562b2b/f/qt-aarch64.patch";
|
|
|
|
sha256 = "1fbjh78nmafqmj7yk67qwjbhl3f6ylkp6x33b1dqxfw9gld8b3gl";
|
2017-06-01 16:31:55 +03:00
|
|
|
})
|
|
|
|
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
./qt-musl.patch
|
|
|
|
./qt-musl-iconv-no-bom.patch
|
|
|
|
./patch-qthread-stacksize.diff
|
|
|
|
./qsettings-recursive-global-mutex.patch
|
|
|
|
];
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2013-07-14 06:54:17 +04: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
|
2016-09-27 15:56:17 +03:00
|
|
|
-examplesdir $TMPDIR/share/doc/${name}/examples
|
|
|
|
-demosdir $TMPDIR/share/doc/${name}/demos
|
2013-07-14 06:54:17 +04:00
|
|
|
-datadir $out/share/${name}
|
|
|
|
-translationdir $out/share/${name}/translations
|
2017-11-29 12:02:01 +03:00
|
|
|
--jobs=$NIX_BUILD_CORES
|
2013-07-14 06:54:17 +04:00
|
|
|
"
|
2017-07-21 20:15:09 +03:00
|
|
|
unset LD # Makefile uses gcc for linking; setting LD interferes
|
2015-11-28 18:06:15 +03:00
|
|
|
'' + optionalString stdenv.cc.isClang ''
|
2013-07-14 06:54:17 +04:00
|
|
|
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-25 01:52:08 +04:00
|
|
|
|
2013-06-09 12:59:23 +04:00
|
|
|
prefixKey = "-prefix ";
|
2016-09-27 15:56:17 +03:00
|
|
|
|
2011-12-25 01:52:08 +04:00
|
|
|
configureFlags =
|
|
|
|
''
|
2017-11-30 12:36:16 +03:00
|
|
|
-v -no-separate-debug-info -release -fast -confirm-license -opensource
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2015-11-28 18:06:15 +03:00
|
|
|
-${if stdenv.isFreeBSD then "no-" else ""}opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig
|
2012-03-18 00:57:28 +04:00
|
|
|
-qdbus -${if cups == null then "no-" else ""}cups -glib -dbus-linked -openssl-linked
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2012-03-18 00:57:28 +04:00
|
|
|
${if mysql != null then "-plugin" else "-no"}-sql-mysql -system-sqlite
|
2011-12-25 01:52:08 +04:00
|
|
|
|
|
|
|
-exceptions -xmlpatterns
|
|
|
|
|
|
|
|
-make libs -make tools -make translations
|
2013-06-01 01:42:44 +04:00
|
|
|
-${if demos then "" else "no"}make demos
|
|
|
|
-${if examples then "" else "no"}make examples
|
|
|
|
-${if docs then "" else "no"}make docs
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2012-03-18 00:57:28 +04:00
|
|
|
-no-phonon ${if buildWebkit then "" else "-no"}-webkit ${if buildMultimedia then "" else "-no"}-multimedia -audio-backend
|
2012-11-27 16:48:48 +04:00
|
|
|
${if developerBuild then "-developer-build" else ""}
|
2016-04-15 00:24:52 +03:00
|
|
|
'' + optionalString stdenv.isDarwin "-platform unsupported/macx-clang-libc++";
|
2011-12-25 01:52:08 +04:00
|
|
|
|
|
|
|
propagatedBuildInputs =
|
2013-07-14 06:54:17 +04:00
|
|
|
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
|
2015-10-13 15:33:08 +03:00
|
|
|
libSM zlib libpng openssl dbus freetype fontconfig glib ]
|
2013-08-06 12:33:41 +04: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
|
2018-02-24 16:38:25 +03:00
|
|
|
++ optional libGLSupported libGLU
|
2013-06-18 20:34:25 +04:00
|
|
|
++ optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
|
2017-02-26 23:25:29 +03:00
|
|
|
++ optionals (buildWebkit || buildMultimedia) [ gstreamer gst-plugins-base ];
|
2011-12-25 01:52:08 +04:00
|
|
|
|
|
|
|
# The following libraries are only used in plugins
|
2012-09-29 07:20:34 +04:00
|
|
|
buildInputs =
|
|
|
|
[ cups # Qt dlopen's libcups instead of linking to it
|
2015-11-28 18:06:15 +03:00
|
|
|
postgresql sqlite libjpeg libmng libtiff icu ]
|
2017-07-09 18:43:03 +03:00
|
|
|
++ optionals (mysql != null) [ mysql.connector-c ]
|
2016-09-12 00:24:51 +03:00
|
|
|
++ optionals gtkStyle [ gtk2 gdk_pixbuf ]
|
2016-04-15 00:24:52 +03:00
|
|
|
++ optionals stdenv.isDarwin [ cf-private ApplicationServices OpenGL Cocoa AGL libcxx libobjc ];
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2012-12-28 22:20:09 +04:00
|
|
|
nativeBuildInputs = [ perl pkgconfig which ];
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2017-11-21 22:30:18 +03:00
|
|
|
enableParallelBuilding = true;
|
2011-12-25 01:52:08 +04:00
|
|
|
|
2017-02-04 13:28:09 +03:00
|
|
|
NIX_CFLAGS_COMPILE =
|
2018-02-17 12:16:21 +03:00
|
|
|
# with gcc7 the warnings blow the log over Hydra's limit
|
|
|
|
[ "-Wno-expansion-to-defined" "-Wno-unused-local-typedefs" ]
|
|
|
|
++ optional stdenv.isLinux "-std=gnu++98" # gnu++ in (Obj)C flags is no good on Darwin
|
|
|
|
++ optionals (stdenv.isFreeBSD || stdenv.isDarwin)
|
|
|
|
[ "-I${glib.dev}/include/glib-2.0" "-I${glib.out}/lib/glib-2.0/include" ]
|
|
|
|
++ optional stdenv.isDarwin "-I${libcxx}/include/c++/v1";
|
|
|
|
|
2018-02-17 12:20:58 +03:00
|
|
|
NIX_LDFLAGS = optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-lglib-2.0";
|
2013-07-14 06:54:17 +04:00
|
|
|
|
|
|
|
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
|
2016-04-15 00:24:52 +03:00
|
|
|
find . -name "Makefile*" | xargs sed -i 's/^\(LINK[[:space:]]* = clang++\)/\1 ${NIX_LDFLAGS}/'
|
|
|
|
sed -i 's/^\(LIBS[[:space:]]*=.*$\)/\1 -lobjc/' ./src/corelib/Makefile.Release
|
2013-07-14 06:54:17 +04:00
|
|
|
'';
|
|
|
|
|
2018-04-25 06:20:18 +03:00
|
|
|
doCheck = false; # qwebframe test fails with fontconfig errors
|
|
|
|
|
2017-12-10 16:43:12 +03:00
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/tests
|
2017-10-09 02:53:49 +03:00
|
|
|
'';
|
2016-09-27 15:56:17 +03:00
|
|
|
|
2017-06-28 20:59:42 +03:00
|
|
|
crossAttrs = {
|
2012-06-06 01:21:21 +04:00
|
|
|
# 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
|
2017-06-28 20:59:42 +03:00
|
|
|
'' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
|
2012-06-06 01:21:21 +04:00
|
|
|
patches = [];
|
|
|
|
preConfigure = ''
|
2017-11-25 21:43:57 +03:00
|
|
|
sed -i -e 's/ g++/ ${stdenv.cc.targetPrefix}g++/' \
|
|
|
|
-e 's/ gcc/ ${stdenv.cc.targetPrefix}gcc/' \
|
|
|
|
-e 's/ ar/ ${stdenv.cc.targetPrefix}ar/' \
|
|
|
|
-e 's/ strip/ ${stdenv.cc.targetPrefix}strip/' \
|
|
|
|
-e 's/ windres/ ${stdenv.cc.targetPrefix}windres/' \
|
2012-06-06 01:21:21 +04:00
|
|
|
mkspecs/win32-g++/qmake.conf
|
|
|
|
'';
|
|
|
|
|
|
|
|
# I don't know why it does not install qmake
|
|
|
|
postInstall = ''
|
|
|
|
cp bin/qmake* $out/bin
|
|
|
|
'';
|
2017-04-26 07:06:11 +03:00
|
|
|
configurePlatforms = [];
|
2012-06-06 01:21:21 +04:00
|
|
|
dontStrip = true;
|
2017-06-28 20:59:42 +03:00
|
|
|
} // optionalAttrs hostPlatform.isMinGW {
|
2012-06-06 01:21:21 +04:00
|
|
|
propagatedBuildInputs = [ ];
|
2012-09-29 07:20:34 +04:00
|
|
|
};
|
2012-06-06 01:21:21 +04:00
|
|
|
|
2012-09-29 07:20:34 +04:00
|
|
|
meta = {
|
2013-07-04 09:05:41 +04:00
|
|
|
homepage = http://qt-project.org/;
|
2011-12-25 01:52:08 +04:00
|
|
|
description = "A cross-platform application framework for C++";
|
2014-04-29 11:27:01 +04:00
|
|
|
license = licenses.lgpl21Plus; # or gpl3
|
2017-11-29 12:02:01 +03:00
|
|
|
maintainers = with maintainers; [ orivej lovek323 phreedom sander ];
|
2015-04-07 20:04:14 +03:00
|
|
|
platforms = platforms.unix;
|
2011-12-25 01:52:08 +04:00
|
|
|
};
|
|
|
|
}
|