lol
1{ brotli, cmake, pkg-config, fetchFromGitHub, lib, stdenv
2, static ? stdenv.hostPlatform.isStatic
3}:
4
5stdenv.mkDerivation rec {
6 pname = "woff2";
7 version = "1.0.2";
8
9 src = fetchFromGitHub {
10 owner = "google";
11 repo = "woff2";
12 rev = "v${version}";
13 sha256 = "13l4g536h0pr84ww4wxs2za439s0xp1va55g6l478rfbb1spp44y";
14 };
15
16 outputs = [ "out" "dev" "lib" ];
17
18 # Need to explicitly link to brotlicommon
19 patches = lib.optional static ./brotli-static.patch;
20
21 nativeBuildInputs = [ cmake pkg-config ];
22
23 cmakeFlags = [
24 "-DCANONICAL_PREFIXES=ON"
25 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
26 ] ++ lib.optional static "-DCMAKE_SKIP_RPATH:BOOL=TRUE";
27
28 propagatedBuildInputs = [ brotli ];
29
30 postPatch = ''
31 # without this binaries only get built if shared libs are disable
32 sed 's@^if (NOT BUILD_SHARED_LIBS)$@if (TRUE)@g' -i CMakeLists.txt
33 '';
34
35 meta = with lib; {
36 description = "Webfont compression reference code";
37 homepage = "https://github.com/google/woff2";
38 license = licenses.mit;
39 maintainers = [ maintainers.hrdinka ];
40 platforms = platforms.unix;
41 };
42}