Merge branch 'phonon-backend-qt5'

This commit is contained in:
Thomas Tuegel 2017-10-11 18:35:08 -05:00
commit d9aa539340
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
2 changed files with 32 additions and 4 deletions

View File

@ -142,7 +142,8 @@ in
kde-gtk-config breeze-gtk
phonon-backend-gstreamer
libsForQt56.phonon-backend-gstreamer
libsForQt5.phonon-backend-gstreamer
]
++ lib.optionals cfg.enableQt4Support [ breeze-qt4 pkgs.phonon-backend-gstreamer ]

View File

@ -7,6 +7,9 @@ with lib;
let
v = "4.9.1";
soname = if withQt5 then "phonon4qt5" else "phonon";
buildsystemdir = "share/cmake/${soname}";
in
assert withQt5 -> qtbase != null;
@ -36,17 +39,41 @@ stdenv.mkDerivation rec {
[ cmake pkgconfig ]
++ optional withQt5 extra-cmake-modules;
outputs = [ "out" "dev" ];
NIX_CFLAGS_COMPILE = "-fPIC";
cmakeFlags =
[ "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}" ]
++ optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
preConfigure = ''
cmakeFlags+=" -DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs"
cmakeFlags+=" -DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix"
cmakeFlags+=" -DPHONON_QT_PLUGIN_INSTALL_DIR=''${!outputBin}/$qtPluginPrefix/designer"
'';
postPatch = ''
sed -i PhononConfig.cmake.in \
-e "/get_filename_component(rootDir/ s/^.*$//" \
-e "/^set(PHONON_INCLUDE_DIR/ s,\''${rootDir},''${!outputDev}," \
-e "/^set(PHONON_LIBRARY_DIR/ s,\''${rootDir}/,," \
-e "/^set(PHONON_BUILDSYSTEM_DIR/ s,\''${rootDir},''${!outputDev},"
-e "/^set(PHONON_INCLUDE_DIR/ s|\''${rootDir}/||" \
-e "/^set(PHONON_LIBRARY_DIR/ s|\''${rootDir}/||" \
-e "/^set(PHONON_BUILDSYSTEM_DIR/ s|\''${rootDir}|''${!outputDev}|"
sed -i cmake/FindPhononInternal.cmake \
-e "/set(INCLUDE_INSTALL_DIR/ c set(INCLUDE_INSTALL_DIR \"''${!outputDev}/include\")"
${optionalString withQt5 ''
sed -i cmake/FindPhononInternal.cmake \
-e "/set(PLUGIN_INSTALL_DIR/ c set(PLUGIN_INSTALL_DIR \"$qtPluginPrefix/..\")"
''}
sed -i CMakeLists.txt \
-e "/set(BUILDSYSTEM_INSTALL_DIR/ c set(BUILDSYSTEM_INSTALL_DIR \"''${!outputDev}/${buildsystemdir}\")"
'';
postFixup = ''
sed -i "''${!outputDev}/lib/pkgconfig/${soname}.pc" \
-e "/^exec_prefix=/ c exec_prefix=''${!outputBin}/bin"
'';
}