From 73ed8c7a0fd5a3818fd181f71f6fe02659c2da9b Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 4 Sep 2017 23:47:33 -0400 Subject: [PATCH 3/3] gnu: poppler: Use openjpeg-2. * gnu/packages/pdf.scm (poppler)[inputs]: Use 'openjpeg' instead of 'openjpeg-1'. [arguments]: Rewrite 'setenv' phase to work with any version of openjpeg. --- gnu/packages/pdf.scm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 5e52d87ca..ea1e0a327 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2015, 2016 Andreas Enge -;;; Copyright © 2014 Mark H Weaver +;;; Copyright © 2014, 2017 Mark H Weaver ;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus ;;; Copyright © 2015 Paul van der Walt ;;; Copyright © 2016 Roel Janssen @@ -93,7 +93,7 @@ ("libpng" ,libpng) ("libtiff" ,libtiff) ("lcms" ,lcms) - ("openjpeg-1" ,openjpeg-1) ; prefers openjpeg-1 + ("openjpeg" ,openjpeg) ("zlib" ,zlib) ;; To build poppler-glib (as needed by Evince), we need Cairo and @@ -117,11 +117,20 @@ #:phases (modify-phases %standard-phases (add-before 'configure 'setenv - (lambda _ - (setenv "CPATH" - (string-append (assoc-ref %build-inputs "openjpeg-1") - "/include/openjpeg-1.5" - ":" (or (getenv "CPATH") ""))) + (lambda* (#:key inputs #:allow-other-keys) + (let* ((openjpeg (assoc-ref inputs "openjpeg")) + (top-include-dir (string-append openjpeg "/include")) + (include-dirs (map dirname (find-files top-include-dir + "^openjpeg.h$"))) + (old-CPATH (getenv "CPATH"))) + (unless (= 1 (length include-dirs)) + (error "Unable to determine location of openjpeg.h")) + (format #t "Prepending ~s to CPATH~%" (car include-dirs)) + (setenv "CPATH" + (string-append (car include-dirs) + (if old-CPATH + (string-append ":" old-CPATH) + "")))) #t))))) (synopsis "PDF rendering library") (description -- 2.14.1