1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
3 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (guix build-system copy)
21 #:use-module (guix store)
22 #:use-module (guix utils)
23 #:use-module (guix derivations)
24 #:use-module (guix search-paths)
25 #:use-module (guix build-system)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix packages)
28 #:use-module (ice-9 match)
29 #:use-module (srfi srfi-1)
30 #:export (%copy-build-system-modules
38 ;; Standard build procedure for simple packages that don't require much
39 ;; compilation, mostly just copying files around. This is implemented as an
40 ;; extension of `gnu-build-system'.
44 (define %copy-build-system-modules
45 ;; Build-side modules imported by default.
46 `((guix build copy-build-system)
47 ,@%gnu-build-system-modules))
49 (define (default-glibc)
50 "Return the default glibc package."
51 ;; Do not use `@' to avoid introducing circular dependencies.
52 (let ((module (resolve-interface '(gnu packages base))))
53 (module-ref module 'glibc)))
56 #:key source inputs native-inputs outputs system target
57 (glibc (default-glibc))
60 "Return a bag for NAME from the given arguments."
61 (define private-keywords
62 '(#:source #:target #:inputs #:native-inputs))
67 (host-inputs `(,@(if source
71 ;; Keep the standard inputs of 'gnu-build-system'.
72 ,@(standard-packages)))
73 (build-inputs native-inputs)
76 (arguments (strip-keyword-arguments private-keywords arguments))))
78 (define* (copy-build store name inputs
81 (install-plan ''(("." "./")))
84 (validate-runpath? #t)
87 (strip-flags ''("--strip-debug"))
88 (strip-directories ''("lib" "lib64" "libexec"
90 (phases '(@ (guix build copy-build-system)
92 (system (%current-system))
93 (imported-modules %copy-build-system-modules)
94 (modules '((guix build copy-build-system)
96 "Build SOURCE using INSTALL-PLAN, and with INPUTS."
99 (use-modules ,@modules)
100 (copy-build #:source ,(match (assoc-ref inputs "source")
101 (((? derivation? source))
102 (derivation->output-path source))
109 #:inputs %build-inputs
110 #:install-plan ,install-plan
111 #:search-paths ',(map search-path-specification->sexp
114 #:out-of-source? ,out-of-source?
115 #:validate-runpath? ,validate-runpath?
116 #:patch-shebangs? ,patch-shebangs?
117 #:strip-binaries? ,strip-binaries?
118 #:strip-flags ,strip-flags
119 #:strip-directories ,strip-directories)))
121 (define guile-for-build
124 (package-derivation store guile system #:graft? #f))
126 (let* ((distro (resolve-interface '(gnu packages commencement)))
127 (guile (module-ref distro 'guile-final)))
128 (package-derivation store guile system #:graft? #f)))))
130 (build-expression->derivation store name builder
133 #:modules imported-modules
135 #:guile-for-build guile-for-build))
137 (define copy-build-system
140 (description "The standard copy build system")
143 ;;; copy.scm ends here