summary refs log tree commit diff
path: root/gnu/packages/c.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/c.scm')
-rw-r--r--gnu/packages/c.scm198
1 files changed, 148 insertions, 50 deletions
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 1ce507119f..1630a40d17 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -14,6 +14,8 @@
 ;;; Copyright © 2021 David Dashyan <mail@davie.li>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
+;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;; Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,6 +50,7 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages guile)
@@ -63,59 +66,111 @@
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml))
 
+(define-public cproc
+  (let ((commit "70fe9ef1810cc6c05bde9eb0970363c35fa7e802")
+        (revision "1"))
+    (package
+      (name "cproc")
+      (version (git-version "0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://git.sr.ht/~mcf/cproc")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1qmgzll7z7mn587azkj4cizyyd8ii6iznfxpc66ja08140sbn9yx"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:make-flags
+        #~(list (string-append "CC=" #$(cc-for-target))
+                (string-append "PREFIX=" #$output))
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let ((gcc-lib (assoc-ref inputs "gcc:lib"))
+                      (host-system #$(nix-system->gnu-triplet
+                                      (%current-system)))
+                      (target-system #$(nix-system->gnu-triplet
+                                        (or (%current-target-system)
+                                            (%current-system)))))
+                  (invoke "./configure"
+                          (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))))))))
+      (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,
+ supporting most of C11 along with some GCC and C2x extensions.")
+      (home-page "https://sr.ht/~mcf/cproc")
+      (license license:expat))))
+
 (define-public tcc
-  (package
-    (name "tcc")                                  ;aka. "tinycc"
-    (version "0.9.27")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://savannah/tinycc/tcc-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32
-                "177bdhwzrnqgyrdv1dwvpd04fcxj68s5pm1dzwny6359ziway8yy"))))
-    (build-system gnu-build-system)
-    (native-inputs (list perl texinfo))
-    (arguments
-     `(#:configure-flags (list (string-append "--elfinterp="
-                                              (assoc-ref %build-inputs "libc")
-                                              ,(glibc-dynamic-linker))
-                               (string-append "--crtprefix="
-                                              (assoc-ref %build-inputs "libc")
-                                              "/lib")
-                               (string-append "--sysincludepaths="
-                                              (assoc-ref %build-inputs "libc")
-                                              "/include:"
-                                              (assoc-ref %build-inputs
-                                                         "kernel-headers")
-                                              "/include:{B}/include")
-                               (string-append "--libpaths="
-                                              (assoc-ref %build-inputs "libc")
-                                              "/lib")
-                               ,@(if (string-prefix? "armhf-linux"
-                                                     (or (%current-target-system)
-                                                         (%current-system)))
-                                     `("--triplet=arm-linux-gnueabihf")
-                                     '()))
-       #:test-target "test"))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "CPATH")
-            (files '("include")))
-           (search-path-specification
-            (variable "LIBRARY_PATH")
-            (files '("lib" "lib64")))))
-    ;; Fails to build on MIPS: "Unsupported CPU"
-    (supported-systems (delete "mips64el-linux" %supported-systems))
-    (synopsis "Tiny and fast C compiler")
-    (description
-     "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
+  ;; There's currently no release fixing <https://issues.guix.gnu.org/52140>.
+  (let ((revision "1")
+        (commit "a83b28568596afd8792fd58d1a5bd157fc6b6634"))
+    (package
+      (name "tcc")                                ;aka. "tinycc"
+      (version (git-version "0.9.27" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "git://repo.or.cz/tinycc.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "01znw86fg73x3k0clafica4b6glbhz69p588kvp766i0zgvs68dh"))))
+      (build-system gnu-build-system)
+      (native-inputs (list perl texinfo))
+      (arguments
+       `(#:configure-flags (list (string-append "--elfinterp="
+                                                (assoc-ref %build-inputs
+                                                           "libc")
+                                                ,(glibc-dynamic-linker))
+                                 (string-append "--crtprefix="
+                                                (assoc-ref %build-inputs
+                                                           "libc") "/lib")
+                                 (string-append "--sysincludepaths="
+                                                (assoc-ref %build-inputs
+                                                           "libc") "/include:"
+                                                (assoc-ref %build-inputs
+                                                           "kernel-headers")
+                                                "/include:{B}/include")
+                                 (string-append "--libpaths="
+                                                (assoc-ref %build-inputs
+                                                           "libc") "/lib")
+                                 ,@(if (string-prefix? "armhf-linux"
+                                                       (or (%current-target-system)
+                                                           (%current-system)))
+                                       `("--triplet=arm-linux-gnueabihf")
+                                       '()))
+         #:test-target "test"))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "CPATH")
+              (files '("include")))
+             (search-path-specification
+              (variable "LIBRARY_PATH")
+              (files '("lib" "lib64")))))
+      ;; Fails to build on MIPS: "Unsupported CPU"
+      (supported-systems (delete "mips64el-linux" %supported-systems))
+      (synopsis "Tiny and fast C compiler")
+      (description
+       "TCC, also referred to as \"TinyCC\", is a small and fast C compiler
 written in C.  It supports ANSI C with GNU and extensions and most of the C99
 standard.")
-    (home-page "http://www.tinycc.org/")
-    ;; An attempt to re-licence tcc under the Expat licence is underway but not
-    ;; (if ever) complete.  See the RELICENSING file for more information.
-    (license license:lgpl2.1+)))
+      (home-page "http://www.tinycc.org/")
+      ;; An attempt to re-licence tcc under the Expat licence is underway but not
+      ;; (if ever) complete.  See the RELICENSING file for more information.
+      (license license:lgpl2.1+))))
 
 (define-public pcc
   (package
@@ -305,6 +360,11 @@ Its three main components are:
     (build-system gnu-build-system)
     (native-inputs
      (list autoconf automake libtool pkg-config check))
+    (native-search-paths
+     (list
+      (search-path-specification
+       (variable "C_INCLUDE_PATH")
+       (files '("include")))))
     (synopsis "Thin wrapper over POSIX syscalls")
     (description
      "The purpose of libfixposix is to offer replacements for parts of POSIX
@@ -1128,3 +1188,41 @@ performance concurrent systems developed in C99+.")
 C and C++.  The functions it provides are like those from the C header
 string.h, but with a utf8* prefix instead of the str* prefix.")
       (license license:unlicense))))
+
+(define-public utest-h
+  ;; The latest commit is used as there is no release.
+  (let ((commit   "54458e248f875f1a51f0af8bec8ca6ae7761b9d1")
+        (revision "0"))
+    (package
+      (name "utest-h")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/sheredom/utest.h")
+                      (commit commit)))
+                (file-name (git-file-name "utest.h" version))
+                (sha256
+                 (base32
+                  "1ikl5jwmjdw1mblqyl2kvnqwkjgaz78c1h7mjcfmzjc0d3h8kh44"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:phases (modify-phases %standard-phases
+                    (delete 'build)
+                    (delete 'configure)
+                    (replace 'check
+                      (lambda* (#:key tests? #:allow-other-keys)
+                        (when tests?
+                          (with-directory-excursion "test"
+                                                    (invoke "cmake" ".")
+                                                    (invoke "make")))))
+                    (replace 'install
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let ((out (assoc-ref outputs "out")))
+                          (install-file "utest.h"
+                                        (string-append out "/include"))))))))
+      (home-page "https://www.duskborn.com/utest_h/")
+      (synopsis "Single-header unit testing framework for C and C++")
+      (description
+       "This package provides a header-only unit testing library for C/C++.")
+      (license license:unlicense))))