diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2012-11-03 21:07:52 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2012-11-03 21:11:28 +0100 |
| commit | 00e219d1c98e55dd1b6c6af00ae73c23ed52583e (patch) | |
| tree | 28565d9ddd0ed72f7d35b0500b61745e3e7412d2 | |
| parent | e76bdf8b87920b87a2a2e728c2e40ff24ca39ffe (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-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile.am | 4 | ||||
| -rw-r--r-- | configure.ac | 1 | ||||
| -rw-r--r-- | guix/config.scm.in | 53 | ||||
| -rw-r--r-- | guix/utils.scm | 10 | ||||
| -rw-r--r-- | pre-inst-env.in | 5 |
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 | ||
| 49 | GOBJECTS = $(MODULES:%.scm=%.go) | 49 | GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go |
| 50 | 50 | ||
| 51 | nobase_dist_guilemodule_DATA = $(MODULES) | 51 | nobase_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 | ||
| 115 | nobase_nodist_guilemodule_DATA = $(GOBJECTS) | 115 | nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm |
| 116 | 116 | ||
| 117 | TESTS = \ | 117 | TESTS = \ |
| 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 | ||
| 80 | AC_CONFIG_FILES([Makefile | 80 | AC_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 | ||
| 43 | NIX_HASH="@NIX_HASH@" | 43 | NIX_HASH="@NIX_HASH@" |
| 44 | NIX_INSTANTIATE="@NIX_INSTANTIATE@" | ||
| 45 | NIXPKGS="@NIXPKGS@" | ||
| 46 | LIBGCRYPT="@LIBGCRYPT@" | ||
| 47 | 44 | ||
| 48 | export NIX_HASH NIX_INSTANTIATE NIXPKGS LIBGCRYPT | 45 | export NIX_HASH |
| 49 | 46 | ||
| 50 | exec "$@" | 47 | exec "$@" |
