[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: build-system/meson: Strip RUNPATH and remove PatchELF traces.
From: |
Marius Bakke |
Subject: |
01/06: build-system/meson: Strip RUNPATH and remove PatchELF traces. |
Date: |
Wed, 22 Aug 2018 12:13:42 -0400 (EDT) |
mbakke pushed a commit to branch core-updates
in repository guix.
commit bf91e6835d21e3bd7b49bb85b40f61389604c6f7
Author: Marius Bakke <address@hidden>
Date: Wed Aug 22 16:22:36 2018 +0200
build-system/meson: Strip RUNPATH and remove PatchELF traces.
* guix/build-system/meson.scm (%meson-build-system-modules): Don't
import (guix build rpath).
* guix/build/meson-build-system.scm (fix-runpath): Rename to ...
(shrink-runpath): ... this. Update docstring. Remove AUGMENT-RPATH calls
and
related code.
(%standard-phases): Add 'shrink-runpath'.
---
guix/build-system/meson.scm | 1 -
guix/build/meson-build-system.scm | 52 ++++++---------------------------------
2 files changed, 7 insertions(+), 46 deletions(-)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index fddf899..8d49020 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -41,7 +41,6 @@
(define %meson-build-system-modules
;; Build-side modules imported by default.
`((guix build meson-build-system)
- (guix build rpath)
;; The modules from glib-or-gtk contains the modules from gnu-build-system,
;; so there is no need to import that too.
,@%glib-or-gtk-build-system-modules))
diff --git a/guix/build/meson-build-system.scm
b/guix/build/meson-build-system.scm
index f6b8b49..d0975fc 100644
--- a/guix/build/meson-build-system.scm
+++ b/guix/build/meson-build-system.scm
@@ -22,7 +22,6 @@
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
#:use-module (guix build utils)
- #:use-module (guix build rpath)
#:use-module (guix build gremlin)
#:use-module (guix elf)
#:use-module (ice-9 match)
@@ -78,42 +77,13 @@
(define* (install #:rest args)
(invoke "ninja" "install"))
-(define* (fix-runpath #:key (elf-directories '("lib" "lib64" "libexec"
- "bin" "sbin"))
- outputs #:allow-other-keys)
- "Try to make sure all ELF files in ELF-DIRECTORIES are able to find their
-local dependencies in their RUNPATH, by searching for the needed libraries in
-the directories of the package, and adding them to the RUNPATH if needed.
-Also shrink the RUNPATH to what is needed,
+(define* (shrink-runpath #:key (elf-directories '("lib" "lib64" "libexec"
+ "bin" "sbin"))
+ outputs #:allow-other-keys)
+ "Go through all ELF files from ELF-DIRECTORIES and shrink the RUNPATH
since a lot of directories are left over from the build phase of meson,
for example libraries only needed for the tests."
- ;; Find the directories (if any) that contains DEP-NAME. The directories
- ;; searched are the ones that ELF-FILES are in.
- (define (find-deps dep-name elf-files)
- (map dirname (filter (lambda (file)
- (string=? dep-name (basename file)))
- elf-files)))
-
- ;; Return a list of libraries that FILE needs.
- (define (file-needed file)
- (let* ((elf (call-with-input-file file
- (compose parse-elf get-bytevector-all)))
- (dyninfo (elf-dynamic-info elf)))
- (if dyninfo
- (elf-dynamic-info-needed dyninfo)
- '())))
-
-
- ;; If FILE needs any libs that are part of ELF-FILES, the RUNPATH
- ;; is modified accordingly.
- (define (handle-file file elf-files)
- (let* ((dep-dirs (concatenate (map (lambda (dep-name)
- (find-deps dep-name elf-files))
- (file-needed file)))))
- (unless (null? dep-dirs)
- (augment-rpath file (string-join dep-dirs ":")))))
-
(define handle-output
(match-lambda
((output . directory)
@@ -129,10 +99,7 @@ for example libraries only needed for the tests."
(elf-list (concatenate (map (lambda (dir)
(find-files dir elf-pred))
existing-elf-dirs))))
- (for-each (lambda (elf-file)
- (strip-runpath elf-file)
- (handle-file elf-file elf-list))
- elf-list)))))
+ (for-each strip-runpath elf-list)))))
(for-each handle-output outputs)
#t)
@@ -144,13 +111,8 @@ for example libraries only needed for the tests."
(replace 'configure configure)
(replace 'build build)
(replace 'check check)
- ;; XXX: We used to have 'fix-runpath' here, but it appears no longer
- ;; necessary with newer Meson. However on 'core-updates' there is a
- ;; useful 'strip-runpath' procedure to ensure no bogus directories in
- ;; RUNPATH (remember that we tell Meson to not touch RUNPATH in
- ;; (@ (gnu packages build-tools) meson-for-build)), so it should be
- ;; re-added there sans the augment-rpath calls (which are not needed).
- (replace 'install install)))
+ (replace 'install install)
+ (add-after 'strip 'shrink-runpath shrink-runpath)))
(define* (meson-build #:key inputs phases
#:allow-other-keys #:rest args)
- branch core-updates updated (fdb2220 -> 22cf2f4), Marius Bakke, 2018/08/22
- 05/06: gnu: python-urllib3: Update to 1.23., Marius Bakke, 2018/08/22
- 04/06: gnu: python-certifi: Update to 2018.8.13., Marius Bakke, 2018/08/22
- 01/06: build-system/meson: Strip RUNPATH and remove PatchELF traces.,
Marius Bakke <=
- 02/06: gnu: Remove GCC ICE workarounds., Marius Bakke, 2018/08/22
- 06/06: gnu: python-cffi: Update to 1.11.5., Marius Bakke, 2018/08/22
- 03/06: gnu: python-idna: Update to 2.7., Marius Bakke, 2018/08/22