From d4294c0088d49ae5821cc580b77a3129d9459eba Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 20 Jul 2017 08:16:54 +0200 Subject: [PATCH] build: support Guix. * guile/guix/make.scm (link-or-cp): New function. (assert-link, store): Use it. --- guile/guix/make.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/guile/guix/make.scm b/guile/guix/make.scm index 9c5746f9..55fc88a6 100644 --- a/guile/guix/make.scm +++ b/guile/guix/make.scm @@ -210,8 +210,13 @@ (string-append %store-dir "/" (if (string? o) o (target-hash o)))) +(define (link-or-cp existing-file new-file) + (catch #t + (lambda _ (link existing-file new-file)) + (lambda _ (copy-file existing-file new-file)))) + (define (assert-link existing-file new-file) - (if (not (file-exists? new-file)) (link existing-file new-file))) + (if (not (file-exists? new-file)) (link-or-cp existing-file new-file))) (define store (let ((*store* '())) @@ -244,7 +249,7 @@ (file-name (target-file-name get))) (and (file-exists? store-file) (if (file-exists? file-name) (delete-file file-name)) - (link store-file file-name) + (link-or-cp store-file file-name) (store #:add get #:key key))))) (get (assoc-ref *store* get)) (delete (and (assoc-ref *store* delete)