1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-29 21:41:15 +02:00

gnu: cproc: Refer to invoked programs by full path.

* gnu/packages/c.scm (cproc)[arguments]: Add phase to set glibc dir.
[arguments]: Properly specify program inputs in 'configure phase.
* gnu/packages/patches/cproc-extra-linkflags.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Sören Tempel
2025-09-26 20:50:30 +02:00
committed by Ludovic Courtès
parent 6bdc69c618
commit 5da19d7eff
3 changed files with 55 additions and 10 deletions

View File

@@ -1132,6 +1132,7 @@ dist_patch_DATA = \
%D%/packages/patches/corrosion-honor-CARGO_BUILD_TARGET.patch \
%D%/packages/patches/cppcheck-fix-basedir-test.patch \
%D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\
%D%/packages/patches/cproc-extra-linkflags.patch \
%D%/packages/patches/cpulimit-with-glib-2.32.patch \
%D%/packages/patches/crawl-upgrade-saves.patch \
%D%/packages/patches/crc32c-unbundle-googletest.patch \

View File

@@ -150,7 +150,7 @@ slicing.")
(define-public cproc
(let ((commit "70fe9ef1810cc6c05bde9eb0970363c35fa7e802")
(revision "1"))
(revision "2"))
(package
(name "cproc")
(version (git-version "0.0" revision commit))
@@ -162,7 +162,8 @@ slicing.")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1qmgzll7z7mn587azkj4cizyyd8ii6iznfxpc66ja08140sbn9yx"))))
(base32 "1qmgzll7z7mn587azkj4cizyyd8ii6iznfxpc66ja08140sbn9yx"))
(patches (search-patches "cproc-extra-linkflags.patch"))))
(build-system gnu-build-system)
(arguments
(list
@@ -171,25 +172,50 @@ slicing.")
(string-append "PREFIX=" #$output))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'set-glibc-library-directory
(lambda* (#:key inputs #:allow-other-keys)
(setenv "LINKFLAGS_EXTRA"
(string-append
"-L"
(dirname (search-input-file inputs "/lib/libc.so"))))))
(replace 'configure
(lambda* (#:key inputs #:allow-other-keys)
(let ((gcc-lib (assoc-ref inputs "gcc:lib"))
(host-system #$(nix-system->gnu-triplet
(%current-system)))
(host-system #$(nix-system->gnu-triplet (%current-system)))
(target-system #$(nix-system->gnu-triplet
(or (%current-target-system)
(%current-system)))))
(or (%current-target-system)
(%current-system)))))
(invoke "./configure"
(string-append "--prefix=" #$output)
(string-append "--prefix="
#$output)
(string-append "--host=" host-system)
(string-append "--target=" target-system)
(string-append "--with-ld=" #$(ld-for-target))
(string-append "--with-gcc-libdir=" gcc-lib))))))))
(string-append "--with-as="
(search-input-file inputs
(string-append
"/bin/"
#$(as-for-target))))
(string-append "--with-ld="
(search-input-file inputs
(string-append
"/bin/"
#$(ld-for-target))))
(string-append "--with-ldso="
(search-input-file inputs
#$(glibc-dynamic-linker)))
(string-append "--with-cpp="
(search-input-file inputs "/bin/cpp"))
(string-append "--with-qbe="
(search-input-file inputs "/bin/qbe"))
(string-append "--with-gcc-libdir="
(dirname (car (find-files gcc-lib
"crtbegin\\.o")))))))))))
(inputs `(("qbe" ,qbe)
("gcc:lib" ,gcc "lib")))
(supported-systems (list "x86_64-linux" "aarch64-linux"))
(synopsis "Simple C11 compiler backed by QBE")
(description "@code{cproc} is a C compiler using QBE as a backend,
(description
"@code{cproc} is a C compiler using QBE as a backend,
supporting most of C11 along with some GCC and C2x extensions.")
(home-page "https://sr.ht/~mcf/cproc")
(license license:expat))))

View File

@@ -0,0 +1,18 @@
Contrary to other Linux distributions, the glibc library files are not in the
standard ld(1) search path on Guix. However, cproc only allows us to specify
the gcclibdir. To workaround that we manually add a feature to cproc's
configure script which allows us to pass extra linkflags via an environment
variable.
diff --git a/configure b/configure
index dab1bf3..a31b456 100755
--- a/configure
+++ b/configure
@@ -159,7 +159,7 @@ static const char *const preprocesscmd[] = {
$defines};
static const char *const codegencmd[] = {"$DEFAULT_QBE"};
static const char *const assemblecmd[] = {"$DEFAULT_ASSEMBLER"};
-static const char *const linkcmd[] = {"$DEFAULT_LINKER", $linkflags};
+static const char *const linkcmd[] = {"$DEFAULT_LINKER", ${LINKFLAGS_EXTRA:+\"$LINKFLAGS_EXTRA\", }$linkflags};
EOF
echo done