summary refs log tree commit diff
path: root/gnu/packages/dns.scm
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2020-10-05 17:22:30 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2020-10-05 17:24:14 +0200
commit2b73e50c31a61b5dcef35a1e4b9484d9dbcb0fbc (patch)
tree0bd1c922fc6b35dcdbcf2327f7ad215d8a335846 /gnu/packages/dns.scm
parent3d09e02582f5f8ab31f487d6892895848d994bfa (diff)
downloadguix-2b73e50c31a61b5dcef35a1e4b9484d9dbcb0fbc.tar.gz
gnu: knot: Build the zone parsers from Ragel source.
* 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.
Diffstat (limited to 'gnu/packages/dns.scm')
-rw-r--r--gnu/packages/dns.scm27
1 files 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)