build-system/gnu: Add `static-package'.

* distro/packages/make-bootstrap.scm (static-package): Move to...
* guix/build-system/gnu.scm (static-package): ... here.  New procedure.
This commit is contained in:
Ludovic Courtès 2013-01-01 16:55:34 +01:00
parent 450fb5a6b4
commit 4d058c6792
2 changed files with 26 additions and 25 deletions

View File

@ -20,7 +20,7 @@
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix build-system trivial)
#:use-module ((guix build-system gnu) #:select (package-with-explicit-inputs))
#:use-module (guix build-system gnu)
#:use-module ((distro) #:select (search-patch))
#:use-module (distro packages base)
#:use-module (distro packages bash)
@ -45,29 +45,6 @@
;;;
;;; Code:
(define* (static-package p #:optional (loc (current-source-location)))
"Return a statically-linked version of package P."
;; TODO: Move to (guix build-system gnu).
(let ((args (package-arguments p)))
(package (inherit p)
(location (source-properties->location loc))
(arguments
(let ((augment (lambda (args)
(let ((a (default-keyword-arguments args
'(#:configure-flags '()
#:strip-flags #f))))
(substitute-keyword-arguments a
((#:configure-flags flags)
`(cons* "--disable-shared"
"LDFLAGS=-static"
,flags))
((#:strip-flags _)
''("--strip-all")))))))
(if (procedure? args)
(lambda x
(augment (apply args x)))
(augment args)))))))
(define %glibc-with-relocatable-system
;; A libc whose `system' and `popen' functions looks for `sh' in $PATH.
(package (inherit glibc-final)

View File

@ -21,6 +21,7 @@
#:use-module (guix utils)
#:use-module (guix derivations)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-39)
@ -29,7 +30,8 @@
gnu-build-system
package-with-explicit-inputs
package-with-extra-configure-variable
static-libgcc-package))
static-libgcc-package
static-package))
;; Commentary:
;;
@ -117,6 +119,28 @@ configure flags for VARIABLE, the associated value is augmented."
"A version of P linked with `-static-gcc'."
(package-with-extra-configure-variable p "LDFLAGS" "-static-libgcc"))
(define* (static-package p #:optional (loc (current-source-location)))
"Return a statically-linked version of package P."
(let ((args (package-arguments p)))
(package (inherit p)
(location (source-properties->location loc))
(arguments
(let ((augment (lambda (args)
(let ((a (default-keyword-arguments args
'(#:configure-flags '()
#:strip-flags #f))))
(substitute-keyword-arguments a
((#:configure-flags flags)
`(cons* "--disable-shared"
"LDFLAGS=-static"
,flags))
((#:strip-flags _)
''("--strip-all")))))))
(if (procedure? args)
(lambda x
(augment (apply args x)))
(augment args)))))))
(define %store
;; Store passed to STANDARD-INPUTS.