From 2b73e50c31a61b5dcef35a1e4b9484d9dbcb0fbc Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 5 Oct 2020 17:22:30 +0200 Subject: gnu: knot: Build the zone parsers from Ragel source. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/dns.scm (knot)[source]: Add snippet to remove upstream's pregenerated ‘sources’ [arguments]: Add an ‘update-parser’ phase. [native-inputs]: Add ragel and upstream update-parser.sh. --- gnu/packages/dns.scm | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm index 95524fa898..1a6c51f654 100644 --- a/gnu/packages/dns.scm +++ b/gnu/packages/dns.scm @@ -65,6 +65,7 @@ #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages ragel) #:use-module (gnu packages shells) #:use-module (gnu packages sphinx) #:use-module (gnu packages swig) @@ -803,14 +804,20 @@ Extensions} (DNSSEC).") (define-public knot (package (name "knot") - (version "3.0.0") + (version "3.0.0") ; also update update-parser.sh below (source (origin (method url-fetch) (uri (string-append "https://secure.nic.cz/files/knot-dns/" "knot-" version ".tar.xz")) (sha256 - (base32 "1i76zflc49jbsaj3idxx7a6x87c0lzal294c3fdjyfl7dvznmjgi")))) + (base32 "1i76zflc49jbsaj3idxx7a6x87c0lzal294c3fdjyfl7dvznmjgi")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Remove Ragel-generated C files. We'll recreate them below. + (for-each delete-file (find-files "." "\\.c\\.[gt].")) + #t)))) (build-system gnu-build-system) (arguments `(#:configure-flags @@ -823,6 +830,10 @@ Extensions} (DNSSEC).") "/etc/bash_completion.d")) #:phases (modify-phases %standard-phases + (add-after 'unpack 'update-parser + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "src" + (invoke "sh" "-x" (assoc-ref inputs "update-parser.sh"))))) (add-before 'configure 'disable-directory-pre-creation (lambda _ ;; Don't install empty directories like ‘/etc’ outside the store. @@ -838,7 +849,17 @@ Extensions} (DNSSEC).") (string-append "config_dir=" etc) "install"))))))) (native-inputs - `(("pkg-config" ,pkg-config))) + `(("pkg-config" ,pkg-config) + ("ragel" ,ragel) + ;; The release tarball doesn't include scripts/update-parser.sh. + ("update-parser.sh" + ,(origin + (method url-fetch) + (uri (string-append "https://gitlab.nic.cz/knot/knot-dns/-/raw/v" + version "/scripts/update-parser.sh")) + (file-name (string-append name "-" version "-update-parser.sh")) + (sha256 + (base32 "1a0s71lbnklpzkh97gm4g4lnxgg60zdf0hr8qr0732kqgsva1sjl")))))) (inputs `(("fstrm" ,fstrm) ("gnutls" ,gnutls) -- cgit v1.2.3