diff options
author | R. Ryantm <ryantm-bot@ryantm.com> | 2024-05-07 10:47:15 +0000 |
---|---|---|
committer | OPNA2608 <opna2608@protonmail.com> | 2024-05-07 18:07:31 +0200 |
commit | b7833945e56800646b4df1537c30265ef160858b (patch) | |
tree | 30c7ebdbe55542ea6799f76dbb46e9c86170b6e9 /pkgs/by-name | |
parent | b771106b51405d4273feec1f4a48c18e6b302306 (diff) |
furnace: 0.6.2 -> 0.6.3
- Disable new Metal renderer, unable to compile it - Handle new OpenGL 1 renderer - Explicitly enable freetype & use system-installed one - Migrate to by-name, switch to finalAttrs pattern - Fix installing on Darwin Co-authored-by: OPNA2608 <opna2608@protonmail.com>
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/fu/furnace/package.nix | 127 | ||||
-rwxr-xr-x | pkgs/by-name/fu/furnace/update.sh | 12 |
2 files changed, 139 insertions, 0 deletions
diff --git a/pkgs/by-name/fu/furnace/package.nix b/pkgs/by-name/fu/furnace/package.nix new file mode 100644 index 0000000000000..10d55b9871ae3 --- /dev/null +++ b/pkgs/by-name/fu/furnace/package.nix @@ -0,0 +1,127 @@ +{ stdenv +, lib +, testers +, furnace +, fetchFromGitHub +, cmake +, pkg-config +, makeWrapper +, fftw +, fmt_8 +, freetype +, libsndfile +, libX11 +, rtmidi +, SDL2 +, zlib +, withJACK ? stdenv.hostPlatform.isUnix +, libjack2 +, withGUI ? true +, darwin +, portaudio +, alsa-lib +# Enable GL/GLES rendering +, withGL ? !stdenv.hostPlatform.isDarwin +# Use GLES instead of GL, some platforms have better support for one than the other +, preferGLES ? stdenv.hostPlatform.isAarch +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "furnace"; + version = "0.6.3"; + + src = fetchFromGitHub { + owner = "tildearrow"; + repo = "furnace"; + rev = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-z0WvJvkry/9T4Fgp2fX83CxPpDBoOPNVtyX2OUk26FI="; + }; + + postPatch = lib.optionalString stdenv.hostPlatform.isLinux '' + # To offer scaling detection on X11, furnace checks if libX11.so is available via dlopen and uses some of its functions + # But it's being linked against a versioned libX11.so.VERSION via SDL, so the unversioned one is not on the rpath + substituteInPlace src/gui/scaling.cpp \ + --replace-fail 'libX11.so' '${lib.getLib libX11}/lib/libX11.so' + ''; + + nativeBuildInputs = [ + cmake + pkg-config + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + makeWrapper + ]; + + buildInputs = [ + fftw + fmt_8 + freetype + libsndfile + rtmidi + SDL2 + zlib + portaudio + ] ++ lib.optionals withJACK [ + libjack2 + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + # portaudio pkg-config is pulling this in as a link dependency, not set in propagatedBuildInputs + alsa-lib + ] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ + Cocoa + ]); + + cmakeFlags = [ + (lib.cmakeBool "BUILD_GUI" withGUI) + (lib.cmakeBool "SYSTEM_FFTW" true) + (lib.cmakeBool "SYSTEM_FMT" true) + (lib.cmakeBool "SYSTEM_LIBSNDFILE" true) + (lib.cmakeBool "SYSTEM_RTMIDI" true) + (lib.cmakeBool "SYSTEM_SDL2" true) + (lib.cmakeBool "SYSTEM_ZLIB" true) + (lib.cmakeBool "USE_FREETYPE" true) + (lib.cmakeBool "SYSTEM_FREETYPE" true) + (lib.cmakeBool "WITH_JACK" withJACK) + (lib.cmakeBool "WITH_PORTAUDIO" true) + (lib.cmakeBool "SYSTEM_PORTAUDIO" true) + (lib.cmakeBool "WITH_RENDER_SDL" true) + (lib.cmakeBool "WITH_RENDER_OPENGL" withGL) + (lib.cmakeBool "USE_GLES" (withGL && preferGLES)) + (lib.cmakeBool "WITH_RENDER_METAL" false) # fails to build + (lib.cmakeBool "WITH_RENDER_OPENGL1" (withGL && !preferGLES)) + (lib.cmakeBool "WARNINGS_ARE_ERRORS" true) + (lib.cmakeBool "FORCE_APPLE_BIN" true) + ]; + + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + # Normal CMake install phase on Darwin only installs the binary, the user is expected to use CPack to build a + # bundle. That adds alot of overhead for not much benefit (CPack is currently abit broken, and needs impure access + # to /usr/bin/hdiutil). So we'll manually assemble & install everything instead. + + mkdir -p $out/{Applications/Furnace.app/Contents/{MacOS,Resources},share/{,doc,licenses}/furnace} + mv $out/{bin,Applications/Furnace.app/Contents/MacOS}/furnace + makeWrapper $out/{Applications/Furnace.app/Contents/MacOS,bin}/furnace + + install -m644 {../res,$out/Applications/Furnace.app/Contents}/Info.plist + install -m644 ../res/icon.icns $out/Applications/Furnace.app/Contents/Resources/Furnace.icns + install -m644 {..,$out/share/licenses/furnace}/LICENSE + cp -r ../papers $out/share/doc/furnace/ + cp -r ../demos $out/share/furnace/ + ''; + + passthru = { + updateScript = ./update.sh; + tests.version = testers.testVersion { + package = furnace; + }; + }; + + meta = { + description = "Multi-system chiptune tracker compatible with DefleMask modules"; + homepage = "https://github.com/tildearrow/furnace"; + changelog = "https://github.com/tildearrow/furnace/releases/tag/v${finalAttrs.version}"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ OPNA2608 ]; + platforms = lib.platforms.all; + mainProgram = "furnace"; + }; +}) diff --git a/pkgs/by-name/fu/furnace/update.sh b/pkgs/by-name/fu/furnace/update.sh new file mode 100755 index 0000000000000..cc2969f350454 --- /dev/null +++ b/pkgs/by-name/fu/furnace/update.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p common-updater-scripts curl jql + +set -eu -o pipefail + +# Because upstream uses release tags that don't always sort correctly, query for latest release +version="$( + curl -Ls 'https://api.github.com/repos/tildearrow/furnace/releases/latest' \ + | jql -r '"tag_name"' \ + | sed 's/^v//' +)" +update-source-version furnace "$version" |