about summary refs log tree commit diff
path: root/pkgs/development/libraries/smpeg
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-11-03 12:32:07 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2023-11-03 13:45:18 -0400
commited24081baa569f319e2055c1eba9fd093b109493 (patch)
tree59bf59a291c77b0df9606bfd2ec4a7cab1be45f7 /pkgs/development/libraries/smpeg
parent80fc3eb8a63408474af1a492f8364d4b430d3799 (diff)
smpeg: fix build with clang 16
Apply upstream patches to remove usage of the `register` storage class
specifier, which was removed from C++17 (the default with clang 16).
Diffstat (limited to 'pkgs/development/libraries/smpeg')
-rw-r--r--pkgs/development/libraries/smpeg/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/development/libraries/smpeg/default.nix b/pkgs/development/libraries/smpeg/default.nix
index f25ac14df8646..099a3d838bbbc 100644
--- a/pkgs/development/libraries/smpeg/default.nix
+++ b/pkgs/development/libraries/smpeg/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "smpeg";
@@ -16,8 +16,24 @@ stdenv.mkDerivation rec {
     ./gcc6.patch
     ./libx11.patch
     ./gtk.patch
+    # These patches remove use of the `register` storage class specifier,
+    # allowing smpeg to build with clang 16, which defaults to C++17.
+    (fetchpatch {
+      url = "https://github.com/icculus/smpeg/commit/cc114ba0dd8644c0d6205bbce2384781daeff44b.patch";
+      hash = "sha256-GxSD82j05pw0r2SxmPYAe/BXX4iUc+iHWhB9Ap4GzfA=";
+    })
+    (fetchpatch {
+      url = "https://github.com/icculus/smpeg/commit/b369feca5bf99d6cff50d8eb316395ef48acf24f.patch";
+      hash = "sha256-U+a6dbc5cm249KlUcf4vi79yUiT4hgEvMv522K4PqUc=";
+    })
   ];
 
+  postPatch = ''
+    substituteInPlace video/gdith.cpp \
+      --replace 'register int' 'int' \
+      --replace 'register Uint16' 'Uint16'
+  '';
+
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ autoconf automake libtool m4 pkg-config makeWrapper ];