Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, stdenv
3, makeWrapper
4, fetchFromGitHub
5, libX11
6, pkg-config
7, gdb
8, freetype
9, freetypeSupport ? true
10, extensions ? [ ]
11}:
12
13stdenv.mkDerivation rec {
14 pname = "gf";
15 version = "unstable-2022-09-26";
16
17 src = fetchFromGitHub {
18 repo = "gf";
19 owner = "nakst";
20 rev = "404fc6d66c60bb01e9bcbb69021e66c543bda2d5";
21 hash = "sha256-HRejpEN/29Q+wukU3Jv3vZoK6/VjZK6VnZdvPuFBC9I=";
22 };
23
24 nativeBuildInputs = [ makeWrapper pkg-config ];
25 buildInputs = [ libX11 gdb ]
26 ++ lib.optional freetypeSupport freetype;
27
28 patches = [
29 ./build-use-optional-freetype-with-pkg-config.patch
30 ];
31
32 postPatch = lib.forEach extensions (ext: ''
33 cp ${ext} ./${ext.name or (builtins.baseNameOf ext)}
34 '');
35
36 preConfigure = ''
37 patchShebangs build.sh
38 '';
39
40 buildPhase = ''
41 runHook preBuild
42 extra_flags=-DUI_FREETYPE_SUBPIXEL ./build.sh
43 runHook postBuild
44 '';
45
46 installPhase = ''
47 runHook preInstall
48 mkdir -p "$out/bin"
49 cp gf2 "$out/bin/"
50 runHook postInstall
51 '';
52
53 postFixup = ''
54 wrapProgram $out/bin/gf2 --prefix PATH : ${lib.makeBinPath[ gdb ]}
55 '';
56
57 meta = with lib; {
58 description = "A GDB Frontend";
59 homepage = "https://github.com/nakst/gf";
60 license = licenses.mit;
61 platforms = platforms.linux;
62 maintainers = with maintainers; [ _0xd61 ];
63 };
64}