1 ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
2 ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of Guix.
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.
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.
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)
30 ;; Standard build procedure for packages using the GNU Build System or
31 ;; something compatible ("./configure && make && make install").
35 (define %standard-inputs
38 (list name (nixpkgs-derivation name)))
39 '("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
40 "coreutils" "gnused" "gnugrep" "bash"
41 "gawk" ; used by `config.status'
42 "gcc" "binutils" "gnumake" "glibc"))))
44 (define* (gnu-build store name source inputs
45 #:key (outputs '("out")) (configure-flags ''())
47 (patches ''()) (patch-flags ''("--batch" "-p1"))
48 (parallel-build? #t) (parallel-tests? #t)
49 (phases '%standard-phases)
50 (system (%current-system))
51 (modules '((guix build gnu-build-system)
53 "Return a derivation called NAME that builds from tarball SOURCE, with
54 input derivation INPUTS, using the usual procedure of the GNU Build System."
57 (use-modules ,@modules)
58 (gnu-build #:source ,(if (derivation-path? source)
59 (derivation-path->output-path source)
62 #:inputs %build-inputs
64 #:patch-flags ,patch-flags
66 #:configure-flags ,configure-flags
67 #:make-flags ,make-flags
68 #:parallel-build? ,parallel-build?
69 #:parallel-tests? ,parallel-tests?)))
71 (build-expression->derivation store name system
79 (define gnu-build-system
80 (build-system (name 'gnu)
82 "The GNU Build System—i.e., ./configure && make && make install")
83 (build gnu-build))) ; TODO: add `gnu-cross-build'