8 , static ? stdenv.hostPlatform.isStatic
12 stdenv.mkDerivation (finalAttrs: {
17 url = with finalAttrs; "https://github.com/silnrsi/graphite/releases/download/${version}/${pname}-${version}.tgz";
18 sha256 = "1790ajyhk0ax8xxamnrk176gc9gvhadzy78qia4rd8jzm89ir7gr";
21 outputs = [ "out" "dev" ];
23 nativeBuildInputs = [ pkg-config cmake ];
24 buildInputs = [ freetype ]
25 ++ lib.optional (stdenv.targetPlatform.useLLVM or false)
26 (llvmPackages.compiler-rt.override {
30 patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./macosx.patch ];
32 # disable broken 'nametabletest' test, fails on gcc-13:
33 # https://github.com/silnrsi/graphite/pull/74
34 substituteInPlace tests/CMakeLists.txt \
35 --replace 'add_subdirectory(nametabletest)' '#add_subdirectory(nametabletest)'
37 # support cross-compilation by using target readelf binary:
38 substituteInPlace Graphite.cmake \
39 --replace 'readelf' "${stdenv.cc.targetPrefix}readelf"
42 cmakeFlags = lib.optionals static [
43 "-DBUILD_SHARED_LIBS=OFF"
46 # Remove a test that fails to statically link (undefined reference to png and
48 postConfigure = lib.optionalString static ''
49 sed -e '/freetype freetype.c/d' -i ../tests/examples/CMakeLists.txt
55 pkg-config = testers.hasPkgConfigModules {
56 package = finalAttrs.finalPackage;
61 description = "Advanced font engine";
62 homepage = "https://graphite.sil.org/";
63 license = licenses.lgpl21;
64 maintainers = [ maintainers.raskin ];
65 pkgConfigModules = [ "graphite2" ];
66 mainProgram = "gr2fonttest";
67 platforms = platforms.unix ++ platforms.windows;