+(define-public ghostscript/fixed
+ (hidden-package
+ (package
+ (inherit ghostscript)
+ (version "9.24")
+ (source
+ (origin
+ (inherit (package-source ghostscript))
+ (uri (string-append "https://github.com/ArtifexSoftware/"
+ "ghostpdl-downloads/releases/download/gs"
+ (string-delete #\. version)
+ "/ghostscript-" version ".tar.xz"))
+ (sha256
+ (base32
+ "1mk922rnml93w2g42yxiyn8xqanc50cm65irrgh0b6lp4kgifjfl"))
+ (patches (search-patches "ghostscript-CVE-2018-16509.patch"
+ "ghostscript-bug-699708.patch"
+ "ghostscript-no-header-creationdate.patch"
+ "ghostscript-no-header-id.patch"
+ "ghostscript-no-header-uuid.patch"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments ghostscript)
+ ((#:configure-flags flags)
+ ;; Notice that we removed the 'ghostscript-runpath' patch above.
+ ;; The reason is that it conflicts with an upstream change that
+ ;; takes LDFLAGS into account.
+ `(cons (string-append "LDFLAGS=-Wl,-rpath="
+ (assoc-ref %outputs "out") "/lib")
+ ,flags))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'create-output-directory
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; Unfortunately the configure script refuses to function if
+ ;; the directory specified as -rpath does not already exist.
+ (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
+ #t)))))))))
+