Skip to content

Commit

Permalink
wkhtmltopdf: unbreak on darwin
Browse files Browse the repository at this point in the history
Unbreak wkhtmltopdf on darwin by changing dylib paths.

Fixes issue NixOS#11861.
  • Loading branch information
jiegec committed Jul 8, 2022
1 parent 1ba4ca5 commit e757562
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkgs/tools/graphics/wkhtmltopdf/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ mkDerivation, lib, fetchFromGitHub, qtwebkit, qtsvg, qtxmlpatterns
, fontconfig, freetype, libpng, zlib, libjpeg
{ stdenv, lib, fetchFromGitHub, qtwebkit, qtsvg, qtxmlpatterns
, fontconfig, freetype, libpng, zlib, libjpeg, wrapQtAppsHook
, openssl, libX11, libXext, libXrender }:

mkDerivation rec {
stdenv.mkDerivation rec {
version = "0.12.6";
pname = "wkhtmltopdf";

Expand All @@ -13,6 +13,10 @@ mkDerivation rec {
sha256 = "0m2zy986kzcpg0g3bvvm815ap9n5ann5f6bdy7pfj6jv482bm5mg";
};

nativeBuildInputs = [
wrapQtAppsHook
];

buildInputs = [
fontconfig freetype libpng zlib libjpeg openssl
libX11 libXext libXrender
Expand All @@ -25,6 +29,12 @@ mkDerivation rec {
done
'';

# rewrite library path
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -change libwkhtmltox.0.dylib $out/lib/libwkhtmltox.0.dylib $out/bin/wkhtmltopdf
install_name_tool -change libwkhtmltox.0.dylib $out/lib/libwkhtmltox.0.dylib $out/bin/wkhtmltoimage
'';

configurePhase = "qmake wkhtmltopdf.pro INSTALLBASE=$out";

enableParallelBuilding = true;
Expand All @@ -42,6 +52,6 @@ mkDerivation rec {
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ jb55 ];
platforms = with platforms; linux;
platforms = platforms.unix;
};
}

0 comments on commit e757562

Please sign in to comment.