wkhtmltopdf.scm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. (define-module (wkhtmltopdf)
  2. #:use-module (guix packages)
  3. #:use-module (guix download)
  4. #:use-module (guix utils)
  5. #:use-module (guix build-system qt)
  6. #:use-module (guix build-system python)
  7. #:use-module ((guix licenses) #:prefix license:)
  8. #:use-module (gnu packages compression) ; zlib
  9. #:use-module (gnu packages fontutils)
  10. #:use-module (gnu packages image)
  11. #:use-module (gnu packages tls) ; openssl
  12. #:use-module (gnu packages xorg)
  13. #:use-module (gnu packages qt)
  14. #:use-module (srfi srfi-1))
  15. (define-public wkhtmltopdf
  16. (package
  17. (name "wkhtmltopdf")
  18. (version "0.12.5")
  19. (source (origin
  20. (method url-fetch)
  21. (uri
  22. (string-append
  23. "https://github.com/wkhtmltopdf/wkhtmltopdf/archive/"
  24. version ".tar.gz"))
  25. (sha256
  26. (base32
  27. "08a659qsgn00a3cddh7sx5g0d12vm3ajrpmavbcb5gpmw9hnw7c6"))))
  28. (build-system qt-build-system)
  29. (native-inputs `(("qtbase" ,qtbase))) ;; For qmake
  30. (inputs `(("fontconfig" ,fontconfig)
  31. ("freetype" ,freetype)
  32. ("qtwebkit" ,qtwebkit)
  33. ("qtsvg" ,qtsvg)
  34. ("qtxmlpatterns" ,qtxmlpatterns)
  35. ("libpng" ,libpng)
  36. ("zlib" ,zlib)
  37. ("libjpeg" ,libjpeg-turbo)
  38. ("openssl" ,openssl)
  39. ("libx11" ,libx11)
  40. ("libxext" ,libxext)
  41. ("libxrender" ,libxrender)))
  42. (arguments
  43. '(#:tests? #f
  44. #:phases
  45. (modify-phases %standard-phases
  46. (replace 'configure
  47. (lambda* (#:key outputs #:allow-other-keys)
  48. (let ((out (assoc-ref outputs "out")))
  49. (substitute* (list "wkhtmltopdf.pro" "src/lib/lib.pro"
  50. ;;"src/shared/shared.pro"
  51. "src/image/image.pro" "src/pdf/pdf.pro")
  52. ;;(substitute* (find-files ".*pro")
  53. (("$(INSTALL_ROOT)") ""))
  54. (invoke "qmake"
  55. (string-append "wkhtmltopdf.pro INSTALLBASE=" out))
  56. #t)))
  57. ;; Fails at install
  58. ;; starting phase `install'
  59. ;; ...
  60. ;; make[1]: Entering directory '/tmp/guix-build-wkhtmltopdf-0.12.5.drv-0/wkhtmltopdf-0.12.5/src/lib'
  61. ;; mkdir: cannot create directory ‘/include’: Permission denied
  62. ;; make[1]: *** [Makefile:823: install_headers] Error 1
  63. )))
  64. ;; Meta
  65. (synopsis "Tools for rendering web pages to PDF or images")
  66. (description "wkhtmltopdf and wkhtmltoimage are open source (LGPL)
  67. command line tools to render HTML into PDF and various image formats
  68. using the QT Webkit rendering engine. These run entirely \"headless\" and
  69. do not require a display or display service.
  70. There is also a C library, if you're into that kind of
  71. thing.
  72. GUIX Specific: C library is untested")
  73. (home-page "http://wkhtmltopdf.org/")
  74. (license license:lgpl3+)))
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;
  76. ;; NIX
  77. ;;;;;;;;;;;;;;;;;;;;;;;;;
  78. ;;{ mkDerivation, lib, fetchFromGitHub, qtwebkit, qtsvg, qtxmlpatterns
  79. ;;, fontconfig, freetype, libpng, zlib, libjpeg
  80. ;;, openssl, libX11, libXext, libXrender }:
  81. ;;mkDerivation rec {
  82. ;; prePatch = ''
  83. ;; for f in src/image/image.pro src/pdf/pdf.pro ; do
  84. ;; substituteInPlace $f --replace '$(INSTALL_ROOT)' ""
  85. ;; done
  86. ;; '';
  87. ;; configurePhase = "qmake wkhtmltopdf.pro INSTALLBASE=$out";
  88. ;;
  89. ;; enableParallelBuilding = true;
  90. ;;
  91. ;; meta = with lib; {
  92. ;; homepage = "https://wkhtmltopdf.org/";
  93. ;; description = "Tools for rendering web pages to PDF or images";
  94. ;; longDescription = ''
  95. ;; wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools
  96. ;; to render HTML into PDF and various image formats using the QT Webkit
  97. ;; rendering engine. These run entirely "headless" and do not require a
  98. ;; display or display service.
  99. ;;
  100. ;; There is also a C library, if you're into that kind of thing.
  101. ;; '';
  102. ;; license = licenses.gpl3Plus;
  103. ;; maintainers = with maintainers; [ jb55 ];
  104. ;; platforms = with platforms; linux;
  105. ;; };
  106. ;;}