1 { stdenv, lib, fetchFromGitHub, fetchpatch
2 , autoreconfHook, perl, pkg-config, flux, zlib
3 , libjpeg, freetype, libpng, giflib
4 , enableX11 ? true, xorg
5 , enableSDL ? true, SDL }:
7 stdenv.mkDerivation rec {
11 src = fetchFromGitHub {
14 rev = "DIRECTFB_${lib.replaceStrings ["."] ["_"] version}";
15 sha256 = "0bs3yzb7hy3mgydrj8ycg7pllrd2b6j0gxj596inyr7ihssr3i0y";
19 # Fixes build in "davinci" with glibc >= 2.28
20 # The "davinci" module is only enabled on 32-bit arm.
21 # https://github.com/deniskropp/DirectFB/pull/17
23 url = "https://github.com/deniskropp/DirectFB/commit/3a236241bbec3f15b012b6f0dbe94353d8094557.patch";
24 sha256 = "0rj3gv0zlb225sqjz04p4yagy4xacf3210aa8vra8i1f0fv0w4kw";
27 # Fixes for build of `pkgsMusl.directfb`; applied everywhere to prevent patchrot
29 url = "https://git.alpinelinux.org/aports/plain/community/directfb/0001-directfb-fix-musl-compile.patch?id=f8158258493fc0c3eb5de2302e40f4bc44ecfb09";
30 sha256 = "sha256-hmwzbaXu30ZkAqUn1NmvtlJkM6ctddKcO4hxh+1LSS4=";
33 url = "https://git.alpinelinux.org/aports/plain/community/directfb/0002-Fix-musl-PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP-comp.patch?id=f8158258493fc0c3eb5de2302e40f4bc44ecfb09";
34 sha256 = "sha256-j3+mcP6hV9LKuba1GOdcM1cZfmXuJtRgx4vE484jIns=";
36 # This uses POSIX basename() while directfb expects GNU
37 # basename(), but the POSIX behaviour of modifying the input
38 # should be fine since directfb never uses the buffer afterwards.
40 url = "https://git.alpinelinux.org/aports/plain/community/directfb/fix-missing-basename.patch?id=bc049ae1bcf9ef3f66cd12a6fbb7ac4e917764b1";
41 hash = "sha256-BX/C8+nh2fovHx8vKXFqKzBtfiTKUcW2BUCsaDIhodc=";
46 # https://github.com/deniskropp/DirectFB/blob/master/src/core/Makefile.am#L15
47 # BUILDTIME is embedded in the result
48 # if switching to cmake then a similar substitution has to be done
49 substituteInPlace src/core/Makefile.am \
50 --replace '`date -u "+%Y-%m-%d %H:%M"`' "`date -u \"+%Y-%m-%d %H:%M\" --date="@''${SOURCE_DATE_EPOCH}"`"
51 '' + lib.optionalString stdenv.hostPlatform.isMusl ''
52 # Specifically patch out two drivers that have build errors with musl libc,
53 # while leaving the rest of the default selection enabled
54 substituteInPlace configure.in \
55 --replace checkfor_lirc={yes,no} \
56 --replace checkfor_matrox={yes,no}
59 nativeBuildInputs = [ autoreconfHook perl pkg-config flux ];
61 buildInputs = [ zlib libjpeg freetype giflib libpng ]
62 ++ lib.optional enableSDL SDL
63 ++ lib.optionals enableX11 (with xorg; [
64 xorgproto libX11 libXext
69 NIX_LDFLAGS = "-lgcc_s";
70 } // lib.optionalAttrs stdenv.cc.isGNU {
71 NIX_CFLAGS_COMPILE = "-fpermissive";
77 "--with-gfxdrivers=all"
84 ++ lib.optional (!stdenv.hostPlatform.isMusl) "--with-smooth-scaling"
85 ++ lib.optional enableX11 "--enable-x11"
88 # Disable parallel building as parallel builds fail due to incomplete
89 # depends between autogenerated CoreSlave.h and it's include sites:
90 # CC prealloc_surface_pool_bridge.lo
91 # prealloc_surface_pool_bridge.c:41:10:
92 # fatal error: core/CoreSlave.h: No such file or directory
94 # Dependencies are specified manually in src/core/Makefile.am. Instead
95 # of fixing them one by one locally let's disable parallel builds until
96 # upstream fixes them.
97 enableParallelBuilding = false;
100 description = "Graphics and input library designed with embedded systems in mind";
102 DirectFB is a thin library that provides hardware graphics acceleration,
103 input device handling and abstraction, integrated windowing system with
104 support for translucent windows and multiple display layers, not only on
105 top of the Linux Framebuffer Device. It is a complete hardware
106 abstraction layer with software fallbacks for every graphics operation
107 that is not supported by the underlying hardware. DirectFB adds graphical
108 power to embedded systems and sets a new standard for graphics under
111 homepage = "https://github.com/deniskropp/DirectFB";
112 license = licenses.lgpl21;
113 platforms = platforms.linux;
114 maintainers = [ maintainers.bjornfor ];