qt4: fix build on darwin (close #750)

This commit is contained in:
Jason \"Don\" O'Conal 2013-07-14 12:54:17 +10:00 committed by Vladimír Čunát
parent 8eea8bbd1f
commit 48a0d477db

View File

@ -61,19 +61,23 @@ stdenv.mkDerivation rec {
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
"
'';
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 ''
export CXX=clang++
export CC=clang
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
'';
prefixKey = "-prefix ";
configureFlags =
@ -97,12 +101,10 @@ stdenv.mkDerivation rec {
'';
propagatedBuildInputs =
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes
libXv libXi libSM
]
[ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
libSM zlib libpng openssl dbus.libs freetype fontconfig glib ]
++ optional (stdenv.lib.lists.elem stdenv.system stdenv.lib.platforms.mesaPlatforms) mesa
++ optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
++ [ zlib libpng openssl dbus.libs freetype fontconfig glib ]
++ optionals (buildWebkit || buildMultimedia) [ gstreamer gst_plugins_base ];
# The following libraries are only used in plugins
@ -117,6 +119,18 @@ stdenv.mkDerivation rec {
# @vcunat has been unable to find a *reliable* fix
enableParallelBuilding = false;
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
'';
crossAttrs = let
isMingw = stdenv.cross.config == "i686-pc-mingw32" ||
stdenv.cross.config == "x86_64-w64-mingw32";