Unverified Commit 6f884c2f authored by Wael Nasreddine's avatar Wael Nasreddine Committed by GitHub
Browse files

Merge pull request #181407 from kalbasit/wkhtmltopdf

parents 3e3c3643 19603a74
Loading
Loading
Loading
Loading
+76 −21
Original line number Diff line number Diff line
{ stdenv, lib, fetchurl, wkhtmltopdf, xar, cpio }:
{ lib
, autoPatchelfHook
, cpio
, freetype
, zlib
, openssl
, dpkg
, fetchurl
, gcc-unwrapped
, libjpeg8
, libpng
, fontconfig
, stdenv
, wkhtmltopdf
, xar
, xorg
}:

stdenv.mkDerivation rec {

  pname = "wkhtmltopdf-bin";
  version = "0.12.6-1";
  sha256 = "1db59kdprzpmvdj1bg47lmfgi3zlvzvqif11sbym9hw61xy6gp3d";
let
  darwinAttrs = rec {
    version = "0.12.6-2";
    src = fetchurl {
    url =
      "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg";
    inherit sha256;
      url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg";
      sha256 = "sha256-gaZrd7UI/t6NvKpnEnIDdIN2Vos2c6F/ZhG21R6YlPg=";
    };

  buildInputs = [ xar cpio ];
    nativeBuildInputs = [ xar cpio ];

    unpackPhase = ''
      xar -xf $src
@@ -20,9 +33,48 @@ stdenv.mkDerivation rec {
    '';

    installPhase = ''
      runHook preInstall
      mkdir -p $out
      cp -r bin include lib share $out/
      runHook postInstall
    '';
  };

  linuxAttrs = rec {
    version = "0.12.6-3";
    src = fetchurl {
      url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.archlinux-x86_64.pkg.tar.xz";
      sha256 = "sha256-6Ewu8sPRbqvYWj27mBlQYpEN+mb+vKT46ljrdEUxckI=";
    };

    nativeBuildInputs = [ autoPatchelfHook ];

    buildInputs = [
      xorg.libXext
      xorg.libXrender

      freetype
      openssl
      zlib

      (lib.getLib fontconfig)
      (lib.getLib gcc-unwrapped)
      (lib.getLib libjpeg8)
      (lib.getLib libpng)
    ];

    unpackPhase = "tar -xf $src";

    installPhase = ''
      runHook preInstall
      mkdir -p $out
      cp -r usr/bin usr/include usr/lib usr/share $out/
      runHook postInstall
    '';
  };
in
stdenv.mkDerivation ({
  pname = "wkhtmltopdf-bin";

  dontStrip = true;

@@ -45,7 +97,10 @@ stdenv.mkDerivation rec {
      There is also a C library, if you're into that kind of thing.
    '';
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ nbr ];
    platforms = [ "x86_64-darwin" ];
    maintainers = with maintainers; [ nbr kalbasit ];
    platforms = [ "x86_64-darwin" "x86_64-linux" ];
  };
}
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin) darwinAttrs
// lib.optionalAttrs (stdenv.hostPlatform.isLinux) linuxAttrs
)
+3 −1
Original line number Diff line number Diff line
@@ -12032,7 +12032,9 @@ with pkgs;
  wkhtmltopdf = libsForQt514.callPackage ../tools/graphics/wkhtmltopdf { };
  wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { };
  wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin {
    libjpeg8 = libjpeg.override { enableJpeg8 = true; };
  };
  wml = callPackage ../development/web/wml { };