summaryrefslogtreecommitdiff
path: root/nonguix/build
diff options
context:
space:
mode:
authorAlex Griffin <a@ajgrf.com>2020-01-08 15:21:44 -0600
committerAlex Griffin <a@ajgrf.com>2020-01-08 15:22:32 -0600
commitcb9d65923e0b7ccdecf173b73a43b77a7c3b020a (patch)
treea69358ec0df1c1ac5328e68c254683109507a3fc /nonguix/build
parent663c4c3e6c57d6d15dc701c47876da2e48aed749 (diff)
utils: Add 'concatenate-files' function.
* nonguix/build/utils.scm (concatenate-files): New function.
Diffstat (limited to 'nonguix/build')
-rw-r--r--nonguix/build/utils.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/nonguix/build/utils.scm b/nonguix/build/utils.scm
index b520769..a5442ea 100644
--- a/nonguix/build/utils.scm
+++ b/nonguix/build/utils.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
;;;
;;; This file is not part of GNU Guix.
;;;
@@ -20,9 +21,11 @@
#:use-module (ice-9 match)
#:use-module (ice-9 binary-ports)
#:use-module (guix build utils)
+ #:use-module (srfi srfi-26)
#:export (64-bit?
make-desktop-entry-file
- make-wrapper))
+ make-wrapper
+ concatenate-files))
(define (64-bit? file)
"Return true if ELF file is in 64-bit format, false otherwise.
@@ -183,3 +186,15 @@ contents:
(dirname real-file)
(canonicalize-path real-file))))
(chmod wrapper #o755))
+
+(define (concatenate-files files result)
+ "Make RESULT the concatenation of all of FILES."
+ (define (dump file port)
+ (put-bytevector
+ port
+ (call-with-input-file file
+ get-bytevector-all)))
+
+ (call-with-output-file result
+ (lambda (port)
+ (for-each (cut dump <> port) files))))