2021-01-19 06:50:56 +00:00
|
|
|
{ brotli, cmake, pkg-config, fetchFromGitHub, lib, stdenv
|
2021-01-03 21:40:14 +00:00
|
|
|
, static ? stdenv.hostPlatform.isStatic
|
|
|
|
}:
|
2017-12-29 10:38:08 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "woff2";
|
2017-12-29 10:38:08 +00:00
|
|
|
version = "1.0.2";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "woff2";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "13l4g536h0pr84ww4wxs2za439s0xp1va55g6l478rfbb1spp44y";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "lib" ];
|
|
|
|
|
2019-12-16 12:12:48 +00:00
|
|
|
# Need to explicitly link to brotlicommon
|
2021-01-23 17:15:07 +00:00
|
|
|
patches = lib.optional static ./brotli-static.patch;
|
2019-12-16 12:12:48 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2019-12-16 12:12:48 +00:00
|
|
|
|
2020-11-16 23:42:48 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCANONICAL_PREFIXES=ON"
|
|
|
|
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
|
2021-01-23 17:15:07 +00:00
|
|
|
] ++ lib.optional static "-DCMAKE_SKIP_RPATH:BOOL=TRUE";
|
2017-12-29 10:38:08 +00:00
|
|
|
|
2018-03-15 00:19:39 +00:00
|
|
|
propagatedBuildInputs = [ brotli ];
|
2017-12-29 10:38:08 +00:00
|
|
|
|
2019-12-16 12:12:48 +00:00
|
|
|
postPatch = ''
|
|
|
|
# without this binaries only get built if shared libs are disable
|
2017-12-29 10:38:08 +00:00
|
|
|
sed 's@^if (NOT BUILD_SHARED_LIBS)$@if (TRUE)@g' -i CMakeLists.txt
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-12-29 10:38:08 +00:00
|
|
|
description = "Webfont compression reference code";
|
2019-12-16 12:12:48 +00:00
|
|
|
homepage = "https://github.com/google/woff2";
|
2017-12-29 10:38:08 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.hrdinka ];
|
2018-05-30 02:20:56 +01:00
|
|
|
platforms = platforms.unix;
|
2017-12-29 10:38:08 +00:00
|
|
|
};
|
|
|
|
}
|