diff options
Diffstat (limited to 'pkgs/development/web/woff2')
-rw-r--r-- | pkgs/development/web/woff2/brotli-static.patch | 36 | ||||
-rw-r--r-- | pkgs/development/web/woff2/default.nix | 16 |
2 files changed, 47 insertions, 5 deletions
diff --git a/pkgs/development/web/woff2/brotli-static.patch b/pkgs/development/web/woff2/brotli-static.patch new file mode 100644 index 00000000000..4ed6d7e741a --- /dev/null +++ b/pkgs/development/web/woff2/brotli-static.patch @@ -0,0 +1,36 @@ +diff a/cmake/FindBrotliDec.cmake b/cmake/FindBrotliDec.cmake +--- a/cmake/FindBrotliDec.cmake ++++ b/cmake/FindBrotliDec.cmake +@@ -18,10 +18,10 @@ find_path(BROTLIDEC_INCLUDE_DIRS + HINTS ${PC_BROTLIDEC_INCLUDEDIR} + ) + +-find_library(BROTLIDEC_LIBRARIES +- NAMES brotlidec +- HINTS ${PC_BROTLIDEC_LIBDIR} +-) ++if(NOT BUILD_SHARED_LIBS) ++ set(_S "STATIC_") ++endif() ++set(BROTLIDEC_LIBRARIES ${PC_BROTLIDEC_${_S}LIBRARIES}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BrotliDec +diff a/cmake/FindBrotliEnc.cmake b/cmake/FindBrotliEnc.cmake +--- a/cmake/FindBrotliEnc.cmake ++++ b/cmake/FindBrotliEnc.cmake +@@ -18,10 +18,10 @@ find_path(BROTLIENC_INCLUDE_DIRS + HINTS ${PC_BROTLIENC_INCLUDEDIR} + ) + +-find_library(BROTLIENC_LIBRARIES +- NAMES brotlienc +- HINTS ${PC_BROTLIENC_LIBDIR} +-) ++if(NOT BUILD_SHARED_LIBS) ++ set(_S "STATIC_") ++endif() ++set(BROTLIENC_LIBRARIES ${PC_BROTLIENC_${_S}LIBRARIES}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BrotliEnc diff --git a/pkgs/development/web/woff2/default.nix b/pkgs/development/web/woff2/default.nix index b77184e5652..ff0484547fc 100644 --- a/pkgs/development/web/woff2/default.nix +++ b/pkgs/development/web/woff2/default.nix @@ -1,4 +1,4 @@ -{ brotli, cmake, fetchFromGitHub, stdenv }: +{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv, static ? false }: stdenv.mkDerivation rec { pname = "woff2"; @@ -13,18 +13,24 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "lib" ]; - nativeBuildInputs = [ cmake ]; + # Need to explicitly link to brotlicommon + patches = stdenv.lib.optional static ./brotli-static.patch; + + nativeBuildInputs = [ cmake pkgconfig ]; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" ] + ++ stdenv.lib.optional static "-DCMAKE_SKIP_RPATH:BOOL=TRUE"; propagatedBuildInputs = [ brotli ]; - # without this binaries only get built if shared libs are disable - patchPhase = '' + postPatch = '' + # without this binaries only get built if shared libs are disable sed 's@^if (NOT BUILD_SHARED_LIBS)$@if (TRUE)@g' -i CMakeLists.txt ''; meta = with stdenv.lib; { description = "Webfont compression reference code"; - homepage = https://github.com/google/woff2; + homepage = "https://github.com/google/woff2"; license = licenses.mit; maintainers = [ maintainers.hrdinka ]; platforms = platforms.unix; |