build-system/gnu: Add dependency on GNU Findutils.
[guix.git] / guix / build-system / gnu.scm
blobe12acf20fbf629bd8f6f5a583e9dda29ef905e11
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/>.
19 (define-module (guix build-system gnu)
20   #:use-module (guix store)
21   #:use-module (guix utils)
22   #:use-module (guix derivations)
23   #:use-module (guix build-system)
24   #:use-module (srfi srfi-1)
25   #:export (gnu-build
26             gnu-build-system))
28 ;; Commentary:
30 ;; Standard build procedure for packages using the GNU Build System or
31 ;; something compatible ("./configure && make && make install").
33 ;; Code:
35 (define %standard-inputs
36   (compile-time-value
37    (map (lambda (name)
38           (list name (nixpkgs-derivation name)))
39         '("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
40           "coreutils" "gnused" "gnugrep" "bash"
41           "findutils"                             ; used by `libtool'
42           "gawk"                                  ; used by `config.status'
43           "gcc" "binutils" "gnumake" "glibc"))))
45 (define* (gnu-build store name source inputs
46                     #:key (outputs '("out")) (configure-flags ''())
47                     (make-flags ''())
48                     (patches ''()) (patch-flags ''("--batch" "-p1"))
49                     (tests? #t)
50                     (parallel-build? #t) (parallel-tests? #t)
51                     (phases '%standard-phases)
52                     (system (%current-system))
53                     (modules '((guix build gnu-build-system)
54                                (guix build utils))))
55   "Return a derivation called NAME that builds from tarball SOURCE, with
56 input derivation INPUTS, using the usual procedure of the GNU Build System."
57   (define builder
58     `(begin
59        (use-modules ,@modules)
60        (gnu-build #:source ,(if (derivation-path? source)
61                                 (derivation-path->output-path source)
62                                 source)
63                   #:outputs %outputs
64                   #:inputs %build-inputs
65                   #:patches ,patches
66                   #:patch-flags ,patch-flags
67                   #:phases ,phases
68                   #:configure-flags ,configure-flags
69                   #:make-flags ,make-flags
70                   #:tests? ,tests?
71                   #:parallel-build? ,parallel-build?
72                   #:parallel-tests? ,parallel-tests?)))
74   (build-expression->derivation store name system
75                                 builder
76                                 `(("source" ,source)
77                                   ,@inputs
78                                   ,@%standard-inputs)
79                                 #:outputs outputs
80                                 #:modules modules))
82 (define gnu-build-system
83   (build-system (name 'gnu)
84                 (description
85                  "The GNU Build System—i.e., ./configure && make && make install")
86                 (build gnu-build)))             ; TODO: add `gnu-cross-build'