aboutsummaryrefslogtreecommitdiff
path: root/build-aux/build-self.scm
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/build-self.scm')
-rw-r--r--build-aux/build-self.scm59
1 files changed, 55 insertions, 4 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index b78f3cb437..59028305e7 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,7 +19,9 @@
(define-module (build-self)
#:use-module (gnu)
#:use-module (guix)
+ #:use-module (guix config)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-19)
#:export (build))
;;; Commentary:
@@ -44,6 +46,18 @@
(define libgcrypt
(first (find-best-packages-by-name "libgcrypt" #f)))
+(define zlib
+ (first (find-best-packages-by-name "zlib" #f)))
+
+(define gzip
+ (first (find-best-packages-by-name "gzip" #f)))
+
+(define bzip2
+ (first (find-best-packages-by-name "bzip2" #f)))
+
+(define xz
+ (first (find-best-packages-by-name "xz" #f)))
+
(define guile-json
(first (find-best-packages-by-name "guile-json" #f)))
@@ -57,12 +71,33 @@
(lambda (file)
(string-append (dirname file) "/.."))))
+
+(define (date-version-string)
+ "Return the current date and hour in UTC timezone, for use as a poor
+person's version identifier."
+ ;; XXX: Replace with a Git commit id.
+ (date->string (current-date 0) "~Y~m~d.~H"))
+
;; The procedure below is our return value.
-(define* (build source #:key verbose?
+(define* (build source
+ #:key verbose? (version (date-version-string))
#:allow-other-keys
#:rest rest)
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
files."
+ ;; The '%xxxdir' variables were added to (guix config) in July 2016 so we
+ ;; cannot assume that they are defined. Try to guess their value when
+ ;; they're undefined (XXX: we get an incorrect guess when environment
+ ;; variables such as 'NIX_STATE_DIR' are defined!).
+ (define storedir
+ (if (defined? '%storedir) %storedir %store-directory))
+ (define localstatedir
+ (if (defined? '%localstatedir) %localstatedir (dirname %state-directory)))
+ (define sysconfdir
+ (if (defined? '%sysconfdir) %sysconfdir (dirname %config-directory)))
+ (define sbindir
+ (if (defined? '%sbindir) %sbindir (dirname %guix-register-program)))
+
(define builder
#~(begin
(use-modules (guix build pull))
@@ -73,12 +108,28 @@ files."
(build-guix #$output #$source
+ #:system #$%system
+ #:storedir #$storedir
+ #:localstatedir #$localstatedir
+ #:sysconfdir #$sysconfdir
+ #:sbindir #$sbindir
+
+ #:package-name #$%guix-package-name
+ #:package-version #$version
+ #:bug-report-address #$%guix-bug-report-address
+ #:home-page-url #$%guix-home-page-url
+
+ #:libgcrypt #$libgcrypt
+ #:zlib #$zlib
+ #:gzip #$gzip
+ #:bzip2 #$bzip2
+ #:xz #$xz
+
;; XXX: This is not perfect, enabling VERBOSE? means
;; building a different derivation.
#:debug-port (if #$verbose?
(current-error-port)
- (%make-void-port "w"))
- #:gcrypt #$libgcrypt)))
+ (%make-void-port "w")))))
(gexp->derivation "guix-latest" builder
#:modules '((guix build pull)