-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpcsx-redux.nix
178 lines (167 loc) · 4.04 KB
/
pcsx-redux.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{
stdenv,
lib,
fetchFromGitHub,
libuv,
zlib,
curl,
ffmpeg,
glfw3,
capstone,
freetype,
libX11,
pkg-config,
imagemagick,
luajitPackages,
multipart-parser-c,
fmt,
magic-enum,
miniaudio,
gtest,
tl-expected,
elfio,
tracy,
md4c,
stb,
uriparser,
ucl,
llhttp,
zip,
src,
debugBuild ? false,
platforms,
gccMips,
withOpenbios ? true,
}:
let
# TODO: read the revs from elsewhere to avoid duplication
submodules = [
({
owner = "grumpycoders";
repo = "zep";
rev = "86ea3c7019f45ccd4a13503bf7d98a396e8f0193";
hash = "sha256-6NmUlOHkRQvCgbATcNxnFrfA2ZWROPYN8Vpd10k6Z2g=";
})
({
owner = "grumpycoders";
repo = "nanosvg";
rev = "f0a3e1034dd22e2e87e5db22401e44998383124e";
hash = "sha256-af11kAga6Ru2rPgrfcYswXNy9etvH3J9FX2T0I0++ew=";
})
({
owner = "grumpycoders";
repo = "nanovg";
rev = "7c021819bbd4843a1a3091fe47346d3fcb2a3e1a";
hash = "sha256-gZHbNuDkLXlLlXZZpLBHcbwzTfeBBkLY7xl4L5yr2lY=";
})
({
owner = "mekhontsev";
repo = "imgui_md";
rev = "8ca75c5f7663f314821e3d0b2c51011792bee68f";
hash = "sha256-uxhY81DWLRRCceYn9khk3rwzT+2f9PNMIMT9OrkPfFc=";
})
({
owner = "herumi";
repo = "xbyak";
rev = "2fb843c3287918038c8f76276a590c25cc7ec5ee";
hash = "sha256-XZce+kEZ7dipI19WY43ycOjzM2dZyANMEN5+GhoNYUk=";
})
({
owner = "lunarmodules";
repo = "luafilesystem";
rev = "912e06714fc276c15b4d5d1b42bd2b11edb8deff";
hash = "sha256-BShByo2NhVrOHDPze/JXfeFWq36PFrI2HVugR2MDB0A=";
})
({
owner = "grumpycoders";
repo = "luajit";
rev = "66fadd16a51955cfbd770de62806cfbdd7c6c818";
hash = "sha256-nFlDr79GC8MsL6ausAsEPJwL8OJrFydB37tpD5mS1C8=";
})
({
owner = "ocornut";
repo = "imgui";
rev = "368123ab06b2b573d585e52f84cd782c5c006697";
hash = "sha256-6VOs7a31bEfAG75SQAY2X90h/f/HvqZmN615WXYkUOA=";
})
({
owner = "mdqinc";
repo = "SDL_GameControllerDB";
rev = "b1e342774cbb35467dfdd3634d4f0181a76cbc89";
hash = "sha256-LYvO+chDVo6D++fuFbxqSRltGW3y82SESmtFj39TdSA=";
})
] ++ lib.optional stdenv.hostPlatform.isAarch {
owner = "grumpycoders";
repo = "vixl";
rev = "53ad192b26ddf6edd228a24ae1cffc363b442c01";
hash = "sha256-p9Z2lFzhqnHnFWfqT6BIJBVw2ZpkVIxykhG3jUHXA84=";
} ++ lib.optional withOpenbios {
owner = "grumpycoders";
repo = "uC-sdk";
rev = "69e06871824e2d62069487a7426ded09090ceb69";
hash = "sha256-VamLhNtXxilcvd6ch76ronhB7DcKfw2eL7CuLwHFbp8=";
};
fetchSubmodule = { owner, repo, rev, hash }@args:
"cp -ru --no-preserve=all ${(fetchFromGitHub args).out} source/third_party/${repo}";
in stdenv.mkDerivation {
pname = "pcsx-redux";
version = "0.99test";
inherit src;
postUnpack = ''
cp -ru --no-preserve=all ${miniaudio.out} source/third_party/miniaudio
cp -ru --no-preserve=all ${tracy.src} source/third_party/tracy
'' + builtins.concatStringsSep "\n" (map fetchSubmodule submodules);
nativeBuildInputs = [
pkg-config
imagemagick
] ++ lib.optionals withOpenbios [
# unwrap them
gccMips.cc
gccMips.bintools.bintools
zip
];
buildInputs = [
stb
ucl
md4c
luajitPackages.libluv
multipart-parser-c
fmt
magic-enum
gtest
tl-expected
elfio
libuv
tracy
curl.dev
zlib
ffmpeg.dev
glfw3
capstone
freetype.dev
uriparser
libX11
llhttp
];
makeFlags = [
(lib.optionalString withOpenbios "openbios")
"pcsx-redux"
"PREFIX=mipsel-unknown-none-elf"
];
installFlags = [
"install"
(lib.optionalString withOpenbios "install-openbios")
"DESTDIR=$(out)"
];
# TODO: learn how to use separate debug info
dontStrip = debugBuild;
enableDebugging = debugBuild;
enableParallelBuilding = true;
NIX_BUILD_CORES = 4;
meta = {
homepage = "https://pcsx-redux.consoledev.net";
description = "PlayStation 1 emulator and debugger";
mainProgram = "pcsx-redux";
inherit platforms;
};
}