git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #36377 from oxij/pkgs/fix-pulseaudio-references

tree-wide: fix pulseaudio references; fix SDL expressions

commitb49ef26eca958c965bb327cc6bbbcce430c3b96d authorMichael Raskin <7c6f434c@mail.ru> dateTue 6 Mar 2018, 19:56 (9 years ago) parentc8664a219130eb
4 files changed+122−74
pkgs/applications/networking/browsers/firefox-bin/default.nix+3−3 pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix+12−10 pkgs/development/libraries/SDL/default.nix+61−35 pkgs/development/libraries/SDL2/default.nix+46−26
pkgs/applications/networking/browsers/firefox-bin/default.nix+3−3
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, config, wrapGAppsHook
1+{ lib, stdenv, fetchurl, config, wrapGAppsHook
22, alsaLib
33, atk
44, cairo
@@ -87,7 +87,7 @@ stdenv.mkDerivation {
8787 libPath = stdenv.lib.makeLibraryPath
8888 [ stdenv.cc.cc
8989 alsaLib
90− alsaLib.dev
90+ (lib.getDev alsaLib)
9191 atk
9292 cairo
9393 curl
@@ -124,7 +124,7 @@ stdenv.mkDerivation {
124124 pango
125125 libheimdal
126126 libpulseaudio
127− libpulseaudio.dev
127+ (lib.getDev libpulseaudio)
128128 systemd
129129 ] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
130130 stdenv.cc.cc
pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix+12−10
@@ -4,6 +4,8 @@
44, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
55}:
66
7+with lib;
8+
79mkDerivation rec {
810 name = "telegram-desktop-${version}";
911 version = "1.2.6";
@@ -45,7 +47,7 @@ mkDerivation rec {
4547
4648 enableParallelBuilding = true;
4749
48− GYP_DEFINES = lib.concatStringsSep "," [
50+ GYP_DEFINES = concatStringsSep "," [
4951 "TDESKTOP_DISABLE_CRASH_REPORTS"
5052 "TDESKTOP_DISABLE_AUTOUPDATE"
5153 "TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
@@ -57,14 +59,14 @@ mkDerivation rec {
5759 "-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
5860 "-I${minizip}/include/minizip"
5961 # See Telegram/gyp/qt.gypi
60− "-I${qtbase.dev}/mkspecs/linux-g++"
61− ] ++ lib.concatMap (x: [
62− "-I${qtbase.dev}/include/${x}"
63− "-I${qtbase.dev}/include/${x}/${qtbase.version}"
64− "-I${qtbase.dev}/include/${x}/${qtbase.version}/${x}"
65− "-I${libopus.dev}/include/opus"
66− "-I${alsaLib.dev}/include/alsa"
67− "-I${libpulseaudio.dev}/include/pulse"
62+ "-I${getDev qtbase}/mkspecs/linux-g++"
63+ ] ++ concatMap (x: [
64+ "-I${getDev qtbase}/include/${x}"
65+ "-I${getDev qtbase}/include/${x}/${qtbase.version}"
66+ "-I${getDev qtbase}/include/${x}/${qtbase.version}/${x}"
67+ "-I${getDev libopus}/include/opus"
68+ "-I${getDev alsaLib}/include/alsa"
69+ "-I${getDev libpulseaudio}/include/pulse"
6870 ]) [ "QtCore" "QtGui" "QtDBus" ];
6971 CPPFLAGS = NIX_CFLAGS_COMPILE;
7072
@@ -121,7 +123,7 @@ mkDerivation rec {
121123 -e "s,'XDG-RUNTIME-DIR',\"\''${XDG_RUNTIME_DIR:-/run/user/\$(id --user)}\","
122124 '';
123125
124− meta = with lib; {
126+ meta = {
125127 description = "Telegram Desktop messaging app";
126128 license = licenses.gpl3;
127129 platforms = platforms.linux;
pkgs/development/libraries/SDL/default.nix+61−35
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap, libiconv
1+{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, audiofile, libcap, libiconv
22, openglSupport ? false, libGL, libGLU
33, alsaSupport ? true, alsaLib
44, x11Support ? hostPlatform == buildPlatform, libXext, libICE, libXrandr
@@ -7,13 +7,32 @@
77, hostPlatform, buildPlatform
88}:
99
10−# OSS is no longer supported, for it's much crappier than ALSA and
11−# PulseAudio.
12−assert hostPlatform.isLinux -> alsaSupport || pulseaudioSupport;
10+# NOTE: When editing this expression see if the same change applies to
11+# SDL2 expression too
12+
13+with lib;
14+
15+assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport;
16+assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null && libGLU != null);
1317
1418let
15− inherit (stdenv.lib) optional optionals;
19+
20+ configureFlagsFun = attrs: [
21+ "--disable-oss"
22+ "--disable-video-x11-xme"
23+ "--enable-rpath"
24+ # Building without this fails on Darwin with
25+ #
26+ # ./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for '_XData32'
27+ # SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
28+ #
29+ # Please try revert the change that introduced this comment when updating SDL.
30+ ] ++ optional stdenv.isDarwin "--disable-x11-shared"
31+ ++ optional (!x11Support) "--without-x"
32+ ++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib";
33+
1634in
35+
1736stdenv.mkDerivation rec {
1837 name = "SDL-${version}";
1938 version = "1.2.15";
@@ -28,36 +47,28 @@ stdenv.mkDerivation rec {
2847
2948 nativeBuildInputs = [ pkgconfig ];
3049
31− # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
32− propagatedBuildInputs =
33− optionals x11Support [ libXext libICE libXrandr ] ++
34− optional alsaSupport alsaLib ++
35− optional stdenv.isLinux libcap ++
36− optionals openglSupport [ libGL libGLU ] ++
37− optional pulseaudioSupport libpulseaudio ++
38− optional stdenv.isDarwin Cocoa;
39−
40− buildInputs = let
41− notMingw = !hostPlatform.isMinGW;
42− in optional notMingw audiofile
43− ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ]
44− ++ [ libiconv ];
45−
46− # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
47− # we must arrange to add it to its RPATH; however, `patchelf' seems
48− # to fail at doing this, hence `--disable-pulseaudio-shared'.
49− configureFlags = [
50− "--disable-oss"
51− "--disable-video-x11-xme"
52− "--disable-x11-shared"
53− "--disable-alsa-shared"
54− "--enable-rpath"
55− "--disable-pulseaudio-shared"
56− "--disable-osmesa-shared"
57− ] ++ optional (!x11Support) "--without-x"
58− ++ optional (alsaSupport && hostPlatform != buildPlatform) "--with-alsa-prefix=${alsaLib.out}/lib";
50+ propagatedBuildInputs = [ ]
51+ ++ optionals (x11Support && !stdenv.isDarwin) [ libXext libICE libXrandr ]
52+ ++ optional stdenv.isLinux libcap
53+ ++ optionals openglSupport [ libGL libGLU ]
54+ ++ optional alsaSupport alsaLib
55+ ++ optional pulseaudioSupport libpulseaudio
56+ ++ optional stdenv.isDarwin Cocoa;
57+
58+ buildInputs = [ libiconv ]
59+ ++ optionals (x11Support && stdenv.isDarwin) [ libXext libICE libXrandr ]
60+ ++ optional (!hostPlatform.isMinGW) audiofile
61+ ++ optionals stdenv.isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL ];
62+
63+ configureFlags = configureFlagsFun { inherit alsaLib; };
64+
65+ crossAttrs = {
66+ configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; };
67+ };
5968
6069 patches = [
70+ ./find-headers.patch
71+
6172 # Fix window resizing issues, e.g. for xmonad
6273 # Ticket: http://bugzilla.libsdl.org/show_bug.cgi?id=1430
6374 (fetchpatch {
@@ -75,6 +86,11 @@ stdenv.mkDerivation rec {
7586 url = "http://hg.libsdl.org/SDL/raw-rev/95abff7adcc2";
7687 sha256 = "0i8x0kx0pw12ld5bfxhyzs466y3c0n9dscw1ijhq1b96r72xyhqq";
7788 })
89+ # https://bugzilla.libsdl.org/show_bug.cgi?id=1769
90+ (fetchpatch {
91+ url = "http://hg.libsdl.org/SDL/raw-rev/91ad7b43317a";
92+ sha256 = "15g537vbl2my4mfrjxfkcx9ri6bk2gjvaqj650rjdxwk2nkdkn4b";
93+ })
7894 # Workaround X11 bug to allow changing gamma
7995 # Ticket: https://bugs.freedesktop.org/show_bug.cgi?id=27222
8096 (fetchpatch {
@@ -92,10 +108,20 @@ stdenv.mkDerivation rec {
92108 url = "http://hg.libsdl.org/SDL/raw-rev/bbfb41c13a87";
93109 sha256 = "1336g7waaf1c8yhkz11xbs500h8bmvabh4h437ax8l1xdwcppfxv";
94110 })
95− ./find-headers.patch
96111 ];
97112
98− postFixup = ''moveToOutput share/aclocal "$dev" '';
113+ postInstall = ''
114+ moveToOutput share/aclocal "$dev"
115+ '';
116+
117+ # See the same place in the expression for SDL2
118+ postFixup = ''
119+ for lib in $out/lib/*.so* ; do
120+ if [[ -L "$lib" ]]; then
121+ patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath propagatedBuildInputs}" "$lib"
122+ fi
123+ done
124+ '';
99125
100126 setupHook = ./setup-hook.sh;
101127
pkgs/development/libraries/SDL2/default.nix+46−26
@@ -11,19 +11,23 @@
1111, libiconv
1212}:
1313
14−# OSS is no longer supported, for it's much crappier than ALSA and
15−# PulseAudio.
16−assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport;
14+# NOTE: When editing this expression see if the same change applies to
15+# SDL expression too
16+
17+with lib;
1718
18−assert openglSupport -> (stdenv.isDarwin || libGL != null && x11Support);
19+assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport;
20+assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null);
1921
2022let
23+
2124 configureFlagsFun = attrs: [
22− "--disable-oss" "--disable-x11-shared" "--disable-wayland-shared"
23− "--disable-pulseaudio-shared" "--disable-alsa-shared"
24− ] ++ lib.optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib"
25− ++ lib.optional (!x11Support) "--without-x";
25+ "--disable-oss"
26+ ] ++ optional (!x11Support) "--without-x"
27+ ++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib";
28+
2629in
30+
2731stdenv.mkDerivation rec {
2832 name = "SDL2-${version}";
2933 version = "2.0.8";
@@ -34,35 +38,29 @@ stdenv.mkDerivation rec {
3438 };
3539
3640 outputs = [ "out" "dev" ];
41+ outputBin = "dev"; # sdl-config
3742
3843 patches = [ ./find-headers.patch ];
3944
4045 nativeBuildInputs = [ pkgconfig ];
4146
42− # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
43− propagatedBuildInputs = lib.optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ] ++
44− lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] ++
45− lib.optional pulseaudioSupport libpulseaudio
46− ++ [ libiconv ];
47−
48− buildInputs = [ audiofile ] ++
49− lib.optional openglSupport libGL ++
50− lib.optional alsaSupport alsaLib ++
51− lib.optional dbusSupport dbus ++
52− lib.optional udevSupport udev ++
53− lib.optional ibusSupport ibus ++
54− lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
47+ propagatedBuildInputs = [ libiconv ]
48+ ++ optional dbusSupport dbus
49+ ++ optional udevSupport udev
50+ ++ optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ]
51+ ++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
52+ ++ optional alsaSupport alsaLib
53+ ++ optional pulseaudioSupport libpulseaudio;
5554
56− # https://bugzilla.libsdl.org/show_bug.cgi?id=1431
57− dontDisableStatic = true;
55+ buildInputs = [ audiofile ]
56+ ++ optional openglSupport libGL
57+ ++ optional ibusSupport ibus
58+ ++ optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
5859
5960 # /build/SDL2-2.0.7/src/video/wayland/SDL_waylandevents.c:41:10: fatal error:
6061 # pointer-constraints-unstable-v1-client-protocol.h: No such file or directory
6162 enableParallelBuilding = false;
6263
63− # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
64− # we must arrange to add it to its RPATH; however, `patchelf' seems
65− # to fail at doing this, hence `--disable-pulseaudio-shared'.
6664 configureFlags = configureFlagsFun { inherit alsaLib; };
6765
6866 crossAttrs = {
@@ -75,6 +73,28 @@ stdenv.mkDerivation rec {
7573 moveToOutput bin/sdl2-config "$dev"
7674 '';
7775
76+ # SDL is weird in that instead of just dynamically linking with
77+ # libraries when you `--enable-*` (or when `configure` finds) them
78+ # it `dlopen`s them at runtime. In principle, this means it can
79+ # ignore any missing optional dependencies like alsa, pulseaudio,
80+ # some x11 libs, wayland, etc if they are missing on the system
81+ # and/or work with wide array of versions of said libraries. In
82+ # nixpkgs, however, we don't need any of that. Moreover, since we
83+ # don't have a global ld-cache we have to stuff all the propagated
84+ # libraries into rpath by hand or else some applications that use
85+ # SDL API that requires said libraries will fail to start.
86+ #
87+ # You can grep SDL sources with `grep -rE 'SDL_(NAME|.*_SYM)'` to
88+ # confirm that they actually use most of the `propagatedBuildInputs`
89+ # from above in this way. This is pretty weird.
90+ postFixup = ''
91+ for lib in $out/lib/*.so* ; do
92+ if [[ -L "$lib" ]]; then
93+ patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath propagatedBuildInputs}" "$lib"
94+ fi
95+ done
96+ '';
97+
7898 setupHook = ./setup-hook.sh;
7999
80100 passthru = { inherit openglSupport; };