2021-06-10 02:57:09 +00:00
|
|
|
{lib, stdenv, fetchurl, fetchpatch, libao, libmad, libid3tag, zlib, alsa-lib
|
2017-10-26 00:33:55 +00:00
|
|
|
# Specify default libao output plugin to use (e.g. "alsa", "pulse" …).
|
|
|
|
# If null, it will use the libao system default.
|
|
|
|
, defaultAudio ? null
|
|
|
|
}:
|
2008-02-11 21:02:38 +00:00
|
|
|
|
2011-07-07 15:10:33 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mpg321";
|
2015-01-10 12:51:15 +00:00
|
|
|
version = "0.3.2";
|
2011-07-07 15:10:33 +00:00
|
|
|
|
2008-02-11 21:02:38 +00:00
|
|
|
src = fetchurl {
|
2015-01-10 12:51:15 +00:00
|
|
|
url = "mirror://sourceforge/mpg321/${version}/mpg321_${version}.orig.tar.gz";
|
|
|
|
sha256 = "0ki8mh76bbmdh77qsiw682dvi8y468yhbdabqwg05igmwc1wqvq5";
|
2008-02-11 21:02:38 +00:00
|
|
|
};
|
|
|
|
|
2019-11-11 16:50:37 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "CVE-2018-7263.patch";
|
|
|
|
url = "https://sources.debian.org/data/main/m/mpg321/0.3.2-3/debian/patches/handle_illegal_bitrate_value.patch";
|
|
|
|
sha256 = "15simp5fjvm9b024ryfh441rkh2d5bcrizqkzlrh07n9sm7fkw6x";
|
|
|
|
})
|
2022-05-20 04:20:00 +00:00
|
|
|
# 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=";
|
|
|
|
})
|
2019-11-11 16:50:37 +00:00
|
|
|
];
|
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2015-12-23 01:59:47 +00:00
|
|
|
|
2022-05-22 13:52:30 +00:00
|
|
|
# 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
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2022-05-22 13:52:30 +00:00
|
|
|
|
2017-10-26 00:33:55 +00:00
|
|
|
configureFlags =
|
|
|
|
[ ("--enable-alsa=" + (if stdenv.isLinux then "yes" else "no")) ]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ (lib.optional (defaultAudio != null)
|
2017-10-26 00:33:55 +00:00
|
|
|
"--with-default-audio=${defaultAudio}");
|
2008-02-11 21:02:38 +00:00
|
|
|
|
2015-01-10 12:51:15 +00:00
|
|
|
buildInputs = [libao libid3tag libmad zlib]
|
2021-06-10 02:57:09 +00:00
|
|
|
++ lib.optional stdenv.isLinux alsa-lib;
|
2015-01-10 12:51:15 +00:00
|
|
|
|
2019-11-04 12:33:53 +00:00
|
|
|
installTargets = [ "install" "install-man" ];
|
2015-01-10 12:51:15 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-08-24 14:21:08 +00:00
|
|
|
description = "Command-line MP3 player";
|
2023-01-21 21:41:12 +00:00
|
|
|
homepage = "https://mpg321.sourceforge.net/";
|
2015-01-10 12:51:15 +00:00
|
|
|
license = licenses.gpl2;
|
2022-05-20 04:20:00 +00:00
|
|
|
platforms = platforms.unix;
|
2008-02-11 21:02:38 +00:00
|
|
|
};
|
|
|
|
}
|