[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/19: gnu: ld-wrapper: Add support for quoted arguments in response fil
From: |
guix-commits |
Subject: |
17/19: gnu: ld-wrapper: Add support for quoted arguments in response files. |
Date: |
Thu, 5 Mar 2020 18:10:21 -0500 (EST) |
mbakke pushed a commit to branch core-updates
in repository guix.
commit feb8c5dac30294d72205ee21b3afcf1cf7a04675
Author: Marius Bakke <address@hidden>
AuthorDate: Thu Mar 5 18:09:29 2020 +0100
gnu: ld-wrapper: Add support for quoted arguments in response files.
* gnu/packages/ld-wrapper.in (expand-arguments): Add TOKENIZE procedure, and
use that to parse the response file.
---
gnu/packages/ld-wrapper.in | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/gnu/packages/ld-wrapper.in b/gnu/packages/ld-wrapper.in
index 16780c5..2b68b87 100644
--- a/gnu/packages/ld-wrapper.in
+++ b/gnu/packages/ld-wrapper.in
@@ -16,6 +16,7 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main
(cdr (command-line))
!#
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès
<address@hidden>
+;;; Copyright © 2020 Marius Bakke <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -35,7 +36,7 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main
(cdr (command-line))
(define-module (gnu build-support ld-wrapper)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
- #:autoload (ice-9 rdelim) (read-string)
+ #:autoload (ice-9 rdelim) (read-delimited)
#:export (ld-wrapper))
;;; Commentary:
@@ -239,13 +240,27 @@ library outside of ~a: ~s~%"
;; Expand ARGS such that "response file" arguments, such as "@args.txt", are
;; expanded (info "(gcc) Overall Options").
(define (response-file-arguments file)
+ (define (tokenize port)
+ ;; Return a list of all strings found in PORT. Quote characters are
+ ;; removed, but whitespaces within quoted strings are preserved.
+ (let loop ((tokens '()))
+ (let* ((token+delimiter (read-delimited " '\"\n" port 'split))
+ (token (car token+delimiter))
+ (delim (cdr token+delimiter)))
+ (if (eof-object? token)
+ (reverse tokens)
+ (case delim
+ ((#\") (loop (cons (read-delimited "\"" port) tokens)))
+ ((#\') (loop (cons (read-delimited "'" port) tokens)))
+ (else (if (> (string-length token) 0)
+ (loop (cons token tokens))
+ (loop tokens))))))))
+
(when %debug?
(format (current-error-port)
"ld-wrapper: attempting to read arguments from '~a'~%" file))
- ;; FIXME: Options can contain whitespace if they are protected by single
- ;; or double quotes; this is not implemented here.
- (string-tokenize (call-with-input-file file read-string)))
+ (call-with-input-file file tokenize))
(define result
(fold-right (lambda (arg result)
- 10/19: gnu: cURL: Update to 7.69.0., (continued)
- 10/19: gnu: cURL: Update to 7.69.0., guix-commits, 2020/03/05
- 05/19: gnu: clang-runtime: Fix build with glibc 2.31., guix-commits, 2020/03/05
- 13/19: gnu: texlive-bin: Fix build with Poppler 0.86., guix-commits, 2020/03/05
- 14/19: gnu: coreutils: Update to 8.32., guix-commits, 2020/03/05
- 04/19: gnu: clang-runtime: Adjust for CPLUS_INCLUDE_PATH changes., guix-commits, 2020/03/05
- 09/19: gnu: fribidi: Update to 1.0.9., guix-commits, 2020/03/05
- 11/19: gnu: OpenBLAS: Update to 0.3.9., guix-commits, 2020/03/05
- 12/19: gnu: Poppler: Update to 0.86.1., guix-commits, 2020/03/05
- 15/19: gnu: bzip2: Do not retain a reference to the bootstrap bzip., guix-commits, 2020/03/05
- 16/19: gnu: ed: Update to 1.16., guix-commits, 2020/03/05
- 17/19: gnu: ld-wrapper: Add support for quoted arguments in response files.,
guix-commits <=
- 19/19: gnu: CMake: Update to 3.16.5., guix-commits, 2020/03/05
- 18/19: gnu: Remove ld-wrapper-next., guix-commits, 2020/03/05