summary refs log tree commit diff
path: root/build-aux
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-12-07 18:26:11 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-12-07 18:26:11 +0100
commit9e111db4535b3cd5729e37294ae51d95240334b4 (patch)
treecc90a9de80ff39bd93426b763918d904abfeeb56 /build-aux
parent92b61d3e1bb50f0c1d087bc8d57cc00c3ce360df (diff)
parentcf69135d5e6797e566b8bb18419ae9e3c8aeb621 (diff)
downloadguix-9e111db4535b3cd5729e37294ae51d95240334b4.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/build-self.scm21
1 files changed, 19 insertions, 2 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index ed8ff5f4ce..6415978839 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -120,13 +120,30 @@ person's version identifier."
   ;; XXX: Replace with a Git commit id.
   (date->string (current-date 0) "~Y~m~d.~H"))
 
+(define (matching-guile-2.2)
+  "Return a Guile 2.2 with the same version as the current one or immediately
+older than then current one.  This is so that we do not build ABI-incompatible
+objects.  See <https://bugs.gnu.org/29570>."
+  (let loop ((packages (find-packages-by-name "guile" "2.2"))
+             (best     #f))
+    (match packages
+      (()
+       best)
+      ((head tail ...)
+       (if (string=? (package-version head) (version))
+           head
+           (if best
+               (if (version>? (package-version head) (version))
+                   (loop tail best)
+                   (loop tail head))
+               (loop tail head)))))))
+
 (define (guile-for-build)
   "Return a derivation for Guile 2.0 or 2.2, whichever matches the currently
 running Guile."
   (package->derivation (cond-expand
                          (guile-2.2
-                          (canonical-package
-                           (specification->package "guile@2.2")))
+                          (canonical-package (matching-guile-2.2)))
                          (else
                           (canonical-package
                            (specification->package "guile@2.0"))))))