gnu: xdg-utils: Resolve TODOs.

* gnu/packages/freedesktop.scm (xdg-utils)[inputs]: Remove labels.
[arguments]: Make cross-compilation fixes unconditional.  Don't rely on labels.
This commit is contained in:
Marius Bakke 2022-11-18 09:50:54 +01:00 committed by Maxim Cournoyer
parent b14e54b5db
commit 644a019367
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -474,79 +474,51 @@ (define-public xdg-utils
(name "xdg-utils") (name "xdg-utils")
(version "1.1.3") (version "1.1.3")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (string-append (uri (string-append
"https://portland.freedesktop.org/download/xdg-utils-" "https://portland.freedesktop.org/download/xdg-utils-"
version ".tar.gz")) version ".tar.gz"))
(sha256 (sha256
(base32 (base32
"1nai806smz3zcb2l5iny4x7li0fak0rzmjg6vlyhdqm8z25b166p")))) "1nai806smz3zcb2l5iny4x7li0fak0rzmjg6vlyhdqm8z25b166p"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(native-inputs (native-inputs
(list docbook-xsl docbook-xml-4.1.2 libxslt w3m-for-tests xmlto)) (list docbook-xsl docbook-xml-4.1.2 libxslt w3m-for-tests xmlto))
(inputs (inputs
`(("awk" ,gawk) (list bash-minimal ;for 'wrap-program'
;; TODO(staging): Make this unconditional, to avoid canonical packages, coreutils
;; see <https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00148.html>. file
,@(if (%current-target-system) gawk
`(("bash-minimal" ,bash-minimal)) ; for 'wrap-program' grep
'()) inetutils ;xdg-screensaver uses `hostname'
("coreutils" ,coreutils) perl-file-mimeinfo ;for mimeopen fallback
,@(if (%current-target-system) sed
`(("file" ,file)) xprop ;for Xfce detecting
'()) xset)) ;for xdg-screensaver
("grep" ,grep)
("inetutils" ,inetutils) ; xdg-screensaver uses `hostname'
("perl-file-mimeinfo" ,perl-file-mimeinfo) ; for mimeopen fallback
("sed" ,sed)
("xprop" ,xprop) ; for Xfce detecting
("xset" ,xset))) ; for xdg-screensaver
(arguments (arguments
`(#:tests? #f ; no check target `(#:tests? #f ;no check target
#:modules ((srfi srfi-26) #:modules ((srfi srfi-26)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-after 'unpack 'patch-hardcoded-paths (add-after 'unpack 'patch-hardcoded-paths
;; TODO(staging): make unconditional (lambda* (#:key inputs #:allow-other-keys)
(,@(if (%current-target-system) (substitute* "scripts/xdg-mime.in"
'(lambda* (#:key inputs #:allow-other-keys)) (("/usr/bin/file")
'(lambda _)) (search-input-file inputs "bin/file")))
(substitute* "scripts/xdg-mime.in" (substitute* "scripts/xdg-open.in"
(("/usr/bin/file") (("/usr/bin/printf")
(,@(if (%current-target-system) (search-input-file inputs "bin/printf")))))
'(search-input-file inputs "bin/file")
'(which "file")))))
(substitute* "scripts/xdg-open.in"
(("/usr/bin/printf")
(,@(if (%current-target-system)
'(search-input-file inputs "bin/printf")
'(which "printf")))))
#t))
(add-before 'build 'locate-catalog-files (add-before 'build 'locate-catalog-files
;; TODO(staging): Make unconditional for simplicity. (lambda* (#:key native-inputs inputs #:allow-other-keys)
(lambda* (#:key inputs ,@(if (%current-target-system) (let* ((native (or native-inputs inputs))
'(native-inputs) (xmldoc (search-input-directory native
'()) #:allow-other-keys) "xml/dtd/docbook"))
;; TODO(staging): Make unconditional for simplicity and (xsldoc (search-input-directory
;; to avoid depending on input labels. native
(let ,(if (%current-target-system) (string-append "xml/xsl/docbook-xsl-"
`((native-inputs (or native-inputs inputs)) ,(package-version docbook-xsl)))))
(xmldoc (search-input-directory native-inputs
"xml/dtd/docbook"))
(xsldoc
(search-input-directory
native-inputs
(string-append "xml/xsl/docbook-xsl-"
,(package-version docbook-xsl)))))
`((xmldoc
(string-append (assoc-ref inputs "docbook-xml")
"/xml/dtd/docbook"))
(xsldoc
(string-append (assoc-ref inputs "docbook-xsl")
"/xml/xsl/docbook-xsl-"
,(package-version docbook-xsl)))))
(for-each (lambda (file) (for-each (lambda (file)
(substitute* file (substitute* file
(("http://.*/docbookx\\.dtd") (("http://.*/docbookx\\.dtd")
@ -561,25 +533,21 @@ (define-public xdg-utils
(string-append "$(XMLTO) -x " xsldoc (string-append "$(XMLTO) -x " xsldoc
"/manpages/docbook.xsl man"))) "/manpages/docbook.xsl man")))
(setenv "STYLESHEET" (setenv "STYLESHEET"
(string-append xsldoc "/html/docbook.xsl")) (string-append xsldoc "/html/docbook.xsl")))))
;; TODO(staging): Might as well remove the #t while we are at
;; it.
#t)))
(add-after 'install 'wrap-executables (add-after 'install 'wrap-executables
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))) (let* ((out (assoc-ref outputs "out"))
(dependencies '("awk" "grep" "hostname" "ls" "mimeopen"
"sed" "xprop" "xset"))
(pkgs (map (lambda (cmd)
(search-input-file inputs
(string-append "bin/" cmd)))
dependencies))
(bindirs (map dirname pkgs)))
(with-directory-excursion (string-append out "/bin") (with-directory-excursion (string-append out "/bin")
(let ((path-ext (for-each (cute wrap-program <>
(map (cute string-append <> "/bin") `("PATH" ":" prefix ,bindirs))
(cons out (find-files ".")))))))))
(map (cute assoc-ref inputs <>)
'("awk" "coreutils" "grep" "inetutils"
"perl-file-mimeinfo" "sed" "xprop"
"xset"))))))
(for-each (cute wrap-program <>
`("PATH" ":" prefix ,path-ext))
(find-files "."))))
#t))))))
(home-page "https://www.freedesktop.org/wiki/Software/xdg-utils/") (home-page "https://www.freedesktop.org/wiki/Software/xdg-utils/")
(synopsis "Freedesktop.org scripts for desktop integration") (synopsis "Freedesktop.org scripts for desktop integration")
(description "The xdg-utils package is a set of simple scripts that (description "The xdg-utils package is a set of simple scripts that