diff --git a/pkgs/applications/misc/lenmus/default.nix b/pkgs/applications/misc/lenmus/default.nix index 023045d67917..80da168cdafe 100644 --- a/pkgs/applications/misc/lenmus/default.nix +++ b/pkgs/applications/misc/lenmus/default.nix @@ -1,9 +1,10 @@ { lib , stdenv -, pkg-config , fetchFromGitHub , fetchpatch , cmake +, pkg-config +, makeWrapper , boost , portmidi , sqlite @@ -11,40 +12,40 @@ , libpng , pngpp , zlib -, wxGTK30 +, wxGTK32 , wxsqlite3 +, fluidsynth +, fontconfig +, darwin +, soundfont-fluid +, openlilylib-fonts }: +let + inherit (darwin.apple_sdk.frameworks) Cocoa; +in stdenv.mkDerivation rec { pname = "lenmus"; - version = "5.4.2"; + version = "6.0.1"; src = fetchFromGitHub { owner = "lenmus"; repo = "lenmus"; rev = "Release_${version}"; - sha256 = "1n639xr1qxx6rhqs0c6sjxp3bv8cwkmw1vfk1cji7514gj2a9v3p"; + sha256 = "sha256-qegOAc6vs2+6VViDHVjv0q+qjLZyTT7yPF3hFpTt5zE="; }; - patches = [ - (fetchpatch { - url = "https://github.com/lenmus/lenmus/commit/421760d84694a0e6e72d0e9b1d4fd30a7e129c6f.patch"; - sha256 = "1z1wwh0pcr8w1zlr8swx99si9y2kxx5bmavgwvy6bvdhxgm58yqs"; - }) - (fetchpatch { - url = "https://github.com/lenmus/lenmus/commit/6613d20d4051effc782203c9c6d92962a3f66b5f.patch"; - sha256 = "01vvzzpamv90jpqbbq1f2m2b4gb9xab9z70am8i41d90nqvg6agn"; - }) - (fetchpatch { - url = "https://github.com/lenmus/lenmus/commit/37ee8ac9c8faff65a14e8f7ed2bc22e6dc48d91f.patch"; - includes = [ "src/app/lenmus_midi_wizard.cpp" ]; - sha256 = "sha256-nlT6ZbSCIXUk2Ufv/SDn2A0Rt+s/7m+7l9HOoQmaIhc="; - }) - ]; + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace "/usr" "${placeholder "out"}" + sed -i 's/fixup_bundle.*")/")/g' CMakeLists.txt + ''; nativeBuildInputs = [ cmake pkg-config + ] ++ lib.optionals stdenv.isDarwin [ + makeWrapper ]; buildInputs = [ @@ -55,10 +56,33 @@ stdenv.mkDerivation rec { libpng pngpp zlib - wxGTK30 + wxGTK32 wxsqlite3 + fluidsynth + fontconfig + ] ++ lib.optionals stdenv.isDarwin [ + Cocoa ]; + preConfigure = '' + mkdir res/fonts + ln -s ${openlilylib-fonts.bravura}/share/lilypond/*/fonts/otf/Bravura.otf res/fonts/Bravura.otf + ln -s ${soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2 res/sounds/FluidR3_GM.sf2 + ''; + + cmakeFlags = [ + "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}" + "-DLENMUS_INSTALL_SOUNDFONT=ON" + "-DMAN_INSTALL_DIR=${placeholder "out"}/share/man" + ]; + + postInstall = lib.optionalString stdenv.isDarwin '' + mkdir -p $out/{Applications,bin} + mv $out/lenmus.app $out/Applications + mv $out/Resources $out/Applications/lenmus.app/Contents + makeWrapper $out/{Applications/lenmus.app/Contents/MacOS,bin}/lenmus + ''; + meta = with lib; { description = "LenMus Phonascus is a program for learning music"; longDescription = '' @@ -69,6 +93,6 @@ stdenv.mkDerivation rec { homepage = "http://www.lenmus.org/"; license = licenses.gpl3Plus; maintainers = with maintainers; [ ramkromberg ]; - platforms = with platforms; linux; + platforms = with platforms; unix; }; }