blob: c085a142ef613197e6b5592b8eb2861a7ecc9a62 (
plain)
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
|
{
lib,
stdenv,
fetchFromGitHub,
cmake,
gcc,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pvsneslib";
version = "4.2.0";
src = fetchFromGitHub {
owner = "alekmaul";
repo = "pvsneslib";
tag = finalAttrs.version;
hash = "sha256-Cl4+WvjKbq5IPqf7ivVYwBYwDDWWHGNeq4nWXPxsUHw=";
fetchSubmodules = true;
};
nativeBuildInputs = [
gcc
cmake
];
dontConfigure = true;
postPatch = ''
substituteInPlace compiler/wla-dx/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace tools/816-opt/Makefile \
--replace-fail 'LDFLAGS := -lpthread' 'LDFLAGS :=' \
--replace-fail 'LDFLAGS := -pthread' 'LDFLAGS += -pthread' \
--replace-fail 'LDFLAGS += -lpthread -static' '# LDFLAGS += -lpthread -static'
substituteInPlace tools/bin2txt/Makefile \
tools/gfx2snes/Makefile \
tools/gfx4snes/Makefile \
tools/snestools/Makefile \
tools/816-opt/Makefile \
tools/tmx2snes/Makefile \
--replace-fail '$(CFLAGS) $(OBJS)' '$(LDFLAGS) $(OBJS)'
substituteInPlace tools/smconv/Makefile \
--replace-fail '$(CFLAGS) $(LDFLAGS)' '$(LDFLAGS)'
substituteInPlace tools/constify/Makefile \
--replace-fail '$(CFLAGS) $(DEFINES) $(OBJS)' '$(LDFLAGS) $(DEFINES) $(OBJS)'
substituteInPlace tools/snestools/Makefile \
--replace-fail '-Wno-format' ' '
substituteInPlace tools/snesbrr/brr/Makefile \
--replace-fail 'LDFLAGS ' 'LDFLAGS :=
LDFLAGS '
substituteInPlace compiler/wla-dx/wlalink/write.c \
--replace-fail 'sort_anonymous_labels()' 'sort_anonymous_labels(void)'
'';
preBuild = ''
export PVSNESLIB_HOME=$(pwd)
'';
installPhase = ''
runHook preInstall
cp -r . $out
runHook postInstall
'';
meta = {
description = "Free and open source development kit for the Nintendo SNES";
homepage = "https://github.com/alekmaul/pvsneslib";
changelog = "https://github.com/alekmaul/pvsneslib/releases/tag/${finalAttrs.src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ soyouzpanda ];
mainProgram = "pvsneslib";
platforms = lib.platforms.all;
};
})
|