summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-20 16:12:26 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-20 16:12:26 +0200
commit17ff4ccdf51bb584cbc9139011393a4a028d6749 (patch)
treeff76e6c33301856a149050aad12a7063ce62f670
parent5cbb559046671c824b090f9540bdf29e26c7c6d9 (diff)
downloadpatches-17ff4ccdf51bb584cbc9139011393a4a028d6749.tar
patches-17ff4ccdf51bb584cbc9139011393a4a028d6749.tar.gz
distro: Add tools to build a tarball of statically-linked Binutils programs.
* distro/packages/base.scm (%binutils-static, %binutils-static-stripped, %binutils-bootstrap-tarball): New variables.
-rw-r--r--distro/packages/base.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 2f4bbecbb8..29ef2748fd 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -2091,6 +2091,53 @@ store.")
(license #f)
(home-page #f)))
+(define %binutils-static
+ ;; Statically-linked Binutils.
+ (package (inherit binutils)
+ (name "binutils-static")
+ (arguments
+ `(#:configure-flags '("--disable-gold")
+ #:strip-flags '("--strip-all")
+ #:phases (alist-cons-before
+ 'configure 'all-static
+ (lambda _
+ ;; The `-all-static' libtool flag can only be passed
+ ;; after `configure', since configure tests don't use
+ ;; libtool, and only for executables built with libtool.
+ (substitute* ("binutils/Makefile.in"
+ "gas/Makefile.in"
+ "ld/Makefile.in")
+ (("^LDFLAGS =(.*)$" line)
+ (string-append line
+ "\nAM_LDFLAGS = -static -all-static\n"))))
+ %standard-phases)))))
+
+(define %binutils-static-stripped
+ ;; The subset of Binutils that we need.
+ (package (inherit %binutils-static)
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+
+ (setvbuf (current-output-port) _IOLBF)
+ (let* ((in (assoc-ref %build-inputs "binutils"))
+ (out (assoc-ref %outputs "out"))
+ (bin (string-append out "/bin")))
+ (mkdir-p bin)
+ (for-each (lambda (file)
+ (let ((target (string-append bin "/" file)))
+ (format #t "copying `~a'...~%" file)
+ (copy-file (string-append in "/bin/" file)
+ target)
+ (remove-store-references target)))
+ '("ar" "as" "ld" "nm" "objcopy" "objdump"
+ "ranlib" "readelf" "size" "strings" "strip"))
+ #t))))
+ (inputs `(("binutils" ,%binutils-static)))))
+
(define %guile-static
;; A statically-linked Guile that is relocatable--i.e., it can search
;; .scm and .go files relative to its installation directory, rather
@@ -2197,6 +2244,10 @@ store.")
;; A tarball with the statically-linked bootstrap binaries.
(tarball-package %static-binaries))
+(define %binutils-bootstrap-tarball
+ ;; A tarball with the statically-linked Binutils programs.
+ (tarball-package %binutils-static-stripped))
+
(define %guile-bootstrap-tarball
;; A tarball with the statically-linked, relocatable Guile.
(tarball-package %guile-static-stripped))