gnu: ld-wrapper: Ignore the .so argument following '-dynamic-linker'.

Reported at <http://bugs.gnu.org/20102>.

* gnu/packages/ld-wrapper.in (library-files-linked): Rename 'path+files'
  to 'path+files+args'.  Thread the reverse list of previous arguments.
  Add case for when the previous argument is "-dynamic-linker".
This commit is contained in:
Ludovic Courtès 2015-04-21 21:14:28 +02:00
parent 4267c637d6
commit 4a2b74bf4c

View file

@ -140,34 +140,45 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line))
(define (library-files-linked args) (define (library-files-linked args)
;; Return the file names of shared libraries explicitly linked against via ;; Return the file names of shared libraries explicitly linked against via
;; `-l' or with an absolute file name in ARGS. ;; `-l' or with an absolute file name in ARGS.
(define path+files (define path+files+args
(fold (lambda (argument result) (fold (lambda (argument result)
(match result (match result
((library-path . library-files) ((library-path library-files ("-dynamic-linker" . rest))
;; When passed '-dynamic-linker ld.so', ignore 'ld.so'.
;; See <http://bugs.gnu.org/20102>.
(list library-path
library-files
(cons* argument "-dynamic-linker" rest)))
((library-path library-files previous-args)
(cond ((string-prefix? "-L" argument) ;augment the search path (cond ((string-prefix? "-L" argument) ;augment the search path
(cons (append library-path (list (append library-path
(list (string-drop argument 2))) (list (string-drop argument 2)))
library-files)) library-files
(cons argument previous-args)))
((string-prefix? "-l" argument) ;add library ((string-prefix? "-l" argument) ;add library
(let* ((lib (string-append "lib" (let* ((lib (string-append "lib"
(string-drop argument 2) (string-drop argument 2)
".so")) ".so"))
(full (search-path library-path lib))) (full (search-path library-path lib)))
(list library-path
(if full (if full
(cons library-path (cons full library-files)
(cons full library-files)) library-files)
result))) (cons argument previous-args))))
((and (string-prefix? %store-directory argument) ((and (string-prefix? %store-directory argument)
(shared-library? argument)) ;add library (shared-library? argument)) ;add library
(cons library-path (list library-path
(cons argument library-files))) (cons argument library-files)
(cons argument previous-args)))
(else (else
result))))) (list library-path
(cons '() '()) library-files
(cons argument previous-args)))))))
(list '() '() '())
args)) args))
(match path+files (match path+files+args
((path . files) ((path files arguments)
(reverse files)))) (reverse files))))
(define (rpath-arguments library-files) (define (rpath-arguments library-files)