nixpkgs/pkgs/applications/audio/mpg123/default.nix
Ihar Hrachyshka dd0f03a56c treewide: remove usage of deprecated apple_sdk framework stubs
They are not doing anything right now. This is in preparation for their
complete removal from the tree.

Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.

Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-19 20:28:20 -04:00

101 lines
2.7 KiB
Nix

{
lib,
stdenv,
fetchurl,
makeWrapper,
pkg-config,
libOnly ? false, # whether to build only the library
withAlsa ? stdenv.hostPlatform.isLinux,
alsa-lib,
withPulse ? stdenv.hostPlatform.isLinux,
libpulseaudio,
withCoreAudio ? stdenv.hostPlatform.isDarwin,
withJack ? stdenv.hostPlatform.isUnix,
jack,
withConplay ? !stdenv.hostPlatform.isWindows,
perl,
writeScript,
}:
assert withConplay -> !libOnly;
stdenv.mkDerivation rec {
pname = "${lib.optionalString libOnly "lib"}mpg123";
version = "1.32.10";
src = fetchurl {
url = "mirror://sourceforge/mpg123/mpg123-${version}.tar.bz2";
hash = "sha256-h7LBf+DJedPvOO7O/2Nis1sorIWJ+/GFS1vnXJq2VXw=";
};
outputs = [
"out"
"dev"
"man"
] ++ lib.optional withConplay "conplay";
nativeBuildInputs = lib.optionals (!libOnly) (
lib.optionals withConplay [ makeWrapper ] ++ lib.optionals (withPulse || withJack) [ pkg-config ]
);
buildInputs = lib.optionals (!libOnly) (
lib.optionals withConplay [ perl ]
++ lib.optionals withAlsa [ alsa-lib ]
++ lib.optionals withPulse [ libpulseaudio ]
++ lib.optionals withCoreAudio [
]
++ lib.optionals withJack [ jack ]
);
configureFlags =
lib.optionals (!libOnly) [
"--with-audio=${
lib.strings.concatStringsSep "," (
lib.optional withJack "jack"
++ lib.optional withPulse "pulse"
++ lib.optional withAlsa "alsa"
++ lib.optional withCoreAudio "coreaudio"
++ [ "dummy" ]
)
}"
]
++ lib.optional (stdenv.hostPlatform ? mpg123) "--with-cpu=${stdenv.hostPlatform.mpg123.cpu}";
enableParallelBuilding = true;
postInstall = lib.optionalString withConplay ''
mkdir -p $conplay/bin
mv scripts/conplay $conplay/bin/
'';
preFixup = lib.optionalString withConplay ''
patchShebangs $conplay/bin/conplay
'';
postFixup = lib.optionalString withConplay ''
wrapProgram $conplay/bin/conplay \
--prefix PATH : $out/bin
'';
passthru = {
updateScript = writeScript "update-mpg123" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl pcre common-updater-scripts
set -eu -o pipefail
# Expect the text in format of '<a href="download/mpg123-1.32.6.tar.bz2">'
new_version="$(curl -s https://mpg123.org/download.shtml |
pcregrep -o1 '<a href="download/mpg123-([0-9.]+).tar.bz2">')"
update-source-version ${pname} "$new_version"
'';
};
meta = with lib; {
description = "Fast console MPEG Audio Player and decoder library";
homepage = "https://mpg123.org";
license = licenses.lgpl21Only;
maintainers = with maintainers; [ ftrvxmtrx ];
platforms = platforms.all;
};
}