blob: d2a4206e7dc1a4ca639be0f317c916550b14750e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{ lib
, stdenv
, llvmPackages
, fetchurl
, pkg-config
, freetype
, cmake
, static ? stdenv.hostPlatform.isStatic
, testers
}:
stdenv.mkDerivation (finalAttrs: {
version = "1.3.14";
pname = "graphite2";
src = fetchurl {
url = with finalAttrs; "https://github.com/silnrsi/graphite/releases/download/${version}/${pname}-${version}.tgz";
sha256 = "1790ajyhk0ax8xxamnrk176gc9gvhadzy78qia4rd8jzm89ir7gr";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [ pkg-config cmake ];
buildInputs = [ freetype ]
++ lib.optional (stdenv.targetPlatform.useLLVM or false)
(llvmPackages.compiler-rt.override {
doFakeLibgcc = true;
});
patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./macosx.patch ];
postPatch = ''
# disable broken 'nametabletest' test, fails on gcc-13:
# https://github.com/silnrsi/graphite/pull/74
substituteInPlace tests/CMakeLists.txt \
--replace 'add_subdirectory(nametabletest)' '#add_subdirectory(nametabletest)'
# support cross-compilation by using target readelf binary:
substituteInPlace Graphite.cmake \
--replace 'readelf' "${stdenv.cc.targetPrefix}readelf"
'';
cmakeFlags = lib.optionals static [
"-DBUILD_SHARED_LIBS=OFF"
];
# Remove a test that fails to statically link (undefined reference to png and
# freetype symbols)
postConfigure = lib.optionalString static ''
sed -e '/freetype freetype.c/d' -i ../tests/examples/CMakeLists.txt
'';
doCheck = true;
passthru.tests = {
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = with lib; {
description = "Advanced font engine";
homepage = "https://graphite.sil.org/";
license = licenses.lgpl21;
maintainers = [ maintainers.raskin ];
pkgConfigModules = [ "graphite2" ];
mainProgram = "gr2fonttest";
platforms = platforms.unix ++ platforms.windows;
};
})
|