summary refs log tree commit diff
path: root/pkgs/applications/audio/mpg321/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/audio/mpg321/default.nix')
-rw-r--r--pkgs/applications/audio/mpg321/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/applications/audio/mpg321/default.nix b/pkgs/applications/audio/mpg321/default.nix
index 03aee52f2a9..08cfbada931 100644
--- a/pkgs/applications/audio/mpg321/default.nix
+++ b/pkgs/applications/audio/mpg321/default.nix
@@ -19,10 +19,21 @@ stdenv.mkDerivation rec {
       url = "https://sources.debian.org/data/main/m/mpg321/0.3.2-3/debian/patches/handle_illegal_bitrate_value.patch";
       sha256 = "15simp5fjvm9b024ryfh441rkh2d5bcrizqkzlrh07n9sm7fkw6x";
     })
+    # Apple defines semun already. Skip redefining it to fix build errors.
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/Homebrew/formula-patches/85fa66a9/mpg321/0.3.2.patch";
+      sha256 = "sha256-qFYpKpE9PZSzOJrnsQINZi6FvUVX0anRyOvlF5eOYqE=";
+    })
   ];
 
   hardeningDisable = [ "format" ];
 
+  # Workaround build failure on -fno-common toolchains like upstream
+  # gcc-10. Otherwise build fails as:
+  #   ld: volume.o:/build/mpg321-0.3.2-orig/mpg321.h:119: multiple definition of
+  #     `loop_remaining'; mpg321.o:/build/mpg321-0.3.2-orig/mpg321.h:119: first defined here
+  NIX_CFLAGS_COMPILE = "-fcommon";
+
   configureFlags =
     [ ("--enable-alsa=" + (if stdenv.isLinux then "yes" else "no")) ]
     ++ (lib.optional (defaultAudio != null)
@@ -37,6 +48,6 @@ stdenv.mkDerivation rec {
     description = "Command-line MP3 player";
     homepage = "http://mpg321.sourceforge.net/";
     license = licenses.gpl2;
-    platforms = platforms.gnu ++ platforms.linux;
+    platforms = platforms.unix;
   };
 }