gnu: knot: Use G-expressions.

* gnu/packages/dns.scm (knot)[arguments]:
Rewrite as G-expressions.
This commit is contained in:
Tobias Geerinckx-Rice 2023-07-09 02:00:04 +02:00
parent 60bb22a9da
commit 1c347cd56a
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -866,79 +866,77 @@ Extensions} (DNSSEC).")
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs (list "out" "doc" "lib" "tools")) (outputs (list "out" "doc" "lib" "tools"))
(arguments (arguments
`(#:configure-flags (list
(list (string-append "--docdir=" (assoc-ref %outputs "doc") #:configure-flags
"/share/" ,name "-" ,version) #~(list (string-append "--docdir=" #$output:doc
(string-append "--infodir=" (assoc-ref %outputs "doc") "/share/" #$name "-" #$version)
"/share/info") (string-append "--infodir=" #$output:doc "/share/info")
(string-append "--libdir=" (assoc-ref %outputs "lib") "/lib") (string-append "--libdir=" #$output:lib "/lib")
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--localstatedir=/var" "--localstatedir=/var"
"--disable-static" ; static libraries are built by default "--disable-static" ; static libraries are built by default
"--enable-dnstap" ; let tools read/write capture files "--enable-dnstap" ; let tools read/write capture files
"--enable-fastparser" ; disabled by default when .git/ exists "--enable-fastparser" ; disabled by default when .git/ exists
"--enable-xdp=yes" "--enable-xdp=yes"
"--with-module-dnstap=yes") ; detailed query capturing & logging "--with-module-dnstap=yes") ; detailed query capturing & logging
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'link-missing-libbpf-dependency (add-after 'unpack 'link-missing-libbpf-dependency
;; Linking against -lbpf later would fail to find -lz: libbpf.pc has ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
;; zlib in its Requires.private (not Requires) field. Add it here. ;; zlib in its Requires.private (not Requires) field. Add it here.
(lambda _ (lambda _
(substitute* "configure.ac" (substitute* "configure.ac"
(("enable_xdp=yes" match) (("enable_xdp=yes" match)
(string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\""))))) (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))))
(add-before 'bootstrap 'update-parser (add-before 'bootstrap 'update-parser
(lambda _ (lambda _
(with-directory-excursion "src" (with-directory-excursion "src"
(invoke "sh" "../scripts/update-parser.sh")))) (invoke "sh" "../scripts/update-parser.sh"))))
(add-before 'configure 'disable-directory-pre-creation (add-before 'configure 'disable-directory-pre-creation
(lambda _ (lambda _
;; Don't install empty directories like /etc outside the store. ;; Don't install empty directories like /etc outside the store.
;; This is needed even when using make config_dir=... install. ;; This is needed even when using make config_dir=... install.
(substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true")))) (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))))
(add-after 'build 'build-info (add-after 'build 'build-info
(lambda* (#:key make-flags parallel-build? #:allow-other-keys) (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
(apply invoke "make" "info" (apply invoke "make" "info"
`(,@(if parallel-build? `(,@(if parallel-build?
`("-j" ,(number->string (parallel-job-count))) `("-j" ,(number->string (parallel-job-count)))
'()) '())
,@make-flags)))) ,@make-flags))))
(replace 'install (replace 'install
(lambda* (#:key make-flags outputs parallel-build? #:allow-other-keys) (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((doc (string-append #$output "/share/doc/"
(doc (string-append out "/share/doc/" ,name "-" ,version)) #$name "-" #$version))
(etc (string-append doc "/examples/etc"))) (etc (string-append doc "/examples/etc")))
(apply invoke "make" "install" (apply invoke "make" "install"
(string-append "config_dir=" etc) (string-append "config_dir=" etc)
`(,@(if parallel-build? `(,@(if parallel-build?
`("-j" ,(number->string (parallel-job-count))) `("-j" ,(number->string (parallel-job-count)))
'()) '())
,@make-flags))))) ,@make-flags)))))
(add-after 'install 'install-info (add-after 'install 'install-info
(lambda* (#:key make-flags parallel-build? #:allow-other-keys) (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
(apply invoke "make" "install-info" (apply invoke "make" "install-info"
`(,@(if parallel-build? `(,@(if parallel-build?
`("-j" ,(number->string (parallel-job-count))) `("-j" ,(number->string (parallel-job-count)))
'()) '())
,@make-flags)))) ,@make-flags))))
(add-after 'install 'break-circular-:lib->:out-reference (add-after 'install 'break-circular-:lib->:out-reference
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(let ((lib (assoc-ref outputs "lib"))) (for-each (lambda (file)
(for-each (lambda (file) (substitute* file
(substitute* file (("(prefix=).*" _ assign)
(("(prefix=).*" _ assign) (string-append assign #$output:lib "\n"))))
(string-append assign lib "\n")))) (find-files #$output:lib "\\.pc$"))))
(find-files lib "\\.pc$"))))) (add-after 'install 'split:tools
(add-after 'install 'split-:tools (lambda _
(lambda* (#:key outputs #:allow-other-keys) (define (move source target file)
(let* ((out (assoc-ref outputs "out")) (mkdir-p (dirname (string-append target "/" file)))
(tools (assoc-ref outputs "tools"))) (rename-file (string-append source "/" file)
(mkdir-p (string-append tools "/share/man")) (string-append target "/" file)))
(rename-file (string-append out "/bin") (move #$output #$output:tools "bin")
(string-append tools "/bin")) (move #$output #$output:tools "share/man/man1"))))))
(rename-file (string-append out "/share/man/man1")
(string-append tools "/share/man/man1"))))))))
(native-inputs (native-inputs
(list autoconf (list autoconf
automake automake