about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/audio/libopenmpt
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/libraries/audio/libopenmpt
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/audio/libopenmpt')
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libopenmpt/default.nix66
-rwxr-xr-xnixpkgs/pkgs/development/libraries/audio/libopenmpt/update.sh31
2 files changed, 97 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/audio/libopenmpt/default.nix b/nixpkgs/pkgs/development/libraries/audio/libopenmpt/default.nix
new file mode 100644
index 000000000000..bd383ffe39c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libopenmpt/default.nix
@@ -0,0 +1,66 @@
+{ config
+, lib
+, stdenv
+, fetchurl
+, zlib
+, pkg-config
+, mpg123
+, libogg
+, libvorbis
+, portaudio
+, libsndfile
+, flac
+, usePulseAudio ? config.pulseaudio or stdenv.isLinux
+, libpulseaudio
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libopenmpt";
+  version = "0.6.4";
+
+  outputs = [ "out" "dev" "bin" ];
+
+  src = fetchurl {
+    url = "https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-${version}+release.autotools.tar.gz";
+    sha256 = "4J+4RcMpJwCnrBPDsx1mns072+vL/hMo66I3bOvkAWI=";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [
+    pkg-config
+  ];
+
+  buildInputs = [
+    zlib
+    mpg123
+    libogg
+    libvorbis
+    portaudio
+    libsndfile
+    flac
+  ] ++ lib.optional usePulseAudio libpulseaudio;
+
+  configureFlags = lib.optional (!usePulseAudio) "--without-pulseaudio";
+
+  doCheck = true;
+
+  postFixup = ''
+    moveToOutput share/doc $dev
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = with lib; {
+    description = "Cross-platform C++ and C library to decode tracked music files into a raw PCM audio stream";
+    longDescription = ''
+      libopenmpt is a cross-platform C++ and C library to decode tracked music files (modules) into a raw PCM audio stream.
+      openmpt123 is a cross-platform command-line or terminal based module file player.
+      libopenmpt is based on the player code of the OpenMPT project.
+    '';
+    homepage = "https://lib.openmpt.org/libopenmpt/";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ OPNA2608 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/libopenmpt/update.sh b/nixpkgs/pkgs/development/libraries/audio/libopenmpt/update.sh
new file mode 100755
index 000000000000..2d4e5afac0b7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libopenmpt/update.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p common-updater-scripts curl xmlstarlet
+
+attr=libopenmpt
+
+set -eu -o pipefail
+
+# Get update notifications, remove updates for libopenmpt-modplug, find latest eligible & extract versions
+versions="$(
+  curl -s 'https://lib.openmpt.org/libopenmpt/feed.xml' |
+  xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n |
+  grep -v 'libopenmpt-modplug' | head -n1 |
+  grep -Eo '([0-9][^,\s]+)' | tr '\n' ' '
+)"
+echo "Latest $attr versions: $versions"
+
+# Find a version that is > current version and not a rc
+# rc's have different download path and a full release will usually follow shortly
+currentVersion="$(nix-instantiate --eval -E "with import ./. {}; $attr.version" | tr -d '"')"
+echo "Current $attr version: $currentVersion"
+for version in $versions; do
+  (echo "$version" | grep -q 'rc') && continue
+  [ "$version" = "$(printf '%s\n%s' "$version" "$currentVersion" | sort -V | head -n1)" ] && continue
+
+  echo "Updating to $version. Please check if other versions qualify for backport to stable!"
+  update-source-version "$attr" "$version"
+  exit 0
+done
+
+echo "No version eligible for bump."
+exit 0