summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libcanberra/package.nix
blob: 7c8f51c0aaad39ee689d6b453a43483f7a559836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
  stdenv,
  lib,
  fetchurl,
  fetchpatch,
  pkg-config,
  libtool,
  gtk3-x11,
  gtkSupport ? null,
  libpulseaudio,
  gst_all_1,
  libvorbis,
  libcap,
  withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdLibs,
  systemdLibs,
  withAlsa ? stdenv.hostPlatform.isLinux,
  alsa-lib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libcanberra";
  version = "0.30";

  src = fetchurl {
    url = "http://0pointer.de/lennart/projects/libcanberra/libcanberra-${finalAttrs.version}.tar.xz";
    sha256 = "0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2";
  };

  outputs = [
    "out"
    "dev"
  ];

  strictDeps = true;
  nativeBuildInputs = [ pkg-config ];
  buildInputs = [
    libpulseaudio
    libvorbis
    libtool # in buildInputs rather than nativeBuildInputs since libltdl is used (not libtool itself)
  ]
  ++ (with gst_all_1; [
    gstreamer
    gst-plugins-base
  ])
  ++ lib.optional (gtkSupport == "gtk3") gtk3-x11
  ++ lib.optional stdenv.hostPlatform.isLinux libcap
  ++ lib.optional withSystemd systemdLibs
  ++ lib.optional withAlsa alsa-lib;

  configureFlags = [
    "--disable-oss"
  ]
  ++ lib.optional stdenv.hostPlatform.isLinux "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system";

  patches = [
    ./0001-gtk-Don-t-assume-all-GdkDisplays-are-GdkX11Displays-.patch
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    (fetchpatch {
      url = "https://github.com/macports/macports-ports/raw/5a7965dfea7727d1ceedee46c7b0ccee9cb23468/audio/libcanberra/files/patch-configure.diff";
      sha256 = "sha256-pEJy1krciUEg5BFIS8FJ4BubjfS/nt9aqi6BLnS1+4M=";
      extraPrefix = "";
    })
    (fetchpatch {
      url = "https://github.com/macports/macports-ports/raw/5a7965dfea7727d1ceedee46c7b0ccee9cb23468/audio/libcanberra/files/dynamic_lookup-11.patch";
      sha256 = "sha256-nUjha2pKh5VZl0ZZzcr9NTo1TVuMqF4OcLiztxW+ofQ=";
      extraPrefix = "";
    })
  ];

  postInstall = ''
    for f in $out/lib/*.la; do
      sed 's|-lltdl|-L${libtool.lib}/lib -lltdl|' -i $f
    done
  '';

  enableParallelBuilding = true;

  passthru = lib.optionalAttrs (gtkSupport != null) {
    gtkModule = if gtkSupport == "gtk2" then "/lib/gtk-2.0" else "/lib/gtk-3.0/";
  };

  meta = {
    description = "Implementation of the XDG Sound Theme and Name Specifications";
    mainProgram = "canberra-gtk-play";
    longDescription = ''
      libcanberra is an implementation of the XDG Sound Theme and Name
      Specifications, for generating event sounds on free desktops
      such as GNOME.  It comes with several backends (ALSA,
      PulseAudio, OSS, GStreamer, null) and is designed to be
      portable.
    '';
    homepage = "http://0pointer.de/lennart/projects/libcanberra/";
    license = lib.licenses.lgpl2Plus;
    maintainers = with lib.maintainers; [ RossComputerGuy ];
    platforms = lib.platforms.unix;
  };
})