2626 uriparser ,
2727 ucl ,
2828 llhttp ,
29+ zip ,
2930
3031 src ,
3132 debugBuild ? false ,
3233 platforms ,
34+ gccMips ,
35+ withOpenbios ? true ,
3336} :
3437let
35- zep = fetchFromGitHub {
36- owner = "grumpycoders" ;
37- repo = "zep" ;
38- rev = "86ea3c7019f45ccd4a13503bf7d98a396e8f0193" ;
39- hash = "sha256-6NmUlOHkRQvCgbATcNxnFrfA2ZWROPYN8Vpd10k6Z2g=" ;
40- } ;
41- nanosvg = fetchFromGitHub {
42- owner = "grumpycoders" ;
43- repo = "nanosvg" ;
44- rev = "f0a3e1034dd22e2e87e5db22401e44998383124e" ;
45- hash = "sha256-af11kAga6Ru2rPgrfcYswXNy9etvH3J9FX2T0I0++ew=" ;
46- } ;
47- nanovg = fetchFromGitHub {
48- owner = "grumpycoders" ;
49- repo = "nanovg" ;
50- rev = "7c021819bbd4843a1a3091fe47346d3fcb2a3e1a" ;
51- hash = "sha256-gZHbNuDkLXlLlXZZpLBHcbwzTfeBBkLY7xl4L5yr2lY=" ;
52- } ;
53- vixl = fetchFromGitHub {
54- owner = "grumpycoders" ;
55- repo = "vixl" ;
56- rev = "53ad192b26ddf6edd228a24ae1cffc363b442c01" ;
57- hash = "sha256-p9Z2lFzhqnHnFWfqT6BIJBVw2ZpkVIxykhG3jUHXA84=" ;
58- } ;
59- imgui-md = fetchFromGitHub {
38+ # TODO: read the revs from elsewhere to avoid duplication
39+ submodules = [
40+ ( {
41+ owner = "grumpycoders" ;
42+ repo = "zep" ;
43+ rev = "86ea3c7019f45ccd4a13503bf7d98a396e8f0193" ;
44+ hash = "sha256-6NmUlOHkRQvCgbATcNxnFrfA2ZWROPYN8Vpd10k6Z2g=" ;
45+ } )
46+ ( {
47+ owner = "grumpycoders" ;
48+ repo = "nanosvg" ;
49+ rev = "f0a3e1034dd22e2e87e5db22401e44998383124e" ;
50+ hash = "sha256-af11kAga6Ru2rPgrfcYswXNy9etvH3J9FX2T0I0++ew=" ;
51+ } )
52+ ( {
53+ owner = "grumpycoders" ;
54+ repo = "nanovg" ;
55+ rev = "7c021819bbd4843a1a3091fe47346d3fcb2a3e1a" ;
56+ hash = "sha256-gZHbNuDkLXlLlXZZpLBHcbwzTfeBBkLY7xl4L5yr2lY=" ;
57+ } )
58+ ( {
6059 owner = "mekhontsev" ;
6160 repo = "imgui_md" ;
6261 rev = "8ca75c5f7663f314821e3d0b2c51011792bee68f" ;
6362 hash = "sha256-uxhY81DWLRRCceYn9khk3rwzT+2f9PNMIMT9OrkPfFc=" ;
64- } ;
65- xbyak = fetchFromGitHub {
63+ } )
64+ ( {
6665 owner = "herumi" ;
6766 repo = "xbyak" ;
6867 rev = "2fb843c3287918038c8f76276a590c25cc7ec5ee" ;
6968 hash = "sha256-XZce+kEZ7dipI19WY43ycOjzM2dZyANMEN5+GhoNYUk=" ;
70- } ;
71- luafs = fetchFromGitHub {
69+ } )
70+ ( {
7271 owner = "lunarmodules" ;
7372 repo = "luafilesystem" ;
7473 rev = "912e06714fc276c15b4d5d1b42bd2b11edb8deff" ;
7574 hash = "sha256-BShByo2NhVrOHDPze/JXfeFWq36PFrI2HVugR2MDB0A=" ;
76- } ;
77- luajit = fetchFromGitHub {
75+ } )
76+ ( {
7877 owner = "grumpycoders" ;
7978 repo = "luajit" ;
8079 rev = "66fadd16a51955cfbd770de62806cfbdd7c6c818" ;
8180 hash = "sha256-nFlDr79GC8MsL6ausAsEPJwL8OJrFydB37tpD5mS1C8=" ;
82- } ;
83- imgui = fetchFromGitHub {
81+ } )
82+ ( {
8483 owner = "ocornut" ;
8584 repo = "imgui" ;
8685 rev = "368123ab06b2b573d585e52f84cd782c5c006697" ;
8786 hash = "sha256-6VOs7a31bEfAG75SQAY2X90h/f/HvqZmN615WXYkUOA=" ;
88- } ;
89- sdl-db = fetchFromGitHub {
87+ } )
88+ ( {
9089 owner = "mdqinc" ;
9190 repo = "SDL_GameControllerDB" ;
9291 rev = "b1e342774cbb35467dfdd3634d4f0181a76cbc89" ;
9392 hash = "sha256-LYvO+chDVo6D++fuFbxqSRltGW3y82SESmtFj39TdSA=" ;
93+ } )
94+ ] ++ lib . optional stdenv . hostPlatform . isAarch {
95+ owner = "grumpycoders" ;
96+ repo = "vixl" ;
97+ rev = "53ad192b26ddf6edd228a24ae1cffc363b442c01" ;
98+ hash = "sha256-p9Z2lFzhqnHnFWfqT6BIJBVw2ZpkVIxykhG3jUHXA84=" ;
99+ } ++ lib . optional withOpenbios {
100+ owner = "grumpycoders" ;
101+ repo = "uC-sdk" ;
102+ rev = "69e06871824e2d62069487a7426ded09090ceb69" ;
103+ hash = "sha256-VamLhNtXxilcvd6ch76ronhB7DcKfw2eL7CuLwHFbp8=" ;
94104 } ;
105+
106+ fetchSubmodule = { owner , repo , rev , hash } @args :
107+ "cp -ru --no-preserve=all ${ ( fetchFromGitHub args ) . out } source/third_party/${ repo } " ;
108+
95109in stdenv . mkDerivation {
96110 pname = "pcsx-redux" ;
97111 version = "0.99test" ;
98112 inherit src ;
99113
100114 postUnpack = ''
101- rm -rf source/third_party/miniaudio
102- rm -rf source/third_party/zep
103- rm -rf source/third_party/nanosvg
104- rm -rf source/third_party/nanovg
105- rm -rf source/third_party/imgui
106- rm -rf source/third_party/imgui_md
107- rm -rf source/third_party/xbyak
108- rm -rf source/third_party/luafilesystem
109- rm -rf source/third_party/SDL_GameControllerDB
110- rm -rf source/third_party/tracy
111- rm -rf source/third_party/luajit
112-
113- cp -r ${ miniaudio . out } source/third_party/miniaudio
114- cp -r ${ zep . out } source/third_party/zep
115- cp -r ${ nanosvg . out } source/third_party/nanosvg
116- cp -r ${ nanovg . out } source/third_party/nanovg
117- cp -r ${ imgui . out } source/third_party/imgui
118- cp -r ${ imgui-md . out } source/third_party/imgui_md
119- cp -r ${ xbyak . out } source/third_party/xbyak
120- cp -r ${ luafs . out } source/third_party/luafilesystem
121- cp -r ${ sdl-db . out } source/third_party/SDL_GameControllerDB
122- cp -r ${ tracy . src } source/third_party/tracy
123- cp -r ${ luajit . out } source/third_party/luajit
124-
125- chmod -R +w source/third_party/miniaudio
126- chmod -R +w source/third_party/zep
127- chmod -R +w source/third_party/nanosvg
128- chmod -R +w source/third_party/nanovg
129- chmod -R +w source/third_party/imgui
130- chmod -R +w source/third_party/imgui_md
131- chmod -R +w source/third_party/luafilesystem
132- chmod -R +w source/third_party/SDL_GameControllerDB
133- chmod -R +w source/third_party/tracy
134- chmod -R +w source/third_party/luajit
135- ''
136- + lib . optionalString stdenv . hostPlatform . isAarch ''
137- cp -r ${ vixl . out } source/third_party/vixl
138- chmod -R +w source/third_party/vixl
139- '' ;
115+ cp -ru --no-preserve=all ${ miniaudio . out } source/third_party/miniaudio
116+ cp -ru --no-preserve=all ${ tracy . src } source/third_party/tracy
117+ '' + builtins . concatStringsSep "\n " ( map fetchSubmodule submodules ) ;
140118
141119 nativeBuildInputs = [
142120 pkg-config
143121 imagemagick
122+ ] ++ lib . optionals withOpenbios [
123+ # unwrap them
124+ gccMips . cc
125+ gccMips . bintools . bintools
126+ zip
144127 ] ;
145128
146129 buildInputs = [
@@ -168,6 +151,14 @@ in stdenv.mkDerivation {
168151 ] ;
169152
170153 makeFlags = [
154+ ( lib . optionalString withOpenbios "openbios" )
155+ "pcsx-redux"
156+ "PREFIX=mipsel-unknown-none-elf"
157+ ] ;
158+
159+ installFlags = [
160+ "install"
161+ ( lib . optionalString withOpenbios "install-openbios" )
171162 "DESTDIR=$(out)"
172163 ] ;
173164
@@ -176,7 +167,7 @@ in stdenv.mkDerivation {
176167 enableDebugging = debugBuild ;
177168
178169 enableParallelBuilding = true ;
179- NIX_BUILD_CORES = 2 ;
170+ NIX_BUILD_CORES = 4 ;
180171
181172 meta = {
182173 homepage = "https://pcsx-redux.consoledev.net" ;
0 commit comments