2022-03-30 09:31:56 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2022-04-27 09:35:20 +00:00
|
|
|
, testers
|
2022-03-30 09:31:56 +00:00
|
|
|
, furnace
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, makeWrapper
|
2022-07-14 12:49:19 +00:00
|
|
|
, fftw
|
2022-03-30 09:31:56 +00:00
|
|
|
, fmt_8
|
|
|
|
, libsndfile
|
2023-07-15 17:15:38 +00:00
|
|
|
, libX11
|
2022-07-14 12:49:19 +00:00
|
|
|
, rtmidi
|
2022-03-30 09:31:56 +00:00
|
|
|
, SDL2
|
|
|
|
, zlib
|
|
|
|
, withJACK ? stdenv.hostPlatform.isUnix
|
|
|
|
, libjack2
|
|
|
|
, withGUI ? true
|
|
|
|
, Cocoa
|
2023-10-09 19:29:22 +00:00
|
|
|
, 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
|
2022-03-30 09:31:56 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "furnace";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "0.6.1";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tildearrow";
|
|
|
|
repo = "furnace";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-QUOZGUyZp20ls7rtDK+cmg3Smbd+hl1m9aMhHQmMMbY=";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
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 'libX11.so' '${lib.getLib libX11}/lib/libX11.so'
|
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
fftw
|
2022-03-30 09:31:56 +00:00
|
|
|
fmt_8
|
|
|
|
libsndfile
|
2022-07-14 12:49:19 +00:00
|
|
|
rtmidi
|
2022-03-30 09:31:56 +00:00
|
|
|
SDL2
|
|
|
|
zlib
|
2023-10-09 19:29:22 +00:00
|
|
|
portaudio
|
2022-03-30 09:31:56 +00:00
|
|
|
] ++ lib.optionals withJACK [
|
|
|
|
libjack2
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
# portaudio pkg-config is pulling this in as a link dependency, not set in propagatedBuildInputs
|
|
|
|
alsa-lib
|
2022-03-30 09:31:56 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
Cocoa
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_GUI=${if withGUI then "ON" else "OFF"}"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-DSYSTEM_FFTW=ON"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DSYSTEM_FMT=ON"
|
|
|
|
"-DSYSTEM_LIBSNDFILE=ON"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-DSYSTEM_RTMIDI=ON"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DSYSTEM_SDL2=ON"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-DSYSTEM_ZLIB=ON"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DSYSTEM_PORTAUDIO=ON"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DWITH_JACK=${if withJACK then "ON" else "OFF"}"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DWITH_PORTAUDIO=ON"
|
|
|
|
"-DWITH_RENDER_SDL=ON"
|
|
|
|
"-DWITH_RENDER_OPENGL=${lib.boolToString withGL}"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DWARNINGS_ARE_ERRORS=ON"
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ lib.optionals withGL [
|
|
|
|
"-DUSE_GLES=${lib.boolToString preferGLES}"
|
2022-03-30 09:31:56 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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 = {
|
2023-10-19 13:55:26 +00:00
|
|
|
updateScript = ./update.sh;
|
2022-04-27 09:35:20 +00:00
|
|
|
tests.version = testers.testVersion {
|
2022-03-30 09:31:56 +00:00
|
|
|
package = furnace;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Multi-system chiptune tracker compatible with DefleMask modules";
|
|
|
|
homepage = "https://github.com/tildearrow/furnace";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/tildearrow/furnace/releases/tag/v${version}";
|
2022-03-30 09:31:56 +00:00
|
|
|
license = with licenses; [ gpl2Plus ];
|
|
|
|
maintainers = with maintainers; [ OPNA2608 ];
|
|
|
|
platforms = platforms.all;
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "furnace";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
}
|