Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / web / woff2 / default.nix
blob2f18634449809351a2764e1228c56f9ad7e0bc26
1 { brotli, cmake, pkg-config, fetchFromGitHub, lib, stdenv
2 , static ? stdenv.hostPlatform.isStatic
3 }:
5 stdenv.mkDerivation rec {
6   pname = "woff2";
7   version = "1.0.2";
9   src = fetchFromGitHub {
10     owner = "google";
11     repo = "woff2";
12     rev = "v${version}";
13     sha256 = "13l4g536h0pr84ww4wxs2za439s0xp1va55g6l478rfbb1spp44y";
14   };
16   outputs = [ "out" "dev" "lib" ];
18   # Need to explicitly link to brotlicommon
19   patches = lib.optional static ./brotli-static.patch;
21   nativeBuildInputs = [ cmake pkg-config ];
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";
28   propagatedBuildInputs = [ brotli ];
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   '';
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   };