Skip to content

Commit

Permalink
fix: audiveris: 5.3.1 -> 5.4-alpha-3
Browse files Browse the repository at this point in the history
  • Loading branch information
camillemndn committed Dec 7, 2024
1 parent 0e7324d commit 32daf21
Show file tree
Hide file tree
Showing 5 changed files with 1,663 additions and 4,858 deletions.
120 changes: 83 additions & 37 deletions pkgs/audiveris/default.nix
Original file line number Diff line number Diff line change
@@ -1,61 +1,107 @@
{
lib,
fetchgit,
pkgs,
fetchFromGitHub,
git,
makeWrapper,
jre,
runtimeShell,
tesseract,
freetype,
copyDesktopItems,
makeDesktopItem,
coreutils,
findutils,
gnused,
}:

let
buildGradle = pkgs.callPackage ./gradle-env.nix { };
gradle2nix =
import (fetchTarball "https://github.com/milahu/gradle2nix/archive/pull69-patch1.tar.gz")
{ };

fixVersion = str: builtins.head (builtins.match "([^-]*-?[^-]*).*" str);
in

buildGradle rec {
gradle2nix.buildGradlePackage rec {
pname = "audiveris";
version = "5.3-alpha";
version = "5.4-alpha-3";

src = fetchgit {
url = "https://github.com/Audiveris/audiveris";
rev = "5.3.1";
hash = "sha256-/g8eolzAnYaSqKGUa7I4Mad0BCu5SVU9YkX5UzygQuM=";
src = fetchFromGitHub {
owner = "Audiveris";
repo = "audiveris";
rev = version;
hash = "sha256-X+hhPlm+D+kJ6B35FJMj+E5mbcaAZpZzHQs/tPTPDLw=";
leaveDotGit = true;
};

patches = [ ./theme.patch ];
postPatch = ''
find app/src/main/java/org/audiveris/omr -type f -exec sed -i {} -e 's/com.jgoodies.looks.plastic.Plastic3DLookAndFeel/com.sun.java.swing.plaf.gtk.GTKLookAndFeel/g' \;
'';

buildInputs = [
git
makeWrapper
];

envSpec = ./gradle-env.json;
nativeBuildInputs = [ copyDesktopItems ];

gradleFlags = [ "build -Dorg.gradle.project.buildDir=$TMP" ];
lockFile = ./gradle.lock;

installPhase = ''
mkdir -p $out
tar -xf $TMP/distributions/Audiveris-${version}.tar -C $TMP
cp -r $TMP/Audiveris-${version}/* $out
ls -all $out/bin
cd $out/bin
cat > "$out/bin/audiveris" << EOF
#!${runtimeShell}
export JAVA_HOME=${jre}/lib/openjdk
export TESSDATA_PREFIX=${pkgs.tesseract}/share
$out/bin/Audiveris
EOF
chmod a+x "$out/bin/audiveris"
tar -xf app/build/distributions/app-${fixVersion version}.tar
install -m 0755 -D app-${fixVersion version}/bin/Audiveris $out/bin/Audiveris
cp -r app-${fixVersion version}/lib $out
install -m 0644 -D app/res/icon-256.png $out/share/icons/hicolor/256x256/apps/org.audiveris.audiveris.png
install -m 0644 -D app/res/icon-64.png $out/share/icons/hicolor/64x64/apps/org.audiveris.audiveris.png
for size in 48 32 24 16; do
install -m 0644 -D $src/app/src/main/java/org/audiveris/omr/ui/resources/icon-$size.png \
$out/share/icons/hicolor/"$size"x"$size"/apps/org.audiveris.audiveris.png
done
runHook postInstall
'';

propagatedBuildInputs = with pkgs; [
tesseract
freetype
git
jre
desktopItems = [
(makeDesktopItem {
name = "org.audiveris.audiveris";
desktopName = "Audiveris";
genericName = "Optical Music Recognition (OMR)";
exec = "Audiveris";
type = "Application";
icon = "org.audiveris.audiveris";
comment = "Convert sheet music to XML";
categories = [
"Music"
"Scanning"
"AudioVideo"
];
keywords = [
"lilypond"
"editor"
"sheet music"
"java"
];
})
];

meta = with lib; {
postFixup = ''
wrapProgram $out/bin/Audiveris \
--set JAVA_HOME ${jre}/lib/openjdk \
--set TESSDATA_PREFIX ${tesseract}/share/tessdata \
--set PATH ${
lib.makeBinPath [
freetype
coreutils
findutils
gnused
]
}
'';

meta = {
description = "Latest generation of Audiveris OMR engine";
homepage = "https://github.com/Audiveris/audiveris";
license = licenses.agpl3Only;
maintainers = with maintainers; [ camillemndn ];
platforms = with platforms; linux ++ darwin;
homepage = "https://github.com/Audiveris/audiveris/";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ camillemndn ];
mainProgram = "Audiveris";
platforms = lib.platforms.linux;
};
}
Loading

0 comments on commit 32daf21

Please sign in to comment.