summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2025-09-26 20:50:30 +0200
committerLudovic Courtès <ludo@gnu.org>2025-10-06 10:38:11 +0200
commit5da19d7eff5ab3c0ed967a9837a87129b04d005e (patch)
tree38b3b588910e71268044eae1907e5e17aaef2362
parent6bdc69c618c599d61af6084dc9c3986cd66deb28 (diff)
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>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/c.scm46
-rw-r--r--gnu/packages/patches/cproc-extra-linkflags.patch18
3 files changed, 55 insertions, 10 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 217bdec2ec..bfbb0ea0ce 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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 \
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e6be2a195b..62e70e1e91 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -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))))
diff --git a/gnu/packages/patches/cproc-extra-linkflags.patch b/gnu/packages/patches/cproc-extra-linkflags.patch
new file mode 100644
index 0000000000..493b35624e
--- /dev/null
+++ b/gnu/packages/patches/cproc-extra-linkflags.patch
@@ -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