Archived
1
0
Fork 0

gnu: hwinfo: Use G-expressions.

* gnu/packages/hardware.scm (hwinfo)[source, arguments]:
Rewrite as G-expressions.
This commit is contained in:
Tobias Geerinckx-Rice 2023-07-16 02:00:01 +02:00
parent 2349eb62e2
commit f93605b32b
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -346,78 +346,74 @@ operability and find drivers.")
(modules (modules
'((guix build utils))) '((guix build utils)))
(snippet (snippet
`(begin #~(begin
;; Remove git2log program file. ;; Remove git2log program file.
(delete-file "git2log") (delete-file "git2log")
;; Remove variables that depend on git2log. ;; Remove variables that depend on git2log.
(substitute* "Makefile" (substitute* "Makefile"
(("GIT2LOG.*\\:=.*$") "") (("GIT2LOG.*\\:=.*$") "")
(("GITDEPS.*\\:=.*$") "") (("GITDEPS.*\\:=.*$") "")
(("BRANCH.*\\:=.*$") "")) (("BRANCH.*\\:=.*$") ""))
;; Create version file. ;; Create version file.
(call-with-output-file "VERSION" (call-with-output-file "VERSION"
(lambda (port) (lambda (port) (format port #$version)))))))
(format port ,version)))))))
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs '("out" "lib" "doc")) (outputs '("out" "lib" "doc"))
(arguments (arguments
`(#:tests? #f ; no test-suite available (list
#:phases #:tests? #f ; no test-suite available
(modify-phases %standard-phases #:phases
(add-after 'unpack 'patch #~(modify-phases %standard-phases
(lambda* (#:key outputs #:allow-other-keys) (add-after 'unpack 'patch
(let* ((out (assoc-ref outputs "out")) (lambda _
(lib (assoc-ref outputs "lib")) (let ((include (string-append #$output:lib "/include"))
(doc (assoc-ref outputs "doc")) (lib (string-append #$output:lib "/lib"))
(incl-dir (string-append lib "/include")) (sbin (string-append #$output "/sbin"))
(lib-dir (string-append lib "/lib")) (share (string-append #$output "/share"))
(sbin-dir (string-append out "/sbin")) (doc (string-append #$output:doc "/share/doc")))
(share-dir (string-append out "/share")) ;; Generate HTML documentation in the "doc" output.
(doc-dir (string-append doc "/share/doc"))) (mkdir-p doc)
;; Generate HTML documentation in the output "doc". (substitute* "doc/libhd.doxy"
(mkdir-p doc-dir) (("OUTPUT_DIRECTORY.*=.*libhd")
(substitute* "doc/libhd.doxy" (string-append "OUTPUT_DIRECTORY = " doc "/libhd")))
(("OUTPUT_DIRECTORY.*=.*libhd") ;; Correct values of the version and install directories.
(string-append "OUTPUT_DIRECTORY = " doc-dir "/libhd"))) (substitute* "Makefile"
;; Correct values of the version and install directories. (("VERSION.*\\:=.*$")
(substitute* "Makefile" (string-append "VERSION := " #$version "\n"))
(("VERSION.*\\:=.*$") (("LIBDIR.*\\?=.*$")
(string-append "VERSION := " ,version "\n")) (string-append "LIBDIR ?= " lib "\n"))
(("LIBDIR.*\\?=.*$") (("/usr/include") include)
(string-append "LIBDIR ?= " lib-dir "\n")) (("/(usr|var)/(lib|lib64)") lib)
(("/usr/include") incl-dir) (("/usr/sbin") sbin)
(("/(usr|var)/(lib|lib64)") lib-dir) (("/usr/share") share)
(("/usr/sbin") sbin-dir) (("\\$\\(DESTDIR\\)/sbin ") ""))
(("/usr/share") share-dir) ;; Add the "lib" output to the run-path.
(("\\$\\(DESTDIR\\)/sbin ") "")) (substitute* "Makefile.common"
;; Add the "lib" output to the run-path. (("-Lsrc")
(substitute* "Makefile.common" (string-append "-Lsrc " "-Wl,-rpath=" lib)))
(("-Lsrc") ;; Correct program name of the lexical analyzer.
(string-append "-Lsrc " "-Wl,-rpath=" lib-dir))) (substitute* "src/isdn/cdb/Makefile"
;; Correct program name of the lexical analyzer. (("lex isdn_cdb.lex") "flex isdn_cdb.lex"))
(substitute* "src/isdn/cdb/Makefile" ;; Patch pkg-config file to point to the "lib" output.
(("lex isdn_cdb.lex") "flex isdn_cdb.lex")) (substitute* "hwinfo.pc.in"
;; Patch pkg-config file to point to the "lib" output. (("/usr") #$output:lib)))))
(substitute* "hwinfo.pc.in" (delete 'configure)
(("/usr") lib))))) (replace 'build
(delete 'configure) (lambda* (#:key make-flags #:allow-other-keys)
(replace 'build (setenv "CC" #$(cc-for-target))
(lambda _ (invoke "make" "shared")
(setenv "CC" ,(cc-for-target)) (invoke "make" "doc")))
(invoke "make" "shared") (add-after 'install 'install-man-pages
(invoke "make" "doc"))) (lambda _
(add-after 'install 'install-manpages (let* ((man (string-append #$output "/share/man"))
(lambda* (#:key outputs #:allow-other-keys) (man1 (string-append man "/man1"))
(let* ((out (assoc-ref outputs "out")) (man8 (string-append man "/man8")))
(man-dir (string-append out "/share/man")) (for-each
(man1-dir (string-append man-dir "/man1")) (lambda (x) (install-file x man1))
(man8-dir (string-append man-dir "/man8"))) (find-files "doc" "\\.1$"))
(for-each (for-each
(lambda (x) (install-file x man1-dir)) (lambda (y) (install-file y man8))
(find-files "doc" "\\.1$")) (find-files "doc" "\\.8$"))))))))
(for-each
(lambda (y) (install-file y man8-dir))
(find-files "doc" "\\.8$"))))))))
(native-inputs (native-inputs
(list doxygen flex perl pkg-config)) (list doxygen flex perl pkg-config))
(inputs (inputs