1{ lib
2, stdenv
3, fetchFromGitHub
4, autoreconfHook
5, doxygen
6, freeglut
7, freetype
8, libGL
9, libGLU
10, pkg-config
11, darwin
12}:
13
14let
15 inherit (darwin.apple_sdk.frameworks) OpenGL GLUT;
16in
17stdenv.mkDerivation rec {
18 pname = "ftgl";
19 version = "2.4.0";
20
21 src = fetchFromGitHub {
22 owner = "frankheckenbach";
23 repo = "ftgl";
24 rev = "v${version}";
25 hash = "sha256-6TDNGoMeBLnucmHRgEDIVWcjlJb7N0sTluqBwRMMWn4=";
26 };
27
28 # GL_DYLIB is hardcoded to an impure path
29 # /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
30 # and breaks build on recent macOS versions
31 postPatch = ''
32 substituteInPlace m4/gl.m4 \
33 --replace ' -dylib_file $GL_DYLIB: $GL_DYLIB' ""
34 '';
35
36 nativeBuildInputs = [
37 autoreconfHook
38 doxygen
39 pkg-config
40 ];
41 buildInputs = [
42 freetype
43 ] ++ (if stdenv.isDarwin then [
44 OpenGL
45 GLUT
46 ] else [
47 libGL
48 libGLU
49 freeglut
50 ]);
51
52 configureFlags = [
53 "--with-ft-prefix=${lib.getDev freetype}"
54 ];
55
56 enableParallelBuilding = true;
57
58 postInstall = ''
59 install -Dm644 src/FTSize.h -t ${placeholder "out"}/include/FTGL
60 install -Dm644 src/FTFace.h -t ${placeholder "out"}/include/FTGL
61 '';
62
63 meta = with lib; {
64 homepage = "https://github.com/frankheckenbach/ftgl";
65 description = "Font rendering library for OpenGL applications";
66 longDescription = ''
67 FTGL is a free cross-platform Open Source C++ library that uses Freetype2
68 to simplify rendering fonts in OpenGL applications. FTGL supports bitmaps,
69 pixmaps, texture maps, outlines, polygon mesh, and extruded polygon
70 rendering modes.
71 '';
72 license = licenses.mit;
73 maintainers = with maintainers; [ AndersonTorres ];
74 platforms = platforms.unix;
75 };
76}