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 "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 ''())
48 (patches ''()) (patch-flags ''("--batch" "-p1"))
50 (parallel-build? #t) (parallel-tests? #t)
51 (phases '%standard-phases)
52 (system (%current-system))
53 (modules '((guix build gnu-build-system)
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."
59 (use-modules ,@modules)
60 (gnu-build #:source ,(if (derivation-path? source)
61 (derivation-path->output-path source)
64 #:inputs %build-inputs
66 #:patch-flags ,patch-flags
68 #:configure-flags ,configure-flags
69 #:make-flags ,make-flags
71 #:parallel-build? ,parallel-build?
72 #:parallel-tests? ,parallel-tests?)))
74 (build-expression->derivation store name system
82 (define gnu-build-system
83 (build-system (name 'gnu)
85 "The GNU Build System—i.e., ./configure && make && make install")
86 (build gnu-build))) ; TODO: add `gnu-cross-build'