···11+From 2e1e9b3ffce9d1069fca0b27b8011f85c7547c3b Mon Sep 17 00:00:00 2001
22+From: Francesco Gazzetta <fgaz@fgaz.me>
33+Date: Wed, 19 Aug 2020 15:06:19 +0200
44+Subject: [PATCH 1/2] Remove coherency checks >:)
55+66+As far as I can see, they are just to make sure that the types can fit
77+in the word length, but this check was written when 64 bits weren't a
88+possibility and didn't take that into account,
99+so although the types do fit, the checks fail.
1010+Indeed, the program seems to work well on 64 bits.
1111+More info here:
1212+https://github.com/Mdashdotdashn/LittleGPTracker/issues/4
1313+---
1414+ sources/Externals/Soundfont/DATATYPE.H | 22 ----------------------
1515+ 1 file changed, 22 deletions(-)
1616+1717+diff --git a/sources/Externals/Soundfont/DATATYPE.H b/sources/Externals/Soundfont/DATATYPE.H
1818+index 762a724..f6b031f 100644
1919+--- a/sources/Externals/Soundfont/DATATYPE.H
2020++++ b/sources/Externals/Soundfont/DATATYPE.H
2121+@@ -123,28 +123,6 @@ typedef short SHORT; /* 16 bit signed value was: INT */
2222+ ********************************************************************/
2323+ typedef unsigned short EMUSTAT;
2424+2525+-/********************************************************************
2626+-* Compare <limits.h> values with SoundFont Enabler limits. Fail compile
2727+-* if discrepency. If compile fails due to one of these errors, then
2828+-* the SoundFont enabler will not work with your system or the state of your
2929+-* development environment.
3030+-********************************************************************/
3131+-#if (SCHAR_MAX != CHAR_MAXVAL) || (UCHAR_MAX != BYTE_MAXVAL)
3232+- #error <datatype.h>: char is out of range!
3333+-#endif
3434+-
3535+-#if (SHRT_MAX != SHRT_MAXVAL)
3636+- #error <datatype.h>: short is out of range!
3737+-#endif
3838+-
3939+-#if (LONG_MAX != LONG_MAXVAL)
4040+- #error <datatype.h>: long is out of range!
4141+-#endif
4242+-
4343+-#if (ULONG_MAX != DWORD_MAXVAL)
4444+- #error <datatype.h>: unsigned long is out of range!
4545+-#endif
4646+-
4747+ #ifdef __BYTE_COHERENT
4848+4949+ /********************************************************************
5050+--
5151+2.25.4
5252+
···11+{ stdenv
22+, fetchFromGitHub
33+, SDL
44+, jack2
55+, Foundation
66+}:
77+88+stdenv.mkDerivation rec {
99+ pname = "littlegptracker";
1010+ version = "unstable-2019-04-14";
1111+1212+ src = fetchFromGitHub {
1313+ owner = "Mdashdotdashn";
1414+ repo = "littlegptracker";
1515+ rev = "0ed729b46739e3df5e111c6fa4d548fde2d3b891";
1616+ sha256 = "1pc6lg2qp6xh7ahs5d5pb63ms4h2dz7ryp3c7mci4g37gbwbsj5b";
1717+ };
1818+1919+ buildInputs = [
2020+ SDL
2121+ ]
2222+ ++ stdenv.lib.optional stdenv.isDarwin Foundation
2323+ ++ stdenv.lib.optional stdenv.isLinux jack2;
2424+2525+ patches = [
2626+ # Remove outdated (pre-64bit) checks that would fail on modern platforms
2727+ # (see description in patch file)
2828+ ./0001-Remove-coherency-checks.patch
2929+ # Set starting directory to cwd, default is in /nix/store and causes a crash
3030+ # (see description in patch file)
3131+ ./0002-Set-the-initial-directory-to-the-current-directory.patch
3232+ ];
3333+3434+ preBuild = "cd projects";
3535+3636+ makeFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ]
3737+ ++ stdenv.lib.optionals stdenv.isLinux [ "PLATFORM=DEB" ]
3838+ ++ stdenv.lib.optionals stdenv.isDarwin [ "PLATFORM=OSX" ];
3939+4040+ NIX_CFLAGS_COMPILE = [ "-fpermissive" ] ++
4141+ stdenv.lib.optional stdenv.hostPlatform.isAarch64 "-Wno-error=narrowing";
4242+4343+ NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin "-framework Foundation";
4444+4545+ installPhase = let extension = if stdenv.isDarwin then "app" else "deb-exe";
4646+ in "install -Dm555 lgpt.${extension} $out/bin/lgpt";
4747+4848+ meta = with stdenv.lib; {
4949+ description = "A music tracker similar to lsdj optimised to run on portable game consoles";
5050+ longDescription = ''
5151+ LittleGPTracker (a.k.a 'The piggy', 'lgpt') is a music tracker optimised
5252+ to run on portable game consoles. It is currently running on Game Park's
5353+ GP2x & Caanoo, PSP, Dingoo, Windows, Mac OSX (intel/ppc) & Linux (Debian).
5454+5555+ It implements the user interface of littlesounddj, a very famous tracker
5656+ for the Gameboy platform that has been tried and tested by many users over
5757+ the years, leading to a little complex but yet extremely efficent way of
5858+ working.
5959+6060+ Piggy currently supports 8 monophonic 16Bit/44.1Khz stereo sample playback
6161+ channels. Additionally, the program can drive MIDI instruments (with the
6262+ gp32 and gp2x a custom MIDI interface is required).
6363+ '';
6464+ homepage = "http://www.littlegptracker.com/";
6565+ downloadPage = "http://www.littlegptracker.com/download.php";
6666+ license = licenses.bsd3;
6767+ maintainers = with maintainers; [ fgaz ];
6868+ platforms = platforms.all;
6969+ # https://github.com/NixOS/nixpkgs/pull/91766#issuecomment-688751821
7070+ broken = stdenv.isDarwin;
7171+ };
7272+}