From e6039b9c70c658d648723a2d331f1c9637b49126 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Nov 2014 12:32:32 +0100 Subject: utils: Export 'parallel-job-count'. * guix/build/utils.scm (parallel-job-count): New procedure. * guix/build/gnu-build-system.scm (%parallel-job-count): Remove. (build, check): Use 'parallel-job-count' instead. --- guix/build/gnu-build-system.scm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 17fa7afd8d..afed601798 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -236,18 +236,11 @@ makefiles." (string-append srcdir "/configure") flags)))) -(define %parallel-job-count - ;; String to be passed next to GNU Make's `-j' argument. - (match (getenv "NIX_BUILD_CORES") - (#f "1") - ("0" (number->string (current-processor-count))) - (x x))) - (define* (build #:key (make-flags '()) (parallel-build? #t) #:allow-other-keys) (zero? (apply system* "make" `(,@(if parallel-build? - `("-j" ,%parallel-job-count) + `("-j" ,(number->string (parallel-job-count))) '()) ,@make-flags)))) @@ -257,7 +250,7 @@ makefiles." (if tests? (zero? (apply system* "make" test-target `(,@(if parallel-tests? - `("-j" ,%parallel-job-count) + `("-j" ,(number->string (parallel-job-count))) '()) ,@make-flags))) (begin -- cgit v1.2.3 From 50b87bd54b7fd5fe5cb3482d7801d5e74d0c2fb3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Nov 2014 12:49:14 +0100 Subject: build-system/gnu: Strip only ELF files. Suggested by Mark H Weaver at . * guix/build/gnu-build-system.scm (strip)[strip-dir]: Strip only when (elf-file? PATH) is true. --- guix/build/gnu-build-system.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index afed601798..a8136063ef 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -343,7 +343,8 @@ makefiles." debug-output objcopy-command)) (file-system-fold (const #t) (lambda (path stat result) ; leaf - (and (or (not debug-output) + (and (elf-file? path) + (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command (append strip-flags (list path)))) -- cgit v1.2.3 From e8c7fdda5d62af08820794114e02a6f247fed2f7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Nov 2014 21:54:27 +0100 Subject: build-system/gnu: Strip 'ar' archives as well. * guix/build/gnu-build-system.scm (strip): Also strip when (ar-file? PATH) is true. --- guix/build/gnu-build-system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index a8136063ef..dbbb71af35 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -343,7 +343,7 @@ makefiles." debug-output objcopy-command)) (file-system-fold (const #t) (lambda (path stat result) ; leaf - (and (elf-file? path) + (and (or (elf-file? path) (ar-file? path)) (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command -- cgit v1.2.3 From f8bcf1935a18e9a728e824030b3ded4fb63638cf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 24 Nov 2014 22:45:41 +0100 Subject: build-system/gnu: Gracefully handle dangling symlinks in the 'strip' phase. * guix/build/gnu-build-system.scm (strip): Check whether 'file-exists?' before calling 'elf-file?' and 'ar-file?'. This should fix build failures in the presence of dangling symlinks, as in . --- guix/build/gnu-build-system.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index dbbb71af35..e42a6cc48b 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -343,7 +343,8 @@ makefiles." debug-output objcopy-command)) (file-system-fold (const #t) (lambda (path stat result) ; leaf - (and (or (elf-file? path) (ar-file? path)) + (and (file-exists? path) ;discard dangling symlinks + (or (elf-file? path) (ar-file? path)) (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command -- cgit v1.2.3 From d68fe741623d11d16c514cf8bddbb48a1e5258ae Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 1 Dec 2014 14:09:36 +0100 Subject: build-system/gnu: Add 'validate-documentation-location' phase. * guix/build/gnu-build-system.scm (validate-documentation-location): New procedure. (%standard-phases): Add it. --- guix/build/gnu-build-system.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index e42a6cc48b..9d97ceb5bb 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -372,6 +372,27 @@ makefiles." strip-directories))) outputs)))) +(define* (validate-documentation-location #:key outputs + #:allow-other-keys) + "Documentation should go to 'share/info' and 'share/man', not just 'info/' +and 'man/'. This phase moves directories to the right place if needed." + (define (validate-sub-directory output sub-directory) + (let ((directory (string-append output "/" sub-directory))) + (when (directory-exists? directory) + (let ((target (string-append output "/share/" sub-directory))) + (format #t "moving '~a' to '~a'~%" directory target) + (mkdir-p (dirname target)) + (rename-file directory target))))) + + (define (validate-output output) + (for-each (cut validate-sub-directory output <>) + '("man" "info"))) + + (match outputs + (((names . directories) ...) + (for-each validate-output directories))) + #t) + (define %standard-phases ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () @@ -380,7 +401,8 @@ makefiles." patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install - patch-shebangs strip))) + patch-shebangs strip + validate-documentation-location))) (define* (gnu-build #:key (source #f) (outputs #f) (inputs #f) -- cgit v1.2.3 From 7cc7dec139d4dbbeb93d7fe57740ae5f64200701 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 1 Dec 2014 15:46:26 +0100 Subject: build-system/gnu: Add 'compress-documentation' phase. * guix/build/gnu-build-system.scm (compress-documentation): New procedure. (%standard-phases): Add it. --- guix/build/gnu-build-system.scm | 62 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 9d97ceb5bb..d3de92b724 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -20,6 +20,7 @@ #:use-module (guix build utils) #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) #:use-module (ice-9 format) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -393,6 +394,64 @@ and 'man/'. This phase moves directories to the right place if needed." (for-each validate-output directories))) #t) +(define* (compress-documentation #:key outputs + (compress-documentation? #t) + (documentation-compressor "gzip") + (documentation-compressor-flags + '("--best" "--no-name")) + (compressed-documentation-extension ".gz") + #:allow-other-keys) + "When COMPRESS-DOCUMENTATION? is true, compress man pages and Info files +found in OUTPUTS using DOCUMENTATION-COMPRESSOR, called with +DOCUMENTATION-COMPRESSOR-FLAGS." + (define (retarget-symlink link) + (let ((target (readlink link))) + (delete-file link) + (symlink (string-append target compressed-documentation-extension) + link))) + + (define (has-links? file) + ;; Return #t if FILE has hard links. + (> (stat:nlink (lstat file)) 1)) + + (define (maybe-compress-directory directory regexp) + (or (not (directory-exists? directory)) + (match (find-files directory regexp) + (() ;nothing to compress + #t) + ((files ...) ;one or more files + (format #t + "compressing documentation in '~a' with ~s and flags ~s~%" + directory documentation-compressor + documentation-compressor-flags) + (call-with-values + (lambda () + (partition symbolic-link? files)) + (lambda (symlinks regular-files) + ;; Compress the non-symlink files, and adjust symlinks to refer + ;; to the compressed files. Leave files that have hard links + ;; unchanged ('gzip' would refuse to compress them anyway.) + (and (zero? (apply system* documentation-compressor + (append documentation-compressor-flags + (remove has-links? regular-files)))) + (every retarget-symlink + (filter (cut string-match regexp <>) + symlinks))))))))) + + (define (maybe-compress output) + (and (maybe-compress-directory (string-append output "/share/man") + "\\.[0-9]+$") + (maybe-compress-directory (string-append output "/share/info") + "\\.info(-[0-9]+)?$"))) + + (if compress-documentation? + (match outputs + (((names . directories) ...) + (every maybe-compress directories))) + (begin + (format #t "not compressing documentation~%") + #t))) + (define %standard-phases ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () @@ -402,7 +461,8 @@ and 'man/'. This phase moves directories to the right place if needed." patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip - validate-documentation-location))) + validate-documentation-location + compress-documentation))) (define* (gnu-build #:key (source #f) (outputs #f) (inputs #f) -- cgit v1.2.3 From 6aa47e388390e98bec6caa90fef7f39a60e338a7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Dec 2014 12:16:18 +0100 Subject: build-system/gnu: Add support for non-directory search paths. Partly fixes . * guix/build/utils.scm (search-path-as-list): Rename 'sub-directories' parameter to 'files'. Add #:type parameter and honor it. (set-path-environment-variable): Likewise. Pass #:type to 'search-path-as-list'. * guix/packages.scm (search-path-specification->sexp): Add 'directory as the last item of the tuple. * guix/build/gnu-build-system.scm (set-paths): Add 'type' to search-path pattern. Pass #:type to 'set-path-environment-variable'. --- guix/build/gnu-build-system.scm | 14 ++++++++------ guix/build/utils.scm | 33 +++++++++++++++++++-------------- guix/packages.scm | 3 ++- 3 files changed, 29 insertions(+), 21 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index d3de92b724..4cc755f3a6 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -73,19 +73,21 @@ input-directories))) (for-each (match-lambda - ((env-var (directories ...) separator) - (set-path-environment-variable env-var directories + ((env-var (files ...) separator type) + (set-path-environment-variable env-var files input-directories - #:separator separator))) + #:separator separator + #:type type))) search-paths) (when native-search-paths ;; Search paths for native inputs, when cross building. (for-each (match-lambda - ((env-var (directories ...) separator) - (set-path-environment-variable env-var directories + ((env-var (files ...) separator type) + (set-path-environment-variable env-var files native-input-directories - #:separator separator))) + #:separator separator + #:type type))) native-search-paths)) #t) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 9b1e098c6b..f22b2c3cb7 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -290,9 +290,10 @@ matches REGEXP." ;;; Search paths. ;;; -(define (search-path-as-list sub-directories input-dirs) - "Return the list of directories among SUB-DIRECTORIES that exist in -INPUT-DIRS. Example: +(define* (search-path-as-list files input-dirs + #:key (type 'directory)) + "Return the list of directories among FILES of the given TYPE (a symbol as +returned by 'stat:type') that exist in INPUT-DIRS. Example: (search-path-as-list '(\"share/emacs/site-lisp\" \"share/emacs/24.1\") (list \"/package1\" \"/package2\" \"/package3\")) @@ -301,12 +302,12 @@ INPUT-DIRS. Example: " (append-map (lambda (input) - (filter-map (lambda (dir) - (let ((dir (string-append input "/" - dir))) - (and (directory-exists? dir) - dir))) - sub-directories)) + (filter-map (lambda (file) + (let* ((file (string-append input "/" file)) + (stat (stat file #f))) + (and stat (eq? type (stat:type stat)) + file))) + files)) input-dirs)) (define (list->search-path-as-string lst separator) @@ -315,16 +316,20 @@ INPUT-DIRS. Example: (define* (search-path-as-string->list path #:optional (separator #\:)) (string-tokenize path (char-set-complement (char-set separator)))) -(define* (set-path-environment-variable env-var sub-directories input-dirs - #:key (separator ":")) - "Look for each of SUB-DIRECTORIES in INPUT-DIRS. Set ENV-VAR to a -SEPARATOR-separated path accordingly. Example: +(define* (set-path-environment-variable env-var files input-dirs + #:key + (separator ":") + (type 'directory)) + "Look for each of FILES of the given TYPE (a symbol as returned by +'stat:type') in INPUT-DIRS. Set ENV-VAR to a SEPARATOR-separated path +accordingly. Example: (set-path-environment-variable \"PKG_CONFIG\" '(\"lib/pkgconfig\") (list package1 package2)) " - (let* ((path (search-path-as-list sub-directories input-dirs)) + (let* ((path (search-path-as-list files input-dirs + #:type type)) (value (list->search-path-as-string path separator))) (if (string-null? value) (begin diff --git a/guix/packages.scm b/guix/packages.scm index a25eab7699..ed9a565dc6 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -180,7 +180,8 @@ representation." corresponds to the arguments expected by `set-path-environment-variable'." (match spec (($ variable directories separator) - `(,variable ,directories ,separator)))) + ;; TODO: Allow other values of TYPE. See . + `(,variable ,directories ,separator directory)))) (define %supported-systems ;; This is the list of system types that are supported. By default, we -- cgit v1.2.3 From 856ae5e6c71a1283a414d33e638051f95d3cce35 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Dec 2014 19:20:18 +0100 Subject: build-system/gnu: Strip with '--strip-all' instead of '--strip-debug'. This saves 19% on the 'bin' directory of Coreutils, and certainly helpful for things like Git's 'libexec' directory. * guix/build-system/gnu.scm (gnu-build): Change default value for #:strip-flags to '("--strip-all"). * guix/build/gnu-build-system.scm (strip): Ditto. * gnu/packages/linux.scm (linux-libre)[arguments]: Add #:strip-flags. --- gnu/packages/linux.scm | 5 +++++ guix/build-system/gnu.scm | 2 +- guix/build/gnu-build-system.scm | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 9dc5f5cd40..53368251b5 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -292,6 +292,11 @@ for SYSTEM, or #f if there is no configuration for SYSTEM." (alist-replace 'install ,install-phase (alist-delete 'configure %standard-phases))) + + ;; Use '--strip-debug', not '--strip-all', because the latter leads to + ;; unloadable modules (due to the lack of a symbol table.) + #:strip-flags '("--strip-debug") + #:tests? #f)) (synopsis "100% free redistribution of a cleaned Linux kernel") (description diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index c675155a6a..f765a144c4 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -274,7 +274,7 @@ standard packages used as implicit inputs of the GNU build system." (parallel-tests? #t) (patch-shebangs? #t) (strip-binaries? #t) - (strip-flags ''("--strip-debug")) + (strip-flags ''("--strip-all")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) (phases '%standard-phases) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 4cc755f3a6..d661736831 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -295,7 +295,7 @@ makefiles." (objcopy-command (if target (string-append target "-objcopy") "objcopy")) - (strip-flags '("--strip-debug")) + (strip-flags '("--strip-all")) (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) -- cgit v1.2.3 From 7ec02d374d1fa8a8f4034a996485872fd2aa7b73 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Dec 2014 22:55:34 +0100 Subject: build-support/gnu: Add support for file patterns in search paths. * guix/build/utils.scm (search-path-as-list): Add #:pattern parameter and honor it. (set-path-environment-variable): Likewise, and pass it to 'search-path-as-list'. * guix/packages.scm (search-path-specification->sexp): Add PATTERN slot. * guix/build/gnu-build-system.scm (set-paths): Adjust accordingly. --- guix/build/gnu-build-system.scm | 10 ++++++---- guix/build/utils.scm | 40 ++++++++++++++++++++++++++++++++-------- guix/packages.scm | 3 ++- 3 files changed, 40 insertions(+), 13 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index d661736831..11b43c521f 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -73,21 +73,23 @@ input-directories))) (for-each (match-lambda - ((env-var (files ...) separator type) + ((env-var (files ...) separator type pattern) (set-path-environment-variable env-var files input-directories #:separator separator - #:type type))) + #:type type + #:pattern pattern))) search-paths) (when native-search-paths ;; Search paths for native inputs, when cross building. (for-each (match-lambda - ((env-var (files ...) separator type) + ((env-var (files ...) separator type pattern) (set-path-environment-variable env-var files native-input-directories #:separator separator - #:type type))) + #:type type + #:pattern pattern))) native-search-paths)) #t) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index f22b2c3cb7..47bcb3e8a1 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -291,7 +291,7 @@ matches REGEXP." ;;; (define* (search-path-as-list files input-dirs - #:key (type 'directory)) + #:key (type 'directory) pattern) "Return the list of directories among FILES of the given TYPE (a symbol as returned by 'stat:type') that exist in INPUT-DIRS. Example: @@ -300,13 +300,26 @@ returned by 'stat:type') that exist in INPUT-DIRS. Example: => (\"/package1/share/emacs/site-lisp\" \"/package3/share/emacs/site-lisp\") +When PATTERN is true, it is a regular expression denoting file names to look +for under the directories designated by FILES. For example: + + (search-path-as-list '(\"xml\") (list docbook-xml docbook-xsl) + #:type 'regular + #:pattern \"^catalog\\\\.xml$\") + => (\"/…/xml/dtd/docbook/catalog.xml\" + \"/…/xml/xsl/docbook-xsl-1.78.1/catalog.xml\") " (append-map (lambda (input) - (filter-map (lambda (file) - (let* ((file (string-append input "/" file)) - (stat (stat file #f))) - (and stat (eq? type (stat:type stat)) - file))) + (append-map (lambda (file) + (let ((file (string-append input "/" file))) + ;; XXX: By using 'find-files', we implicitly + ;; assume #:type 'regular. + (if pattern + (find-files file pattern) + (let ((stat (stat file #f))) + (if (and stat (eq? type (stat:type stat))) + (list file) + '()))))) files)) input-dirs)) @@ -319,7 +332,8 @@ returned by 'stat:type') that exist in INPUT-DIRS. Example: (define* (set-path-environment-variable env-var files input-dirs #:key (separator ":") - (type 'directory)) + (type 'directory) + pattern) "Look for each of FILES of the given TYPE (a symbol as returned by 'stat:type') in INPUT-DIRS. Set ENV-VAR to a SEPARATOR-separated path accordingly. Example: @@ -327,9 +341,19 @@ accordingly. Example: (set-path-environment-variable \"PKG_CONFIG\" '(\"lib/pkgconfig\") (list package1 package2)) + +When PATTERN is not #f, it must be a regular expression (really a string) +denoting file names to look for under the directories designated by FILES: + + (set-path-environment-variable \"XML_CATALOG_FILES\" + '(\"xml\") + (list docbook-xml docbook-xsl) + #:type 'regular + #:pattern \"^catalog\\\\.xml$\") " (let* ((path (search-path-as-list files input-dirs - #:type type)) + #:type type + #:pattern pattern)) (value (list->search-path-as-string path separator))) (if (string-null? value) (begin diff --git a/guix/packages.scm b/guix/packages.scm index b375895785..e299962a2e 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -181,7 +181,8 @@ representation." corresponds to the arguments expected by `set-path-environment-variable'." (match spec (($ variable files separator type) - `(,variable ,files ,separator ,type)))) + ;; TODO: Add support for PATTERN. + `(,variable ,files ,separator ,type #f)))) (define %supported-systems ;; This is the list of system types that are supported. By default, we -- cgit v1.2.3 From f05bdc9412135f34a1c417edc203c35cd005d0d5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Dec 2014 23:46:59 +0100 Subject: gnu: Don't use --strip-all in cases where this is problematic. This is a followup to 856ae5e. See for an example of build failure. * guix/build/gnu-build-system.scm (strip): Add #:archive-strip-flags parameter. Use it when (ar-file? path). * guix/build-system/gnu.scm (gnu-build): Add #:archive-strip-flags parameter and pass it down. * gnu/packages/commencement.scm (gcc-boot0)[arguments]: Add #:strip-flags. * gnu/packages/base.scm (glibc)[arguments]: Likewise. --- gnu/packages/base.scm | 3 +++ gnu/packages/commencement.scm | 4 ++++ guix/build-system/gnu.scm | 2 ++ guix/build/gnu-build-system.scm | 11 ++++++++++- 4 files changed, 19 insertions(+), 1 deletion(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 5bf27c9ef1..b4f4d8ee06 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -421,6 +421,9 @@ included.") ;; XXX: Work around "undefined reference to `__stack_chk_guard'". "libc_cv_ssp=no") + ;; Using '--strip-all' on crt*.o breaks them. + #:strip-flags '("--strip-debug") + #:tests? #f ; XXX #:phases (alist-cons-before 'configure 'pre-configure diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 20831de997..309e195bc2 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -170,6 +170,10 @@ identifier SYSTEM." (ice-9 regex) (srfi srfi-1) (srfi srfi-26)) + + ;; Using '--strip-all' leads to a link failure while building libc. + #:strip-flags '("--strip-debug") + ,@(substitute-keyword-arguments (package-arguments gcc-4.8) ((#:configure-flags flags) `(append (list ,(string-append "--target=" (boot-triplet)) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index f765a144c4..e2b41b1898 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -275,6 +275,7 @@ standard packages used as implicit inputs of the GNU build system." (patch-shebangs? #t) (strip-binaries? #t) (strip-flags ''("--strip-all")) + (archive-strip-flags ''("--strip-debug")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) (phases '%standard-phases) @@ -338,6 +339,7 @@ are allowed to refer to." #:patch-shebangs? ,patch-shebangs? #:strip-binaries? ,strip-binaries? #:strip-flags ,strip-flags + #:archive-strip-flags ,archive-strip-flags #:strip-directories ,strip-directories))) (define guile-for-build diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 11b43c521f..a985b1c715 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -298,6 +298,12 @@ makefiles." (string-append target "-objcopy") "objcopy")) (strip-flags '("--strip-all")) + + ;; Using '--strip-all' on .a file would remove the archive + ;; index, leading to "Archive has no index" errors when + ;; linking against them. + (archive-strip-flags '("--strip-debug")) + (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) @@ -353,7 +359,10 @@ makefiles." (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command - (append strip-flags (list path)))) + (append (if (ar-file? path) + archive-strip-flags + strip-flags) + (list path)))) (or (not debug-output) (add-debug-link path)))) (const #t) ; down -- cgit v1.2.3 From 7da473b75721e06237b106c6d186f2729117b1ee Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 29 Dec 2014 21:44:48 +0100 Subject: gnu: Revert use of '--strip-all'. This reverts commits f05bdc9412135f34a1c417edc203c35cd005d0d5 and 856ae5e6c71a1283a414d33e638051f95d3cce35. This broke all sorts of things. See , for example. --- gnu/packages/base.scm | 3 --- gnu/packages/commencement.scm | 4 ---- gnu/packages/linux.scm | 5 ----- guix/build-system/gnu.scm | 4 +--- guix/build/gnu-build-system.scm | 13 ++----------- 5 files changed, 3 insertions(+), 26 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index b4f4d8ee06..5bf27c9ef1 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -421,9 +421,6 @@ included.") ;; XXX: Work around "undefined reference to `__stack_chk_guard'". "libc_cv_ssp=no") - ;; Using '--strip-all' on crt*.o breaks them. - #:strip-flags '("--strip-debug") - #:tests? #f ; XXX #:phases (alist-cons-before 'configure 'pre-configure diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 309e195bc2..20831de997 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -170,10 +170,6 @@ identifier SYSTEM." (ice-9 regex) (srfi srfi-1) (srfi srfi-26)) - - ;; Using '--strip-all' leads to a link failure while building libc. - #:strip-flags '("--strip-debug") - ,@(substitute-keyword-arguments (package-arguments gcc-4.8) ((#:configure-flags flags) `(append (list ,(string-append "--target=" (boot-triplet)) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 53368251b5..9dc5f5cd40 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -292,11 +292,6 @@ for SYSTEM, or #f if there is no configuration for SYSTEM." (alist-replace 'install ,install-phase (alist-delete 'configure %standard-phases))) - - ;; Use '--strip-debug', not '--strip-all', because the latter leads to - ;; unloadable modules (due to the lack of a symbol table.) - #:strip-flags '("--strip-debug") - #:tests? #f)) (synopsis "100% free redistribution of a cleaned Linux kernel") (description diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index e2b41b1898..c675155a6a 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -274,8 +274,7 @@ standard packages used as implicit inputs of the GNU build system." (parallel-tests? #t) (patch-shebangs? #t) (strip-binaries? #t) - (strip-flags ''("--strip-all")) - (archive-strip-flags ''("--strip-debug")) + (strip-flags ''("--strip-debug")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) (phases '%standard-phases) @@ -339,7 +338,6 @@ are allowed to refer to." #:patch-shebangs? ,patch-shebangs? #:strip-binaries? ,strip-binaries? #:strip-flags ,strip-flags - #:archive-strip-flags ,archive-strip-flags #:strip-directories ,strip-directories))) (define guile-for-build diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index a985b1c715..1311cdcc9a 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -297,13 +297,7 @@ makefiles." (objcopy-command (if target (string-append target "-objcopy") "objcopy")) - (strip-flags '("--strip-all")) - - ;; Using '--strip-all' on .a file would remove the archive - ;; index, leading to "Archive has no index" errors when - ;; linking against them. - (archive-strip-flags '("--strip-debug")) - + (strip-flags '("--strip-debug")) (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) @@ -359,10 +353,7 @@ makefiles." (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command - (append (if (ar-file? path) - archive-strip-flags - strip-flags) - (list path)))) + (append strip-flags (list path)))) (or (not debug-output) (add-debug-link path)))) (const #t) ; down -- cgit v1.2.3 From ac70048be287bf4e1624051e74b3ecc3a295fa51 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 4 Jan 2015 18:16:16 +0100 Subject: build-system/gnu: Use executables from the target inputs in 'patch-shebangs'. Fixes . * guix/build/gnu-build-system.scm (patch-shebangs): Add #:inputs parameter. Remove 'bindirs'. Add 'bin-directories', 'output-bindirs', and 'input-bindirs'. Use them instead of (getenv "PATH") to as the argument to 'patch-shebang'. --- guix/build/gnu-build-system.scm | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 1311cdcc9a..cdfba2f9b7 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -265,7 +265,7 @@ makefiles." (define* (install #:key (make-flags '()) #:allow-other-keys) (zero? (apply system* "make" "install" make-flags))) -(define* (patch-shebangs #:key outputs (patch-shebangs? #t) +(define* (patch-shebangs #:key inputs outputs (patch-shebangs? #t) #:allow-other-keys) (define (list-of-files dir) (map (cut string-append dir "/" <>) @@ -274,20 +274,26 @@ makefiles." (eq? 'regular (stat:type s))))) '()))) - (define bindirs - (append-map (match-lambda - ((_ . dir) - (list (string-append dir "/bin") - (string-append dir "/sbin")))) - outputs)) + (define bin-directories + (match-lambda + ((_ . dir) + (list (string-append dir "/bin") + (string-append dir "/sbin"))))) + + (define output-bindirs + (append-map bin-directories outputs)) + + (define input-bindirs + ;; Shebangs should refer to binaries of the target system---i.e., from + ;; "inputs", not from "native-inputs". + (append-map bin-directories inputs)) (when patch-shebangs? - (let ((path (append bindirs - (search-path-as-string->list (getenv "PATH"))))) + (let ((path (append output-bindirs input-bindirs))) (for-each (lambda (dir) (let ((files (list-of-files dir))) (for-each (cut patch-shebang <> path) files))) - bindirs))) + output-bindirs))) #t) (define* (strip #:key target outputs (strip-binaries? #t) -- cgit v1.2.3 From 4eb01e5442aa7bbaa880ae8e72bd5d27434855ef Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 9 Jan 2015 22:35:33 +0100 Subject: build-system/gnu: Patch /usr/bin/file in all 'configure' files. * guix/build/utils.scm (patch-/usr/bin/file): New procedure. * guix/build/gnu-build-system.scm (patch-usr-bin-file): Rewrite using it. Patch all the files returned by 'find-files' that are executable. * gnu/packages/gawk.scm (gawk)[arguments]: Remove use of 'substitute*' for 'extension/configure'. --- gnu/packages/gawk.scm | 10 +--------- guix/build/gnu-build-system.scm | 30 ++++++++---------------------- guix/build/utils.scm | 26 +++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 32 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index 74d0720567..e0d3f41ac2 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2014, 2015 Mark H Weaver ;;; ;;; This file is part of GNU Guix. @@ -55,14 +55,6 @@ '((substitute* "extension/Makefile.in" (("^.*: check-for-shared-lib-support" match) (string-append "### " match)))) - '()) - - ;; XXX FIXME prerelease libtool fails on MIPS in the - ;; absence of /usr/bin/file. - ,@(if (string-prefix? "mips64" (or (%current-target-system) - (%current-system))) - '((substitute* "extension/configure" - (("/usr/bin/file") (which "file")))) '()))) (alist-cons-before diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index cdfba2f9b7..2880168273 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -115,29 +115,15 @@ working directory." (define* (patch-usr-bin-file #:key native-inputs inputs (patch-/usr/bin/file? #t) #:allow-other-keys) - "Patch occurrences of /usr/bin/file in configure, if present." + "Patch occurrences of \"/usr/bin/file\" in all the executable 'configure' +files found in the source tree. This works around Libtool's Autoconf macros, +which generates invocations of \"/usr/bin/file\" that are used to determine +things like the ABI being used." (when patch-/usr/bin/file? - (let ((file "configure") - (file-command (or (and=> (assoc-ref (or native-inputs inputs) "file") - (cut string-append <> "/bin/file")) - (which "file")))) - (cond ((not (file-exists? file)) - (format (current-error-port) - "patch-usr-bin-file: warning: `~a' not found~%" - file)) - ((not file-command) - (format (current-error-port) - "patch-usr-bin-file: warning: `file' not found in PATH~%")) - (else - (let ((st (stat file))) - (substitute* file - (("/usr/bin/file") - (begin - (format (current-error-port) - "patch-usr-bin-file: ~a: changing `~a' to `~a'~%" - file "/usr/bin/file" file-command) - file-command))) - (set-file-time file st)))))) + (for-each (lambda (file) + (when (executable-file? file) + (patch-/usr/bin/file file))) + (find-files "." "^configure$"))) #t) (define* (patch-source-shebangs #:key source #:allow-other-keys) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 86b7ca0155..4407f9af23 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov ;;; @@ -61,6 +61,7 @@ set-file-time patch-shebang patch-makefile-SHELL + patch-/usr/bin/file fold-port-matches remove-store-references wrap-program)) @@ -681,6 +682,29 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged." (when keep-mtime? (set-file-time file st)))) +(define* (patch-/usr/bin/file file + #:key + (file-command (which "file")) + (keep-mtime? #t)) + "Patch occurrences of \"/usr/bin/file\" in FILE, replacing them with +FILE-COMMAND. When KEEP-MTIME? is true, keep FILE's modification time +unchanged." + (if (not file-command) + (format (current-error-port) + "patch-/usr/bin/file: warning: \ +no replacement 'file' command, doing nothing~%") + (let ((st (stat file))) + (substitute* file + (("/usr/bin/file") + (begin + (format (current-error-port) + "patch-/usr/bin/file: ~a: changing `~a' to `~a'~%" + file "/usr/bin/file" file-command) + file-command))) + + (when keep-mtime? + (set-file-time file st))))) + (define* (fold-port-matches proc init pattern port #:optional (unmatched (lambda (_ r) r))) "Read from PORT character-by-character; for each match against -- cgit v1.2.3