···1+From 2e1e9b3ffce9d1069fca0b27b8011f85c7547c3b Mon Sep 17 00:00:00 2001
2+From: Francesco Gazzetta <fgaz@fgaz.me>
3+Date: Wed, 19 Aug 2020 15:06:19 +0200
4+Subject: [PATCH 1/2] Remove coherency checks >:)
5+6+As far as I can see, they are just to make sure that the types can fit
7+in the word length, but this check was written when 64 bits weren't a
8+possibility and didn't take that into account,
9+so although the types do fit, the checks fail.
10+Indeed, the program seems to work well on 64 bits.
11+More info here:
12+https://github.com/Mdashdotdashn/LittleGPTracker/issues/4
13+---
14+ sources/Externals/Soundfont/DATATYPE.H | 22 ----------------------
15+ 1 file changed, 22 deletions(-)
16+17+diff --git a/sources/Externals/Soundfont/DATATYPE.H b/sources/Externals/Soundfont/DATATYPE.H
18+index 762a724..f6b031f 100644
19+--- a/sources/Externals/Soundfont/DATATYPE.H
20++++ b/sources/Externals/Soundfont/DATATYPE.H
21+@@ -123,28 +123,6 @@ typedef short SHORT; /* 16 bit signed value was: INT */
22+ ********************************************************************/
23+ typedef unsigned short EMUSTAT;
24+25+-/********************************************************************
26+-* Compare <limits.h> values with SoundFont Enabler limits. Fail compile
27+-* if discrepency. If compile fails due to one of these errors, then
28+-* the SoundFont enabler will not work with your system or the state of your
29+-* development environment.
30+-********************************************************************/
31+-#if (SCHAR_MAX != CHAR_MAXVAL) || (UCHAR_MAX != BYTE_MAXVAL)
32+- #error <datatype.h>: char is out of range!
33+-#endif
34+-
35+-#if (SHRT_MAX != SHRT_MAXVAL)
36+- #error <datatype.h>: short is out of range!
37+-#endif
38+-
39+-#if (LONG_MAX != LONG_MAXVAL)
40+- #error <datatype.h>: long is out of range!
41+-#endif
42+-
43+-#if (ULONG_MAX != DWORD_MAXVAL)
44+- #error <datatype.h>: unsigned long is out of range!
45+-#endif
46+-
47+ #ifdef __BYTE_COHERENT
48+49+ /********************************************************************
50+--
51+2.25.4
52+
···1+{ stdenv
2+, fetchFromGitHub
3+, SDL
4+, jack2
5+, Foundation
6+}:
7+8+stdenv.mkDerivation rec {
9+ pname = "littlegptracker";
10+ version = "unstable-2019-04-14";
11+12+ src = fetchFromGitHub {
13+ owner = "Mdashdotdashn";
14+ repo = "littlegptracker";
15+ rev = "0ed729b46739e3df5e111c6fa4d548fde2d3b891";
16+ sha256 = "1pc6lg2qp6xh7ahs5d5pb63ms4h2dz7ryp3c7mci4g37gbwbsj5b";
17+ };
18+19+ buildInputs = [
20+ SDL
21+ ]
22+ ++ stdenv.lib.optional stdenv.isDarwin Foundation
23+ ++ stdenv.lib.optional stdenv.isLinux jack2;
24+25+ patches = [
26+ # Remove outdated (pre-64bit) checks that would fail on modern platforms
27+ # (see description in patch file)
28+ ./0001-Remove-coherency-checks.patch
29+ # Set starting directory to cwd, default is in /nix/store and causes a crash
30+ # (see description in patch file)
31+ ./0002-Set-the-initial-directory-to-the-current-directory.patch
32+ ];
33+34+ preBuild = "cd projects";
35+36+ makeFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ]
37+ ++ stdenv.lib.optionals stdenv.isLinux [ "PLATFORM=DEB" ]
38+ ++ stdenv.lib.optionals stdenv.isDarwin [ "PLATFORM=OSX" ];
39+40+ NIX_CFLAGS_COMPILE = [ "-fpermissive" ] ++
41+ stdenv.lib.optional stdenv.hostPlatform.isAarch64 "-Wno-error=narrowing";
42+43+ NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin "-framework Foundation";
44+45+ installPhase = let extension = if stdenv.isDarwin then "app" else "deb-exe";
46+ in "install -Dm555 lgpt.${extension} $out/bin/lgpt";
47+48+ meta = with stdenv.lib; {
49+ description = "A music tracker similar to lsdj optimised to run on portable game consoles";
50+ longDescription = ''
51+ LittleGPTracker (a.k.a 'The piggy', 'lgpt') is a music tracker optimised
52+ to run on portable game consoles. It is currently running on Game Park's
53+ GP2x & Caanoo, PSP, Dingoo, Windows, Mac OSX (intel/ppc) & Linux (Debian).
54+55+ It implements the user interface of littlesounddj, a very famous tracker
56+ for the Gameboy platform that has been tried and tested by many users over
57+ the years, leading to a little complex but yet extremely efficent way of
58+ working.
59+60+ Piggy currently supports 8 monophonic 16Bit/44.1Khz stereo sample playback
61+ channels. Additionally, the program can drive MIDI instruments (with the
62+ gp32 and gp2x a custom MIDI interface is required).
63+ '';
64+ homepage = "http://www.littlegptracker.com/";
65+ downloadPage = "http://www.littlegptracker.com/download.php";
66+ license = licenses.bsd3;
67+ maintainers = with maintainers; [ fgaz ];
68+ platforms = platforms.all;
69+ # https://github.com/NixOS/nixpkgs/pull/91766#issuecomment-688751821
70+ broken = stdenv.isDarwin;
71+ };
72+}