about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/directfb
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/directfb')
-rw-r--r--nixpkgs/pkgs/development/libraries/directfb/default.nix30
1 files changed, 28 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/libraries/directfb/default.nix b/nixpkgs/pkgs/development/libraries/directfb/default.nix
index 0a06881b5806..e7a7996d91f2 100644
--- a/nixpkgs/pkgs/development/libraries/directfb/default.nix
+++ b/nixpkgs/pkgs/development/libraries/directfb/default.nix
@@ -23,8 +23,32 @@ stdenv.mkDerivation rec {
       url = "https://github.com/deniskropp/DirectFB/commit/3a236241bbec3f15b012b6f0dbe94353d8094557.patch";
       sha256 = "0rj3gv0zlb225sqjz04p4yagy4xacf3210aa8vra8i1f0fv0w4kw";
     })
+
+    # Fixes for build of `pkgsMusl.directfb`; applied everywhere to prevent patchrot
+    (fetchpatch {
+      url = "https://git.alpinelinux.org/aports/plain/community/directfb/0001-directfb-fix-musl-compile.patch?id=f8158258493fc0c3eb5de2302e40f4bc44ecfb09";
+      sha256 = "sha256-hmwzbaXu30ZkAqUn1NmvtlJkM6ctddKcO4hxh+1LSS4=";
+    })
+    (fetchpatch {
+      url = "https://git.alpinelinux.org/aports/plain/community/directfb/0002-Fix-musl-PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP-comp.patch?id=f8158258493fc0c3eb5de2302e40f4bc44ecfb09";
+      sha256 = "sha256-j3+mcP6hV9LKuba1GOdcM1cZfmXuJtRgx4vE484jIns=";
+    })
   ];
 
+  postPatch = ''
+    # https://github.com/deniskropp/DirectFB/blob/master/src/core/Makefile.am#L15
+    # BUILDTIME is embedded in the result
+    # if switching to cmake then a similar substitution has to be done
+    substituteInPlace src/core/Makefile.am \
+      --replace '`date -u "+%Y-%m-%d %H:%M"`' "`date -u \"+%Y-%m-%d %H:%M\" --date="@''${SOURCE_DATE_EPOCH}"`"
+  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+    # Specifically patch out two drivers that have build errors with musl libc,
+    # while leaving the rest of the default selection enabled
+    substituteInPlace configure.in \
+      --replace checkfor_lirc={yes,no} \
+      --replace checkfor_matrox={yes,no}
+  '';
+
   nativeBuildInputs = [ autoreconfHook perl pkg-config flux ];
 
   buildInputs = [ zlib libjpeg freetype giflib libpng ]
@@ -45,8 +69,10 @@ stdenv.mkDerivation rec {
     "--enable-mmx"
     "--enable-sse"
     "--with-software"
-    "--with-smooth-scaling"
-  ] ++ lib.optional enableX11 "--enable-x11";
+  ]
+    ++ lib.optional (!stdenv.hostPlatform.isMusl) "--with-smooth-scaling"
+    ++ lib.optional enableX11 "--enable-x11"
+  ;
 
   # Disable parallel building as parallel builds fail due to incomplete
   # depends between autogenerated CoreSlave.h and it's include sites: