nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchgit,
5 alsa-lib,
6 gtk3,
7 libGL,
8 libGLU,
9 libX11,
10 pkg-config,
11 upx,
12 xcbutil,
13}:
14
15stdenv.mkDerivation {
16 pname = "c64-debugger";
17 version = "0.64.58.6";
18
19 src = fetchgit {
20 url = "https://git.code.sf.net/p/c64-debugger/code";
21 rev = "f97772e3f5c8b4fa99e8ed212ed1c4cb1e2389f1";
22 hash = "sha256-3SR73AHQlYSEYpJLtQ/aJ1UITZGq7aA9tQKxBsn/yuc=";
23 };
24
25 buildInputs = [
26 alsa-lib
27 gtk3
28 libGL
29 libGLU
30 libX11
31 xcbutil
32 ];
33
34 nativeBuildInputs = [
35 upx
36 pkg-config
37 ];
38
39 postPatch = ''
40 # Disable default definition of RUN_COMMODORE64
41 sed -i 's|^#define RUN_COMMODORE64|//#define RUN_COMMODORE64|' MTEngine/Games/c64/C64D_Version.h
42 '';
43
44 buildPhase = ''
45 runHook preBuild
46
47 # Build C64 debugger
48 make -C MTEngine \
49 CFLAGS="-w -O2 -fcommon" \
50 CXXFLAGS="-w -O2 --std=c++11" \
51 DEFINES="-DRUN_COMMODORE64" \
52 -j$NIX_BUILD_CORES
53 mv MTEngine/c64debugger c64debugger
54 make -C MTEngine clean
55
56 # Build 65XE debugger
57 make -C MTEngine \
58 CFLAGS="-w -O2 -fcommon" \
59 CXXFLAGS="-w -O2 --std=c++11" \
60 DEFINES="-DRUN_ATARI" \
61 -j$NIX_BUILD_CORES
62 mv MTEngine/c64debugger 65xedebugger
63 make -C MTEngine clean
64
65 # Build NES debugger
66 make -C MTEngine \
67 CFLAGS="-w -O2 -fcommon" \
68 CXXFLAGS="-w -O2 --std=c++11" \
69 DEFINES="-DRUN_NES" \
70 -j$NIX_BUILD_CORES
71 mv MTEngine/c64debugger nesdebugger
72
73 runHook postBuild
74 '';
75
76 installPhase = ''
77 runHook preInstall
78
79 install -d "$out/bin"
80 install -d "$out/share/doc"
81 install -m 755 c64debugger 65xedebugger nesdebugger "$out/bin"
82 install -m 644 MTEngine/Assets/*.txt "$out/share/doc"
83 install -m 644 MTEngine/Assets/*.pdf "$out/share/doc"
84
85 runHook postInstall
86 '';
87
88 env = {
89 NIX_CFLAGS_COMPILE = toString [
90 "-Wno-error=narrowing"
91 "-Wno-error=implicit-function-declaration"
92 "-Wno-error=int-conversion"
93 "-Wno-error=incompatible-pointer-types"
94 ];
95 };
96
97 meta = {
98 homepage = "https://sourceforge.net/projects/c64-debugger";
99 description = "Commodore 64, Atari XL/XE and NES code and memory debugger that works in real time";
100 license = with lib.licenses; [
101 gpl3Only # c64-debugger
102 mit # MTEngine
103 # emulators included in c64-debugger
104 gpl2Plus # VICE, atari800
105 gpl2 # nestopiaue
106 ];
107 mainProgram = "c64debugger";
108 maintainers = [ lib.maintainers.detegr ];
109 platforms = lib.platforms.linux;
110 };
111}