anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / development / libraries / phonon / default.nix
blob58cd0245d0524da7c6dc1184e1b0e71ff30facb9
1 { stdenv
2 , lib
3 , fetchurl
4 , cmake
5 , libGLU
6 , libGL
7 , pkg-config
8 , libpulseaudio
9 , extra-cmake-modules
10 , qtbase
11 , qttools
12 , debug ? false
15 let
16   soname = "phonon4qt5";
17   buildsystemdir = "share/cmake/${soname}";
20 stdenv.mkDerivation rec {
21   pname = "phonon";
22   version = "4.11.1";
24   meta = {
25     homepage = "https://community.kde.org/Phonon";
26     description = "Multimedia API for Qt";
27     mainProgram = "phononsettings";
28     license = lib.licenses.lgpl2;
29     platforms = lib.platforms.unix;
30     maintainers = with lib.maintainers; [ ttuegel ];
31   };
33   src = fetchurl {
34     url = "mirror://kde/stable/phonon/${version}/phonon-${version}.tar.xz";
35     sha256 = "0bfy8iqmjhlg3ma3iqd3kxjc2zkzpjgashbpf5x17y0dc2i1whxl";
36   };
38   buildInputs = [
39     libGLU
40     libGL
41     libpulseaudio
42     qtbase
43     qttools
44   ];
46   nativeBuildInputs = [
47     cmake
48     pkg-config
49     extra-cmake-modules
50   ];
52   outputs = [ "out" "dev" ];
54   env.NIX_CFLAGS_COMPILE = toString ([
55     "-fPIC"
56   ] ++ lib.optionals stdenv.cc.isClang [
57     "-Wno-error=enum-constexpr-conversion"
58   ]);
60   cmakeBuildType = if debug then "Debug" else "Release";
62   dontWrapQtApps = true;
64   preConfigure = ''
65     cmakeFlags+=" -DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs"
66     cmakeFlags+=" -DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix"
67     cmakeFlags+=" -DPHONON_QT_PLUGIN_INSTALL_DIR=''${!outputBin}/$qtPluginPrefix/designer"
68   '';
70   postPatch = ''
71     sed -i PhononConfig.cmake.in \
72         -e "/get_filename_component(rootDir/ s/^.*$//" \
73         -e "/^set(PHONON_INCLUDE_DIR/ s|\''${rootDir}/||" \
74         -e "/^set(PHONON_LIBRARY_DIR/ s|\''${rootDir}/||" \
75         -e "/^set(PHONON_BUILDSYSTEM_DIR/ s|\''${rootDir}|''${!outputDev}|"
77     sed -i cmake/FindPhononInternal.cmake \
78         -e "/set(INCLUDE_INSTALL_DIR/ c set(INCLUDE_INSTALL_DIR \"''${!outputDev}/include\")"
80     sed -i cmake/FindPhononInternal.cmake \
81         -e "/set(PLUGIN_INSTALL_DIR/ c set(PLUGIN_INSTALL_DIR \"$qtPluginPrefix/..\")"
83     sed -i CMakeLists.txt \
84         -e "/set(BUILDSYSTEM_INSTALL_DIR/ c set(BUILDSYSTEM_INSTALL_DIR \"''${!outputDev}/${buildsystemdir}\")"
85   '';
87   postFixup = ''
88     sed -i "''${!outputDev}/lib/pkgconfig/${soname}.pc" \
89         -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}/bin"
90   '';