2018-07-24 20:25:18 +00:00
|
|
|
{ stdenv, lib, fetchurl, fetchpatch, substituteAll
|
2018-07-21 00:44:44 +00:00
|
|
|
, libXrender, libXinerama, libXcursor, libXv, libXext
|
2013-09-17 03:08:42 +00:00
|
|
|
, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
|
2021-01-19 06:50:56 +00:00
|
|
|
, libmng, which, libGLU, openssl, dbus, cups, pkg-config
|
2019-09-22 07:38:09 +00:00
|
|
|
, libtiff, glib, icu, libmysqlclient, postgresql, sqlite, perl, coreutils, libXi
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2021-01-23 17:15:07 +00:00
|
|
|
, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms
|
2021-02-07 22:08:22 +00:00
|
|
|
, gtkStyle ? stdenv.hostPlatform == stdenv.buildPlatform, gtk2, gdk-pixbuf
|
2017-04-12 23:12:35 +00:00
|
|
|
, gnomeStyle ? false, libgnomeui, GConf, gnome_vfs
|
2012-11-27 12:48:48 +00:00
|
|
|
, developerBuild ? false
|
2013-05-31 21:42:44 +00:00
|
|
|
, docs ? false
|
|
|
|
, examples ? false
|
|
|
|
, demos ? false
|
2016-04-14 21:24:52 +00:00
|
|
|
# darwin support
|
2019-06-19 18:28:41 +00:00
|
|
|
, libobjc, ApplicationServices, OpenGL, Cocoa, AGL, libcxx
|
2011-12-24 21:52:08 +00:00
|
|
|
}:
|
|
|
|
|
2013-07-04 09:37:25 +00:00
|
|
|
let
|
|
|
|
v_maj = "4.8";
|
2015-05-26 18:00:23 +00:00
|
|
|
v_min = "7";
|
2013-07-04 09:37:25 +00: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 08:59:23 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2013-07-04 09:37:25 +00:00
|
|
|
name = "qt-${vers}";
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-07-04 09:37:25 +00:00
|
|
|
url = "http://download.qt-project.org/official_releases/qt/"
|
|
|
|
+ "${v_maj}/${vers}/qt-everywhere-opensource-src-${vers}.tar.gz";
|
2015-05-26 18:00:23 +00:00
|
|
|
sha256 = "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272";
|
2011-12-24 21:52:08 +00:00
|
|
|
};
|
|
|
|
|
2016-09-27 12:56:17 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
outputInclude = "out";
|
|
|
|
|
|
|
|
setOutputFlags = false;
|
|
|
|
|
2013-09-30 13:15:25 +00:00
|
|
|
# The version property must be kept because it will be included into the QtSDK package name
|
|
|
|
version = vers;
|
|
|
|
|
2013-06-09 08:59:23 +00:00
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace configure --replace /bin/pwd pwd
|
|
|
|
substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
|
2019-08-22 11:24:56 +00:00
|
|
|
substituteInPlace src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp \
|
|
|
|
--replace 'asm volatile' 'asm'
|
2013-06-09 08:59:23 +00:00
|
|
|
sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
|
2018-07-24 20:25:18 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2013-09-17 03:08:42 +00:00
|
|
|
# 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"
|
2018-07-24 20:25:18 +00:00
|
|
|
'' + lib.optionalString stdenv.cc.isClang ''
|
2017-03-30 15:02:57 +00:00
|
|
|
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 08:59:23 +00:00
|
|
|
'';
|
|
|
|
|
2012-09-29 03:20:34 +00:00
|
|
|
patches =
|
2018-07-24 20:25:18 +00:00
|
|
|
lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
|
|
|
|
./glib-2.32.patch
|
2015-11-29 17:01:20 +00:00
|
|
|
./libressl.patch
|
2017-11-29 09:02:01 +00:00
|
|
|
./parallel-configure.patch
|
2018-02-13 21:16:24 +00:00
|
|
|
./clang-5-darwin.patch
|
2017-12-10 13:43:12 +00:00
|
|
|
./qt-4.8.7-unixmake-darwin.patch
|
2018-09-17 01:04:04 +00:00
|
|
|
./kill-legacy-darwin-apis.patch
|
2012-09-29 03:20:34 +00:00
|
|
|
(substituteAll {
|
2011-12-24 21:52:08 +00:00
|
|
|
src = ./dlopen-absolute-paths.diff;
|
2018-07-24 20:25:18 +00:00
|
|
|
cups = if cups != null then lib.getLib cups else null;
|
2015-10-11 16:00:04 +00:00
|
|
|
icu = icu.out;
|
|
|
|
libXfixes = libXfixes.out;
|
|
|
|
glibc = stdenv.cc.libc.out;
|
2011-12-24 21:52:08 +00:00
|
|
|
})
|
2017-12-10 13:43:12 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-medium-font.patch";
|
2018-05-03 22:57:51 +00: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 13:43:12 +00:00
|
|
|
sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
|
|
|
|
})
|
2019-08-21 12:25:13 +00:00
|
|
|
# Patches are no longer available from here, so vendoring it for now.
|
2019-08-15 15:25:48 +00:00
|
|
|
#(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";
|
|
|
|
#})
|
|
|
|
./qt4-gcc6.patch
|
2019-08-21 12:25:13 +00:00
|
|
|
./qt4-openssl-1.1.patch
|
2019-11-04 13:08:49 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc9-foreach.patch";
|
|
|
|
url = "https://salsa.debian.org/qt-kde-team/qt/qt4-x11/raw/"
|
|
|
|
+ "0d4a3dd61ccb156dee556c214dbe91c04d44a717/debian/patches/gcc9-qforeach.patch";
|
|
|
|
sha256 = "0dzn6qxrgxb75rvck9kmy5gspawdn970wsjw56026dhkih8cp3pg";
|
|
|
|
})
|
2021-11-29 08:57:53 +00:00
|
|
|
|
|
|
|
# Pull upstream fix for gcc-11 support.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc11-ptr-cmp.patch";
|
|
|
|
url = "https://github.com/qt/qttools/commit/7138c963f9d1258bc1b49cb4d63c3e2b7d0ccfda.patch";
|
|
|
|
sha256 = "1a9g05r267c94qpw3ssb6k4lci200vla3vm5hri1nna6xwdsmrhc";
|
|
|
|
# "src/" -> "tools/"
|
|
|
|
stripLen = 2;
|
|
|
|
extraPrefix = "tools/";
|
|
|
|
})
|
2017-12-10 13:43:12 +00:00
|
|
|
]
|
2018-07-24 20:25:18 +00:00
|
|
|
++ lib.optional gtkStyle (substituteAll ({
|
2011-12-24 21:52:08 +00:00
|
|
|
src = ./dlopen-gtkstyle.diff;
|
|
|
|
# substituteAll ignores env vars starting with capital letter
|
2016-09-11 21:24:51 +00:00
|
|
|
gtk = gtk2.out;
|
2018-07-24 20:25:18 +00:00
|
|
|
} // lib.optionalAttrs gnomeStyle {
|
2017-04-12 23:12:35 +00:00
|
|
|
gconf = GConf.out;
|
2015-10-11 16:00:04 +00:00
|
|
|
libgnomeui = libgnomeui.out;
|
|
|
|
gnome_vfs = gnome_vfs.out;
|
2017-04-12 23:12:35 +00:00
|
|
|
}))
|
2018-07-24 20:25:18 +00:00
|
|
|
++ lib.optional stdenv.isAarch64 (fetchpatch {
|
2017-09-16 21:08:10 +00:00
|
|
|
url = "https://src.fedoraproject.org/rpms/qt/raw/ecf530486e0fb7fe31bad26805cde61115562b2b/f/qt-aarch64.patch";
|
|
|
|
sha256 = "1fbjh78nmafqmj7yk67qwjbhl3f6ylkp6x33b1dqxfw9gld8b3gl";
|
2017-06-01 13:31:55 +00:00
|
|
|
})
|
2018-07-24 20:25:18 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isMusl [
|
2017-06-01 13:31:55 +00:00
|
|
|
./qt-musl.patch
|
|
|
|
./qt-musl-iconv-no-bom.patch
|
|
|
|
./patch-qthread-stacksize.diff
|
|
|
|
./qsettings-recursive-global-mutex.patch
|
|
|
|
];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-07-14 02:54:17 +00:00
|
|
|
preConfigure = ''
|
2020-01-02 00:29:34 +00:00
|
|
|
export LD_LIBRARY_PATH="`pwd`/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
|
2013-07-14 02:54:17 +00:00
|
|
|
configureFlags+="
|
|
|
|
-docdir $out/share/doc/${name}
|
|
|
|
-plugindir $out/lib/qt4/plugins
|
|
|
|
-importdir $out/lib/qt4/imports
|
2016-09-27 12:56:17 +00:00
|
|
|
-examplesdir $TMPDIR/share/doc/${name}/examples
|
|
|
|
-demosdir $TMPDIR/share/doc/${name}/demos
|
2013-07-14 02:54:17 +00:00
|
|
|
-datadir $out/share/${name}
|
|
|
|
-translationdir $out/share/${name}/translations
|
2017-11-29 09:02:01 +00:00
|
|
|
--jobs=$NIX_BUILD_CORES
|
2013-07-14 02:54:17 +00:00
|
|
|
"
|
2017-07-21 17:15:09 +00:00
|
|
|
unset LD # Makefile uses gcc for linking; setting LD interferes
|
2018-07-24 20:25:18 +00:00
|
|
|
'' + lib.optionalString stdenv.cc.isClang ''
|
2013-07-14 02:54:17 +00: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
|
2018-07-24 20:25:18 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isWindows ''
|
|
|
|
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/' \
|
|
|
|
mkspecs/win32-g++/qmake.conf
|
2013-07-14 02:54:17 +00:00
|
|
|
'';
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2013-06-09 08:59:23 +00:00
|
|
|
prefixKey = "-prefix ";
|
2016-09-27 12:56:17 +00:00
|
|
|
|
2018-07-24 20:25:18 +00:00
|
|
|
configurePlatforms = [];
|
2018-07-24 20:25:18 +00:00
|
|
|
configureFlags = let
|
2018-08-13 13:35:19 +00:00
|
|
|
mk = cond: name: "-${lib.optionalString (!cond) "no-"}${name}";
|
2018-07-24 20:25:18 +00:00
|
|
|
platformFlag =
|
|
|
|
if stdenv.hostPlatform != stdenv.buildPlatform
|
|
|
|
then "-xplatform"
|
|
|
|
else "-platform";
|
2018-07-24 20:25:18 +00:00
|
|
|
in (if stdenv.hostPlatform != stdenv.buildPlatform then [
|
|
|
|
# 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
|
|
|
|
"-static" "-release" "-confirm-license" "-opensource"
|
|
|
|
"-no-opengl" "-no-phonon"
|
|
|
|
"-no-svg"
|
|
|
|
"-make" "qmake" "-make" "libs" "-nomake" "tools"
|
|
|
|
] else [
|
|
|
|
"-v" "-no-separate-debug-info" "-release" "-fast" "-confirm-license" "-opensource"
|
|
|
|
|
|
|
|
(mk (!stdenv.isFreeBSD) "opengl") "-xrender" "-xrandr" "-xinerama" "-xcursor" "-xinput" "-xfixes" "-fontconfig"
|
|
|
|
"-qdbus" (mk (cups != null) "cups") "-glib" "-dbus-linked" "-openssl-linked"
|
|
|
|
|
2019-09-22 07:38:09 +00:00
|
|
|
"-${if libmysqlclient != null then "plugin" else "no"}-sql-mysql" "-system-sqlite"
|
2018-07-24 20:25:18 +00:00
|
|
|
|
|
|
|
"-exceptions" "-xmlpatterns"
|
|
|
|
|
|
|
|
"-make" "libs" "-make" "tools" "-make" "translations"
|
2020-09-02 00:13:41 +00:00
|
|
|
"-no-phonon" "-no-webkit" "-no-multimedia" "-audio-backend"
|
2018-07-24 20:25:18 +00:00
|
|
|
]) ++ [
|
2018-08-13 13:35:19 +00:00
|
|
|
"-${if demos then "" else "no"}make" "demos"
|
|
|
|
"-${if examples then "" else "no"}make" "examples"
|
|
|
|
"-${if docs then "" else "no"}make" "docs"
|
2018-07-24 20:25:18 +00:00
|
|
|
] ++ lib.optional developerBuild "-developer-build"
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ platformFlag "unsupported/macx-clang-libc++" ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isWindows [ platformFlag "win32-g++-4.6" ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs =
|
2013-07-14 02:54:17 +00:00
|
|
|
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
|
2015-10-13 12:33:08 +00:00
|
|
|
libSM zlib libpng openssl dbus freetype fontconfig glib ]
|
2013-08-06 08:33:41 +00: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
|
2020-09-02 00:13:41 +00:00
|
|
|
++ lib.optional libGLSupported libGLU;
|
2011-12-24 21:52:08 +00:00
|
|
|
|
|
|
|
# The following libraries are only used in plugins
|
2012-09-29 03:20:34 +00:00
|
|
|
buildInputs =
|
|
|
|
[ cups # Qt dlopen's libcups instead of linking to it
|
2015-11-28 15:06:15 +00:00
|
|
|
postgresql sqlite libjpeg libmng libtiff icu ]
|
2019-09-22 07:38:09 +00:00
|
|
|
++ lib.optionals (libmysqlclient != null) [ libmysqlclient ]
|
2019-05-22 11:03:39 +00:00
|
|
|
++ lib.optionals gtkStyle [ gtk2 gdk-pixbuf ]
|
2019-06-19 18:28:41 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ ApplicationServices OpenGL Cocoa AGL libcxx libobjc ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ perl pkg-config which ];
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2017-11-21 19:30:18 +00:00
|
|
|
enableParallelBuilding = true;
|
2011-12-24 21:52:08 +00:00
|
|
|
|
2019-10-30 00:40:49 +00:00
|
|
|
NIX_CFLAGS_COMPILE = toString (
|
2018-02-17 09:16:21 +00:00
|
|
|
# with gcc7 the warnings blow the log over Hydra's limit
|
|
|
|
[ "-Wno-expansion-to-defined" "-Wno-unused-local-typedefs" ]
|
2018-07-24 20:25:18 +00:00
|
|
|
++ lib.optional stdenv.isLinux "-std=gnu++98" # gnu++ in (Obj)C flags is no good on Darwin
|
|
|
|
++ lib.optionals (stdenv.isFreeBSD || stdenv.isDarwin)
|
2018-02-17 09:16:21 +00:00
|
|
|
[ "-I${glib.dev}/include/glib-2.0" "-I${glib.out}/lib/glib-2.0/include" ]
|
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
|
|
|
++ lib.optional stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1");
|
2018-02-17 09:16:21 +00:00
|
|
|
|
2018-07-24 20:25:18 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-lglib-2.0";
|
2013-07-14 02:54:17 +00:00
|
|
|
|
2018-07-24 20:25:18 +00:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
2013-07-14 02:54:17 +00:00
|
|
|
# resolve "extra qualification on member" error
|
|
|
|
sed -i 's/struct ::TabletProximityRec;/struct TabletProximityRec;/' \
|
|
|
|
src/gui/kernel/qt_cocoa_helpers_mac_p.h
|
2016-04-14 21:24:52 +00: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 02:54:17 +00:00
|
|
|
'';
|
|
|
|
|
2018-04-25 03:20:18 +00:00
|
|
|
doCheck = false; # qwebframe test fails with fontconfig errors
|
|
|
|
|
2017-12-10 13:43:12 +00:00
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/tests
|
2018-07-24 20:25:18 +00:00
|
|
|
''
|
|
|
|
# I don't know why it does not install qmake
|
|
|
|
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
|
|
|
cp bin/qmake* $out/bin
|
2017-10-08 23:53:49 +00:00
|
|
|
'';
|
2016-09-27 12:56:17 +00:00
|
|
|
|
2018-07-24 20:25:18 +00:00
|
|
|
dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
|
2012-06-05 21:21:21 +00:00
|
|
|
|
2012-09-29 03:20:34 +00:00
|
|
|
meta = {
|
2021-07-31 17:01:50 +00:00
|
|
|
homepage = "https://qt-project.org/";
|
2011-12-24 21:52:08 +00:00
|
|
|
description = "A cross-platform application framework for C++";
|
2018-07-24 20:25:18 +00:00
|
|
|
license = lib.licenses.lgpl21Plus; # or gpl3
|
2021-12-18 09:25:46 +00:00
|
|
|
maintainers = with lib.maintainers; [ orivej lovek323 sander ];
|
2018-07-24 20:25:18 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2019-04-25 00:11:07 +00:00
|
|
|
badPlatforms = [ "x86_64-darwin" ];
|
2011-12-24 21:52:08 +00:00
|
|
|
};
|
|
|
|
}
|