Commit | Line | Data |
---|---|---|
c36db98c LC |
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 gnu-build-system) | |
20 | #:use-module (guix store) | |
21 | #:use-module (guix utils) | |
22 | #:use-module (guix derivations) | |
23 | #:use-module (srfi srfi-1) | |
24 | #:export (gnu-build)) | |
25 | ||
26 | ;; Commentary: | |
27 | ;; | |
28 | ;; Standard build procedure for packages using the GNU Build System or | |
29 | ;; something compatible ("./configure && make && make install"). | |
30 | ;; | |
31 | ;; Code: | |
32 | ||
33 | (define %standard-inputs | |
34 | (map (lambda (name) | |
2acb2cb6 | 35 | (list name (nixpkgs-derivation name))) |
3ab892ff | 36 | '("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch" |
c36db98c LC |
37 | "coreutils" "gnused" "gnugrep" "bash" |
38 | "gcc" "binutils" "gnumake" "glibc"))) | |
39 | ||
40 | (define* (gnu-build store name source inputs | |
41 | #:key (outputs '("out")) (configure-flags '()) | |
42 | (system (%current-system))) | |
43 | "Return a derivation called NAME that builds from tarball SOURCE, with | |
44 | input derivation INPUTS, using the usual procedure of the GNU Build System." | |
45 | (define builder | |
46 | `(begin | |
47 | (use-modules (guix build gnu-build-system)) | |
48 | (gnu-build ,(if (derivation-path? source) | |
49 | (derivation-path->output-path source) | |
50 | source) | |
51 | %outputs | |
52 | %build-inputs | |
53 | #:configure-flags ',configure-flags))) | |
54 | ||
55 | (build-expression->derivation store name system | |
56 | builder | |
2acb2cb6 LC |
57 | `(("source" ,source) |
58 | ,@inputs | |
59 | ,@%standard-inputs) | |
c36db98c LC |
60 | #:outputs outputs |
61 | #:modules '((guix build gnu-build-system) | |
62 | (guix build utils)))) |