diff mbox series

[bug#73529,core,v2] gnu: patchelf: Build from git

Message ID 9706446756fd9c5c9e40ae1fa8fc6ca326407178.1727684109.git.attila@lendvai.name
State New
Headers show
Series [bug#73529,core,v2] gnu: patchelf: Build from git | expand

Commit Message

Attila Lendvai Sept. 30, 2024, 8:15 a.m. UTC
From: Attila Lendvai <attila@lendvai.name>

Rationale: it makes it much easier for anyone to build a pending PR (simply by
using `(commit "pull/544/head")` in the origin).  It also makes it more
resilient against attacks hidden in release tarballs.

* gnu/packages/elf.scm (patchelf): Change source origin to the git repo and
adjust inputs accordingly.
[native-inputs]: Add autoconf, automake.

Change-Id: I94eaedcd826c32b2c90823fe026718213f8d5962
---
 gnu/packages/elf.scm | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)


base-commit: d74fc6c8e6428c37a5bfad85b08999ff47000208
diff mbox series

Patch

diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index dc2db836321..98b80c24b3e 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -278,14 +278,14 @@  (define-public patchelf
     (name "patchelf")
     (version "0.18.0")
     (source (origin
-             (method url-fetch)
-             (uri (string-append
-                   "https://github.com/NixOS/patchelf/releases/download/"
-                   version
-                   "/patchelf-" version ".tar.bz2"))
-             (sha256
-              (base32
-               "02s7ap86rx6yagfh9xwp96sgsj0p6hp99vhiq9wn4mxshakv4lhr"))))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/NixOS/patchelf")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1v5mh8wdax4a97hw79nvzy0dixkbs0h487xkskkljkkdamq4rj5z"))))
     (build-system gnu-build-system)
     (arguments
      '(#:phases
@@ -298,8 +298,8 @@  (define-public patchelf
                ;; Disable checking for an empty runpath:
                (("^if test.*") "")
                ;; Find libgcc_s.so, which is necessary for the test:
-               (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
-                                                    "/lib")))
+               (("/xxxxxxxxxxxxxxx")
+                (dirname (search-input-file inputs "/lib/libgcc_s.so"))))
              (substitute* "tests/replace-needed.sh"
                ;; This test assumes that only libc will be linked alongside
                ;; libfoo, but we also link libgcc_s.
@@ -309,10 +309,13 @@  (define-public patchelf
                ;; we still need to find libgcc_s (see above).
                (("^\"\\$\\{SCRATCH\\}\"\\/simple.$") ""))
              ;; Skip this test for now.
-             (substitute* "tests/Makefile.in"
+             (substitute* "tests/Makefile.am"
                ((".*shared-rpath\\.sh \\.*") "")))))))
     (native-inputs
-     `(("gcc:lib" ,gcc "lib")))
+     (list
+      autoconf
+      automake
+      (list gcc "lib")))
     (home-page "https://nixos.org/patchelf.html")
     (synopsis "Modify the dynamic linker and RPATH of ELF executables")
     (description