Hardcode paths to many dlopen()ed libraries. This should fix:
* Print dialog fails to find CUPS;
* flashplugin.
Add optional support for GTK style. Disabled by default.

svn path=/nixpkgs/trunk/; revision=31064
This commit is contained in:
Yury G. Kudryashov 2011-12-24 21:52:08 +00:00
parent aa49dde3d9
commit 6b5dff3bb9
5 changed files with 267 additions and 0 deletions

View File

@ -0,0 +1,109 @@
{ stdenv, fetchurl, substituteAll
, alsaLib, gstreamer, gstPluginsBase
, libXrender, libXinerama, libXcursor, libXmu , libXv, libXext
, libXfixes, libXrandr, libSM, freetype, fontconfig
, zlib, libjpeg, libpng, libmng, which, mesa, openssl, dbus, cups, pkgconfig
, libtiff, glib, icu
, mysql, postgresql, sqlite
, perl, coreutils, libXi
, flashplayerFix ? true, gdk_pixbuf
, gtkStyle ? false, libgnomeui, gtk, GConf, gnome_vfs
}:
let
v = "4.8.0";
in
# TODO:
# * move some plugins (e.g., SQL plugins) to dedicated derivations to avoid
# false build-time dependencies
stdenv.mkDerivation rec {
name = "qt-${v}";
src = fetchurl {
url = "ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-${v}.tar.gz";
sha256 = "0vhb6bysjqz8l0dygg2yypm4frsggma2g9877rdgf5ay917bg4lk";
};
patches = [ ( substituteAll {
src = ./dlopen-absolute-paths.diff;
inherit cups icu libXfixes;
glibc = stdenv.gcc.libc;
})
] ++ stdenv.lib.optional gtkStyle (
substituteAll {
src = ./dlopen-gtkstyle.diff;
# substituteAll ignores env vars starting with capital letter
gconf = GConf;
inherit gnome_vfs libgnomeui gtk;
}
) ++ stdenv.lib.optional flashplayerFix (
substituteAll {
src = ./dlopen-webkit-nsplugin.diff;
inherit gtk gdk_pixbuf;
}
);
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
"
'';
configureFlags =
''
-v -no-separate-debug-info -release -no-fast -confirm-license -opensource
-opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig
-qdbus -cups -glib -dbus-linked -openssl-linked
-plugin-sql-mysql -system-sqlite
-exceptions -xmlpatterns
-make libs -make tools -make translations
-nomake demos -nomake examples -nomake docs
-no-phonon -webkit -multimedia -audio-backend
'';
propagatedBuildInputs =
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes
libXv libXi libSM mesa
alsaLib zlib libpng openssl dbus.libs freetype fontconfig glib
gstreamer gstPluginsBase
];
# The following libraries are only used in plugins
buildInputs = [ cups # Qt dlopen's libcups instead of linking to it
mysql postgresql sqlite libjpeg libmng libtiff icu ];
buildNativeInputs = [ perl pkgconfig which ];
prefixKey = "-prefix ";
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
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {
homepage = http://qt.nokia.com/products;
description = "A cross-platform application framework for C++";
license = "GPL/LGPL";
maintainers = with maintainers; [ urkud sander ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,64 @@
--- a/src/gui/painting/qcups.cpp 2011-12-08 09:06:02.000000000 +0400
+++ b/src/gui/painting/qcups.cpp 2011-12-18 12:17:07.000000000 +0400
@@ -87,7 +87,7 @@
static void resolveCups()
{
- QLibrary cupsLib(QLatin1String("cups"), 2);
+ QLibrary cupsLib(QLatin1String("@cups@/lib/libcups"), 2);
if(cupsLib.load()) {
_cupsGetDests = (CupsGetDests) cupsLib.resolve("cupsGetDests");
_cupsFreeDests = (CupsFreeDests) cupsLib.resolve("cupsFreeDests");
--- a/src/gui/painting/qprinterinfo_unix.cpp 2011-12-08 09:06:02.000000000 +0400
+++ b/src/gui/painting/qprinterinfo_unix.cpp 2011-12-23 16:22:15.000000000 +0400
@@ -454,7 +454,7 @@
char *domain;
int err;
- QLibrary lib(QLatin1String("nsl"));
+ QLibrary lib(QLatin1String("@glibc@/lib/libnsl"));
typedef int (*ypGetDefaultDomain)(char **);
ypGetDefaultDomain _ypGetDefaultDomain = (ypGetDefaultDomain)lib.resolve("yp_get_default_domain");
typedef int (*ypAll)(const char *, const char *, const struct ypall_callback *);
--- a/src/network/kernel/qhostinfo_unix.cpp 2011-12-23 16:26:07.000000000 +0400
+++ b/src/network/kernel/qhostinfo_unix.cpp 2011-12-23 16:25:55.000000000 +0400
@@ -95,7 +95,7 @@
static void resolveLibrary()
{
#ifndef QT_NO_LIBRARY
- QLibrary lib(QLatin1String("resolv"));
+ QLibrary lib(QLatin1String("@glibc@/lib/libresolv"));
if (!lib.load())
return;
--- a/src/corelib/tools/qlocale_icu.cpp 2011-12-08 09:06:03.000000000 +0400
+++ b/src/corelib/tools/qlocale_icu.cpp 2011-12-23 16:29:15.000000000 +0400
@@ -81,7 +81,7 @@
if (status == NotLoaded) {
// resolve libicui18n
- QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT));
+ QLibrary lib(QLatin1String("@icu@/lib/libicui18n"), QLatin1String(U_ICU_VERSION_SHORT));
if (!lib.load()) {
qWarning() << "Unable to load library icui18n" << lib.errorString();
status = ErrorLoading;
@@ -110,7 +110,7 @@
}
// resolve libicuuc
- QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT));
+ QLibrary ucLib(QLatin1String("@icu@/lib/libicuuc"), QLatin1String(U_ICU_VERSION_SHORT));
if (!ucLib.load()) {
qWarning() << "Unable to load library icuuc" << ucLib.errorString();
status = ErrorLoading;
--- a/src/plugins/platforms/xlib/qxlibstatic.cpp 2011-12-08 09:06:02.000000000 +0400
+++ b/src/plugins/platforms/xlib/qxlibstatic.cpp 2011-12-23 20:38:49.000000000 +0400
@@ -242,7 +242,7 @@
}
# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \
- (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol);
+ (symbol_type)qt_load_library_runtime("@libXfixes@/lib/libXfixes", vernum, 4, #symbol);
# define XFIXES_LOAD_V1(symbol) \
XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol)
# define XFIXES_LOAD_V2(symbol) \

View File

@ -0,0 +1,35 @@
--- a/src/gui/styles/qgtkstyle_p.cpp 2011-12-08 09:06:02.000000000 +0400
+++ b/src/gui/styles/qgtkstyle_p.cpp 2011-12-24 17:56:46.000000000 +0400
@@ -312,7 +312,7 @@
void QGtkStylePrivate::resolveGtk() const
{
// enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
- QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
+ QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
@@ -434,8 +434,8 @@
pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
- gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync");
- gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init");
+ gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("@libgnomeui@/lib/libgnomeui-2"), 0, "gnome_icon_lookup_sync");
+ gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("@gnome_vfs@/lib/libgnomevfs-2"), 0, "gnome_vfs_init");
}
/* \internal
@@ -607,9 +607,9 @@
static bool resolveGConf()
{
if (!QGtkStylePrivate::gconf_client_get_default) {
- QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
- QGtkStylePrivate::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
- QGtkStylePrivate::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
+ QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_default");
+ QGtkStylePrivate::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_string");
+ QGtkStylePrivate::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_bool");
}
return (QGtkStylePrivate::gconf_client_get_default !=0);
}

View File

@ -0,0 +1,52 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
index 19941d6..0ec15e2 100644
--- a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
@@ -121,7 +121,7 @@ static void initializeGtk(QLibrary* module = 0)
}
}
- QLibrary library(QLatin1String("libgtk-x11-2.0.so.0"));
+ QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
if (library.load()) {
typedef void *(*gtk_init_check_ptr)(int*, char***);
gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
index 2fe69d1..b658e4a 100644
--- a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
@@ -857,7 +857,7 @@ static Display *getPluginDisplay()
// support gdk based plugins (like flash) that use a different X connection.
// The code below has the same effect as this one:
// Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
+ QLibrary library(QLatin1String("@gdk_pixbuf@/lib/libgdk-x11-2.0"), 0);
if (!library.load())
return 0;
diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
index 2c9b465..56b3074 100644
--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
@@ -42,7 +42,7 @@ namespace WebKit {
#if PLATFORM(QT)
static void initializeGTK()
{
- QLibrary library(QLatin1String("libgtk-x11-2.0.so.0"));
+ QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
if (library.load()) {
typedef void *(*gtk_init_check_ptr)(int*, char***);
gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check"));
diff --git a/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
index b8c8f2a..e7f4dc5 100644
--- a/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+++ b/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
@@ -54,7 +54,7 @@ static Display *getPluginDisplay()
// The code below has the same effect as this one:
// Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
+ QLibrary library(QLatin1String("@gdk_pixbuf@/lib/libgdk-x11-2.0"), 0);
if (!library.load())
return 0;

View File

@ -4458,6 +4458,13 @@ let
inherit (pkgs.gnome) glib;
};
qt48 = callPackage ../development/libraries/qt-4.x/4.8 {
# GNOME dependencies are not used unless gtkStyle == true
inherit (pkgs.gnome) gtk libgnomeui GConf gnome_vfs;
# GStreamer is required for HTML5 video in QtWebKit
inherit (pkgs.gst_all) gstreamer gstPluginsBase;
};
qtscriptgenerator = callPackage ../development/libraries/qtscriptgenerator { };
quesoglc = callPackage ../development/libraries/quesoglc { };