about summary refs log tree commit diff
path: root/pkgs/by-name/pv
diff options
context:
space:
mode:
authorsoyouzpanda <soyouzpanda@soyouzpanda.fr>2024-03-31 23:13:44 +0200
committersoyouzpanda <soyouzpanda@soyouzpanda.fr>2024-04-01 17:22:36 +0200
commitdb521d5f481991a5b5ba2cb9ca0afc14b0a1b612 (patch)
tree842e49c595340b6514c4a4bc0806b0da581298b7 /pkgs/by-name/pv
parent6f34b252aa8814e04155bae343da0c89111e9270 (diff)
pvsneslib: init at 4.2.0
Diffstat (limited to 'pkgs/by-name/pv')
-rw-r--r--pkgs/by-name/pv/pvsneslib/package.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/by-name/pv/pvsneslib/package.nix b/pkgs/by-name/pv/pvsneslib/package.nix
new file mode 100644
index 0000000000000..80f8e333d370e
--- /dev/null
+++ b/pkgs/by-name/pv/pvsneslib/package.nix
@@ -0,0 +1,73 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, gcc
+}:
+
+stdenv.mkDerivation rec {
+  pname = "pvsneslib";
+  version = "4.2.0";
+
+  src = fetchFromGitHub {
+    owner = "alekmaul";
+    repo = "pvsneslib";
+    rev = version;
+    hash = "sha256-Cl4+WvjKbq5IPqf7ivVYwBYwDDWWHGNeq4nWXPxsUHw=";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ gcc cmake ];
+
+  dontConfigure = true;
+
+  postPatch = ''
+    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";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ soyouzpanda ];
+    mainProgram = "pvsneslib";
+    platforms = lib.platforms.all;
+  };
+}