mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
gnu: Add 'make-ld-wrapper' procedure.
* gnu/packages/base.scm (make-ld-wrapper): New procedure. Abstracted from... * gnu/packages/commencement.scm (ld-wrapper-boot3): ... here. Use it.
This commit is contained in:
parent
9c4b6e5484
commit
8fdd410160
2 changed files with 60 additions and 48 deletions
|
@ -358,6 +358,62 @@ (define-public binutils
|
||||||
(license gpl3+)
|
(license gpl3+)
|
||||||
(home-page "http://www.gnu.org/software/binutils/")))
|
(home-page "http://www.gnu.org/software/binutils/")))
|
||||||
|
|
||||||
|
(define* (make-ld-wrapper name #:key binutils guile bash
|
||||||
|
(guile-for-build guile))
|
||||||
|
"Return a package called NAME that contains a wrapper for the 'ld' program
|
||||||
|
of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
|
||||||
|
wrapper uses GUILE and BASH."
|
||||||
|
(package
|
||||||
|
(name name)
|
||||||
|
(version "0")
|
||||||
|
(source #f)
|
||||||
|
(build-system trivial-build-system)
|
||||||
|
(inputs `(("binutils" ,binutils)
|
||||||
|
("guile" ,guile)
|
||||||
|
("bash" ,bash)
|
||||||
|
("wrapper" ,(search-path %load-path
|
||||||
|
"gnu/packages/ld-wrapper.scm"))))
|
||||||
|
(arguments
|
||||||
|
`(#:guile ,guile-for-build
|
||||||
|
#:modules ((guix build utils))
|
||||||
|
#:builder (begin
|
||||||
|
(use-modules (guix build utils)
|
||||||
|
(system base compile))
|
||||||
|
|
||||||
|
(let* ((out (assoc-ref %outputs "out"))
|
||||||
|
(bin (string-append out "/bin"))
|
||||||
|
(ld (string-append bin "/ld"))
|
||||||
|
(go (string-append bin "/ld.go")))
|
||||||
|
|
||||||
|
(setvbuf (current-output-port) _IOLBF)
|
||||||
|
(format #t "building ~s/bin/ld wrapper in ~s~%"
|
||||||
|
(assoc-ref %build-inputs "binutils")
|
||||||
|
out)
|
||||||
|
|
||||||
|
(mkdir-p bin)
|
||||||
|
(copy-file (assoc-ref %build-inputs "wrapper") ld)
|
||||||
|
(substitute* ld
|
||||||
|
(("@GUILE@")
|
||||||
|
(string-append (assoc-ref %build-inputs "guile")
|
||||||
|
"/bin/guile"))
|
||||||
|
(("@BASH@")
|
||||||
|
(string-append (assoc-ref %build-inputs "bash")
|
||||||
|
"/bin/bash"))
|
||||||
|
(("@LD@")
|
||||||
|
(string-append (assoc-ref %build-inputs "binutils")
|
||||||
|
"/bin/ld")))
|
||||||
|
(chmod ld #o555)
|
||||||
|
(compile-file ld #:output-file go)))))
|
||||||
|
(synopsis "The linker wrapper")
|
||||||
|
(description
|
||||||
|
"The linker wrapper (or 'ld-wrapper') wraps the linker to add any
|
||||||
|
missing '-rpath' flags, and to detect any misuse of libraries outside of the
|
||||||
|
store.")
|
||||||
|
(home-page "http://www.gnu.org/software/guix/")
|
||||||
|
(license gpl3+)))
|
||||||
|
|
||||||
|
(export make-ld-wrapper)
|
||||||
|
|
||||||
(define-public glibc
|
(define-public glibc
|
||||||
(package
|
(package
|
||||||
(name "glibc")
|
(name "glibc")
|
||||||
|
|
|
@ -545,54 +545,10 @@ (define-public gcc-final
|
||||||
|
|
||||||
(define ld-wrapper-boot3
|
(define ld-wrapper-boot3
|
||||||
;; A linker wrapper that uses the bootstrap Guile.
|
;; A linker wrapper that uses the bootstrap Guile.
|
||||||
(package
|
(make-ld-wrapper "ld-wrapper-boot3"
|
||||||
(name "ld-wrapper-boot3")
|
#:binutils binutils-final
|
||||||
(version "0")
|
#:guile %bootstrap-guile
|
||||||
(source #f)
|
#:bash (car (assoc-ref %boot2-inputs "bash"))))
|
||||||
(build-system trivial-build-system)
|
|
||||||
(inputs `(("binutils" ,binutils-final)
|
|
||||||
("guile" ,%bootstrap-guile)
|
|
||||||
("bash" ,@(assoc-ref %boot2-inputs "bash"))
|
|
||||||
("wrapper" ,(search-path %load-path
|
|
||||||
"gnu/packages/ld-wrapper.scm"))))
|
|
||||||
(arguments
|
|
||||||
`(#:guile ,%bootstrap-guile
|
|
||||||
#:modules ((guix build utils))
|
|
||||||
#:builder (begin
|
|
||||||
(use-modules (guix build utils)
|
|
||||||
(system base compile))
|
|
||||||
|
|
||||||
(let* ((out (assoc-ref %outputs "out"))
|
|
||||||
(bin (string-append out "/bin"))
|
|
||||||
(ld (string-append bin "/ld"))
|
|
||||||
(go (string-append bin "/ld.go")))
|
|
||||||
|
|
||||||
(setvbuf (current-output-port) _IOLBF)
|
|
||||||
(format #t "building ~s/bin/ld wrapper in ~s~%"
|
|
||||||
(assoc-ref %build-inputs "binutils")
|
|
||||||
out)
|
|
||||||
|
|
||||||
(mkdir-p bin)
|
|
||||||
(copy-file (assoc-ref %build-inputs "wrapper") ld)
|
|
||||||
(substitute* ld
|
|
||||||
(("@GUILE@")
|
|
||||||
(string-append (assoc-ref %build-inputs "guile")
|
|
||||||
"/bin/guile"))
|
|
||||||
(("@BASH@")
|
|
||||||
(string-append (assoc-ref %build-inputs "bash")
|
|
||||||
"/bin/bash"))
|
|
||||||
(("@LD@")
|
|
||||||
(string-append (assoc-ref %build-inputs "binutils")
|
|
||||||
"/bin/ld")))
|
|
||||||
(chmod ld #o555)
|
|
||||||
(compile-file ld #:output-file go)))))
|
|
||||||
(synopsis "The linker wrapper")
|
|
||||||
(description
|
|
||||||
"The linker wrapper (or `ld-wrapper') wraps the linker to add any
|
|
||||||
missing `-rpath' flags, and to detect any misuse of libraries outside of the
|
|
||||||
store.")
|
|
||||||
(home-page #f)
|
|
||||||
(license gpl3+)))
|
|
||||||
|
|
||||||
(define %boot3-inputs
|
(define %boot3-inputs
|
||||||
;; 4th stage inputs.
|
;; 4th stage inputs.
|
||||||
|
|
Loading…
Reference in a new issue