From 38ae89365b9bff6676d771c74589af391e53283b Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Thu, 15 Oct 2020 02:36:02 +0200 Subject: [PATCH] gnu: knot: Build separate outputs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/dns.scm (knot)[outputs]: New field adding :doc, :lib, and :tools outputs. [arguments]: Add #:configure-flags to install into :doc and :lib. Add a new ‘split-:tools’ phase to install into :tools. Add a new ‘break-circular-:lib->:out-reference’ phase to do just that. --- gnu/packages/dns.scm | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm index 1775660162..c566e7260e 100644 --- a/gnu/packages/dns.scm +++ b/gnu/packages/dns.scm @@ -827,13 +827,21 @@ Extensions} (DNSSEC).") (delete-file-recursively "src/contrib/libbpf") #t)))) (build-system gnu-build-system) + (outputs (list "out" "doc" "lib" "tools")) (arguments `(#:configure-flags - (list "--sysconfdir=/etc" + (list (string-append "--docdir=" (assoc-ref %outputs "doc") + "/share/" ,name "-" ,version) + (string-append "--mandir=" (assoc-ref %outputs "doc") + "/share/man") + (string-append "--infodir=" (assoc-ref %outputs "doc") + "/share/info") + (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib") + "--sysconfdir=/etc" "--localstatedir=/var" - "--enable-dnstap" ; let tools read/write capture files - "--enable-fastparser" ; disabled by default when .git/ exists - "--enable-xdp=auto" ; XXX [=yes] currently means =embedded + "--enable-dnstap" ; let tools read/write capture files + "--enable-fastparser" ; disabled by default when .git/ exists + "--enable-xdp=auto" ; XXX [=yes] currently means =embedded "--with-module-dnstap=yes") ; detailed query capturing & logging #:phases (modify-phases %standard-phases @@ -868,7 +876,27 @@ Extensions} (DNSSEC).") "install")))) (add-after 'install 'install-info (lambda _ - (invoke "make" "install-info")))))) + (invoke "make" "install-info"))) + (add-after 'install 'break-circular-:lib->:out-reference + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (assoc-ref outputs "lib"))) + (for-each (lambda (file) + (substitute* file + (("(prefix=).*" _ assign) + (string-append assign lib "\n")))) + (find-files lib "\\.pc$")) + #t))) + (add-after 'install 'split-:tools + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (tools (assoc-ref outputs "tools"))) + (for-each (lambda (command) + (mkdir-p (string-append tools (dirname command))) + (rename-file (string-append out command) + (string-append tools command))) + (list "/bin/kdig" + "/bin/khost")) + #t)))))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) -- 2.28.0