summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-03 21:07:52 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-03 21:11:28 +0100
commit00e219d1c98e55dd1b6c6af00ae73c23ed52583e (patch)
tree28565d9ddd0ed72f7d35b0500b61745e3e7412d2
parente76bdf8b87920b87a2a2e728c2e40ff24ca39ffe (diff)
build: Produce (guix config) instead of using compile-time tricks.
* guix/config.scm.in: New file. * guix/utils.scm: Use it. (%libgcrypt): Remove. (%nixpkgs-directory): Don't capture the compile-time $NIXPKGS; use %NIXPKGS instead. (nixpkgs-derivation): Use %NIX-INSTANTIATE. * pre-inst-env.in (NIX_INSTANTIATE, NIXPKGS, LIBGCRYPT): Remove. * configure.ac: Emit `guix/config.scm'. * Makefile.am (GOBJECTS): Add `guix/config.go'. (nobase_nodist_guilemodule_DATA): Add `guix/config.scm'.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac1
-rw-r--r--guix/config.scm.in53
-rw-r--r--guix/utils.scm10
-rw-r--r--pre-inst-env.in5
6 files changed, 61 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index e6b254ae44e..eb4238f0b0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,4 @@ config.cache
48/guix-download 48/guix-download
49/distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz 49/distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz
50/guix-package 50/guix-package
51/guix/config.scm
diff --git a/Makefile.am b/Makefile.am
index 0621cb8c001..b06f575e6c5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@ MODULES = \
46 distro/packages/ld-wrapper.scm \ 46 distro/packages/ld-wrapper.scm \
47 distro/packages/typesetting.scm 47 distro/packages/typesetting.scm
48 48
49GOBJECTS = $(MODULES:%.scm=%.go) 49GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go
50 50
51nobase_dist_guilemodule_DATA = $(MODULES) 51nobase_dist_guilemodule_DATA = $(MODULES)
52 52
@@ -112,7 +112,7 @@ distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz: guix/utils.go
112 $(MKDIR_P) `dirname "$@"` 112 $(MKDIR_P) `dirname "$@"`
113 $(DOWNLOAD_FILE) "$@" "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee" 113 $(DOWNLOAD_FILE) "$@" "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee"
114 114
115nobase_nodist_guilemodule_DATA = $(GOBJECTS) 115nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
116 116
117TESTS = \ 117TESTS = \
118 tests/builders.scm \ 118 tests/builders.scm \
diff --git a/configure.ac b/configure.ac
index 85bd20e2be4..6d3d1482b45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,7 @@ AC_SUBST([LIBGCRYPT])
79 79
80AC_CONFIG_FILES([Makefile 80AC_CONFIG_FILES([Makefile
81 po/Makefile.in 81 po/Makefile.in
82 guix/config.scm
82 guix-build 83 guix-build
83 guix-download 84 guix-download
84 guix-package 85 guix-package
diff --git a/guix/config.scm.in b/guix/config.scm.in
new file mode 100644
index 00000000000..462dcd0ed19
--- /dev/null
+++ b/guix/config.scm.in
@@ -0,0 +1,53 @@
1;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
2;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
3;;;
4;;; This file is part of Guix.
5;;;
6;;; Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (guix config)
20 #:export (%guix-package-name
21 %guix-version
22 %guix-bug-report-address
23 %libgcrypt
24 %nixpkgs
25 %nix-instantiate))
26
27;;; Commentary:
28;;;
29;;; Compile-time configuration of Guix.
30;;;
31;;; Code:
32
33(define %guix-package-name
34 "@PACKAGE_NAME@")
35
36(define %guix-version
37 "@PACKAGE_VERSION@")
38
39(define %guix-bug-report-address
40 "@PACKAGE_BUGREPORT@")
41
42(define %libgcrypt
43 "@LIBGCRYPT@")
44
45(define %nixpkgs
46 (if (string=? "@NIXPKGS@" "")
47 #f
48 "@NIXPKGS@"))
49
50(define %nix-instantiate
51 "@NIX_INSTANTIATE@")
52
53;;; config.scm ends here
diff --git a/guix/utils.scm b/guix/utils.scm
index 287a6d4f3aa..10b0c15fad0 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -17,6 +17,7 @@
17;;; along with Guix. If not, see <http://www.gnu.org/licenses/>. 17;;; along with Guix. If not, see <http://www.gnu.org/licenses/>.
18 18
19(define-module (guix utils) 19(define-module (guix utils)
20 #:use-module (guix config)
20 #:use-module (srfi srfi-1) 21 #:use-module (srfi srfi-1)
21 #:use-module (srfi srfi-9) 22 #:use-module (srfi srfi-9)
22 #:use-module (srfi srfi-26) 23 #:use-module (srfi srfi-26)
@@ -392,10 +393,6 @@ starting from the right of S."
392;;; Hash. 393;;; Hash.
393;;; 394;;;
394 395
395(define %libgcrypt
396 ;; Name of the libgcrypt shared library.
397 (compile-time-value (or (getenv "LIBGCRYPT") "libgcrypt")))
398
399(define sha256 396(define sha256
400 (cond 397 (cond
401 ((compile-time-value 398 ((compile-time-value
@@ -458,13 +455,12 @@ starting from the right of S."
458(define %nixpkgs-directory 455(define %nixpkgs-directory
459 (make-parameter 456 (make-parameter
460 ;; Capture the build-time value of $NIXPKGS. 457 ;; Capture the build-time value of $NIXPKGS.
461 (or (compile-time-value (getenv "NIXPKGS")) 458 (or %nixpkgs (getenv "NIXPKGS"))))
462 (getenv "NIXPKGS"))))
463 459
464(define* (nixpkgs-derivation attribute #:optional (system (%current-system))) 460(define* (nixpkgs-derivation attribute #:optional (system (%current-system)))
465 "Return the derivation path of ATTRIBUTE in Nixpkgs." 461 "Return the derivation path of ATTRIBUTE in Nixpkgs."
466 (let* ((p (open-pipe* OPEN_READ (or (getenv "NIX_INSTANTIATE") 462 (let* ((p (open-pipe* OPEN_READ (or (getenv "NIX_INSTANTIATE")
467 "nix-instantiate") 463 %nix-instantiate)
468 "-A" attribute (%nixpkgs-directory) 464 "-A" attribute (%nixpkgs-directory)
469 "--argstr" "system" system)) 465 "--argstr" "system" system))
470 (l (read-line p)) 466 (l (read-line p))
diff --git a/pre-inst-env.in b/pre-inst-env.in
index 2fb60e2edda..d90934c1842 100644
--- a/pre-inst-env.in
+++ b/pre-inst-env.in
@@ -41,10 +41,7 @@ export PATH
41# auto-compilation. 41# auto-compilation.
42 42
43NIX_HASH="@NIX_HASH@" 43NIX_HASH="@NIX_HASH@"
44NIX_INSTANTIATE="@NIX_INSTANTIATE@"
45NIXPKGS="@NIXPKGS@"
46LIBGCRYPT="@LIBGCRYPT@"
47 44
48export NIX_HASH NIX_INSTANTIATE NIXPKGS LIBGCRYPT 45export NIX_HASH
49 46
50exec "$@" 47exec "$@"