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