Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / silgraphite / graphite2.nix
blob5e7358fa15f9a2866b3f4b9ab6796229e78dcceb
1 { lib
2 , stdenv
3 , fetchurl
4 , pkg-config
5 , freetype
6 , cmake
7 , static ? stdenv.hostPlatform.isStatic
8 }:
10 stdenv.mkDerivation rec {
11   version = "1.3.14";
12   pname = "graphite2";
14   src = fetchurl {
15     url = "https://github.com/silnrsi/graphite/releases/download/"
16       + "${version}/graphite2-${version}.tgz";
17     sha256 = "1790ajyhk0ax8xxamnrk176gc9gvhadzy78qia4rd8jzm89ir7gr";
18   };
20   outputs = [ "out" "dev" ];
22   nativeBuildInputs = [ pkg-config cmake ];
23   buildInputs = [ freetype ];
25   patches = lib.optionals stdenv.isDarwin [ ./macosx.patch ];
26   postPatch = ''
27     # disable broken 'nametabletest' test, fails on gcc-13:
28     #   https://github.com/silnrsi/graphite/pull/74
29     substituteInPlace tests/CMakeLists.txt \
30       --replace 'add_subdirectory(nametabletest)' '#add_subdirectory(nametabletest)'
31   '';
33   cmakeFlags = lib.optionals static [
34     "-DBUILD_SHARED_LIBS=OFF"
35   ];
37   # Remove a test that fails to statically link (undefined reference to png and
38   # freetype symbols)
39   postConfigure = lib.optionalString static ''
40     sed -e '/freetype freetype.c/d' -i ../tests/examples/CMakeLists.txt
41   '';
43   doCheck = true;
45   meta = with lib; {
46     description = "An advanced font engine";
47     homepage = "https://graphite.sil.org/";
48     license = licenses.lgpl21;
49     maintainers = [ maintainers.raskin ];
50     mainProgram = "gr2fonttest";
51     platforms = platforms.unix;
52   };