unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#53833] [PATCH] gnu: Add qbe.
@ 2022-02-07  1:13 jgart via Guix-patches via
  2022-02-07  9:47 ` Liliana Marie Prikler
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: jgart via Guix-patches via @ 2022-02-07  1:13 UTC (permalink / raw)
  To: 53833; +Cc: jgart

* gnu/packages/c.scm (qbe): New variable.
---
 gnu/packages/c.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 459d996fa2..8966b7b8d0 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -142,6 +142,36 @@ (define-public pcc
     ;; preferred.  See http://pcc.ludd.ltu.se/licenses/ for more details.
     (license (list license:bsd-2 license:bsd-3))))
 
+(define-public qbe
+  (let ((commit "2ca6fb25a238842418019a3f9ee8d1beb1327f7e")
+        (revision "0"))
+    (package
+      (name "qbe")
+      (version (git-version "0.0" revision commit))
+      (source
+        (origin
+          (method git-fetch)
+          (uri
+            (git-reference
+              (url "git://c9x.me/qbe")
+              (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+           (base32
+            "0qbnsrwk10v0s42vzxy2wvksd8xl8bmxfzqv2a4j4zjaklqgfd6j"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ; Tests require a running qemu?
+         #:make-flags (list (string-append "CC=" ,(cc-for-target))
+                            (string-append "PREFIX=" %output))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure))))
+      (synopsis "Backend compiler")
+      (description "@code{qbe} is a compiler backend.")
+      (home-page "https://c9x.me/compile/")
+      (license license:expat))))
+
 (define-public libbytesize
   (package
     (name "libbytesize")
-- 
2.35.0





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: Add qbe.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
@ 2022-02-07  9:47 ` Liliana Marie Prikler
  2022-02-08 21:10   ` jgart via Guix-patches via
  2022-04-25 20:08 ` [bug#53833] " paren--- via Guix-patches via
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 14+ messages in thread
From: Liliana Marie Prikler @ 2022-02-07  9:47 UTC (permalink / raw)
  To: jgart, 53833

Am Sonntag, dem 06.02.2022 um 20:13 -0500 schrieb jgart:
> * gnu/packages/c.scm (qbe): New variable.
> ---
>  gnu/packages/c.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
> index 459d996fa2..8966b7b8d0 100644
> --- a/gnu/packages/c.scm
> +++ b/gnu/packages/c.scm
> @@ -142,6 +142,36 @@ (define-public pcc
>      ;; preferred.  See http://pcc.ludd.ltu.se/licenses/ for more
> details.
>      (license (list license:bsd-2 license:bsd-3))))
>  
> +(define-public qbe
> +  (let ((commit "2ca6fb25a238842418019a3f9ee8d1beb1327f7e")
> +        (revision "0"))
> +    (package
> +      (name "qbe")
> +      (version (git-version "0.0" revision commit))
From the homepage: "QBE is in constant change. It is a young project
and I still have many ideas to try."  As always, I don't think it's too
good of an idea to package projects that tell you "this edge will make
you bleed".  Or in the words of the manual

> Occasionally, we package snapshots of upstream’s version control
> system (VCS) instead of formal releases.  This should remain
> exceptional, because it is up to upstream developers to clarify what
> the stable release is.
I think upstream is very clear here that QBE is not yet stable and
therefore not something you'd want in a distro.  Of course, since the
recipe is a rather simple one, you can easily maintain it in your own
channel -- or not package it at all and use it from source with just a
C compiler.

> +      (source
> +        (origin
> +          (method git-fetch)
> +          (uri
> +            (git-reference
> +              (url "git://c9x.me/qbe")
> +              (commit commit)))
> +          (file-name (git-file-name name version))
> +          (sha256
> +           (base32
> +           
> "0qbnsrwk10v0s42vzxy2wvksd8xl8bmxfzqv2a4j4zjaklqgfd6j"))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       `(#:tests? #f ; Tests require a running qemu?
You should be able to add qemu to native-inputs if that's all it takes.
> +         #:make-flags (list (string-append "CC=" ,(cc-for-target))
> +                            (string-append "PREFIX=" %output))
> +         #:phases
> +         (modify-phases %standard-phases
> +           (delete 'configure))))
> +      (synopsis "Backend compiler")
> +      (description "@code{qbe} is a compiler backend.")
It'd be nice if the description was more descriptive :)
Also the synopsis should probably not invert the ordering of "compiler"
and "backend".
> +      (home-page "https://c9x.me/compile/")
> +      (license license:expat))))
> +
>  (define-public libbytesize
>    (package
>      (name "libbytesize")

Cheers




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: Add qbe.
  2022-02-07  9:47 ` Liliana Marie Prikler
@ 2022-02-08 21:10   ` jgart via Guix-patches via
  2022-04-05 16:11     ` bug#53833: " Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: jgart via Guix-patches via @ 2022-02-08 21:10 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 53833

On Mon, 07 Feb 2022 10:47:08 +0100 Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> wrote:
> Am Sonntag, dem 06.02.2022 um 20:13 -0500 schrieb jgart:
> > * gnu/packages/c.scm (qbe): New variable.
> > ---
> >  gnu/packages/c.scm | 30 ++++++++++++++++++++++++++++++
> >  1 file changed, 30 insertions(+)
> > 
> > diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
> > index 459d996fa2..8966b7b8d0 100644
> > --- a/gnu/packages/c.scm
> > +++ b/gnu/packages/c.scm
> > @@ -142,6 +142,36 @@ (define-public pcc
> >      ;; preferred.  See http://pcc.ludd.ltu.se/licenses/ for more
> > details.
> >      (license (list license:bsd-2 license:bsd-3))))
> >  
> > +(define-public qbe
> > +  (let ((commit "2ca6fb25a238842418019a3f9ee8d1beb1327f7e")
> > +        (revision "0"))
> > +    (package
> > +      (name "qbe")
> > +      (version (git-version "0.0" revision commit))
> From the homepage: "QBE is in constant change. It is a young project
> and I still have many ideas to try."  As always, I don't think it's too
> good of an idea to package projects that tell you "this edge will make
> you bleed".  Or in the words of the manual
> 
> > Occasionally, we package snapshots of upstream’s version control
> > system (VCS) instead of formal releases.  This should remain
> > exceptional, because it is up to upstream developers to clarify what
> > the stable release is.
> I think upstream is very clear here that QBE is not yet stable and
> therefore not something you'd want in a distro.  Of course, since the
> recipe is a rather simple one, you can easily maintain it in your own
> channel -- or not package it at all and use it from source with just a
> C compiler.

Hi lilyp,

Thanks for the review. It's much appreciated.

Here's a recent talk from FOSDEM 2022 on qbe by Drew Devault in case
you're interested in finding out more about it:

https://fosdem.org/2022/schedule/event/lg_qbe/

I already have qbe in Guix 'R Us along with cproc:

https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/qbe.scm#L43

If maintainers think it will be ready for Guix in the future ping me or
feel free to send an update as you see fit.

all best,

jgart

https://whereiseveryone.srht.site/
gemini://whereiseveryone.srht.site/

https://sr.ht/~mcf/cproc




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#53833: [PATCH] gnu: Add qbe.
  2022-02-08 21:10   ` jgart via Guix-patches via
@ 2022-04-05 16:11     ` Ludovic Courtès
  0 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2022-04-05 16:11 UTC (permalink / raw)
  To: jgart; +Cc: Liliana Marie Prikler, 53833-done

Hi jgart,

jgart <jgart@dismail.de> skribis:

> I already have qbe in Guix 'R Us along with cproc:
>
> https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/qbe.scm#L43
>
> If maintainers think it will be ready for Guix in the future ping me or
> feel free to send an update as you see fit.

I’m not opposed to including it if it’s useful but like you write, since
you have it in a channel, maybe we can wait until it’s mature enough
before getting it in Guix proper.

I’m closing this issue but feel free to ping us when you think it should
get in.

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: Add qbe.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
  2022-02-07  9:47 ` Liliana Marie Prikler
@ 2022-04-25 20:08 ` paren--- via Guix-patches via
  2022-04-26 18:16 ` paren--- via Guix-patches via
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: paren--- via Guix-patches via @ 2022-04-25 20:08 UTC (permalink / raw)
  To: 53833

QBE is now being used in one reasonably mature project: https://harelang.org https://harelang.org/ 

While it's not at 1.0 yet, it's been in development for ~2 (i think) years now.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: Add qbe.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
  2022-02-07  9:47 ` Liliana Marie Prikler
  2022-04-25 20:08 ` [bug#53833] " paren--- via Guix-patches via
@ 2022-04-26 18:16 ` paren--- via Guix-patches via
  2022-05-07 16:34 ` [bug#53833] QBE and cproc upstreaming paren--- via Guix-patches via
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: paren--- via Guix-patches via @ 2022-04-26 18:16 UTC (permalink / raw)
  To: Liliana Marie Prikler, 53833

> I'm not asking for a 1.0, I'd be fine with a 0.1 or even a 0.0.1. As
> it stands, every place I look at says "this is experimental" rather
> than "you can use this and it ought to work as intended at least for
> these sample programs".

Ah, I think you misunderstood slightly: I was saying that Hare was not yet at 1.0 yet (although QBE isn't either.) Regardless, I think it is mature enough for Guix, especially as a stable programming language uses it now.

By the way, https://c9x.me/compile is really outdated, so its estimate on QBE's stability is probably inaccurate by now.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] QBE and cproc upstreaming
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (2 preceding siblings ...)
  2022-04-26 18:16 ` paren--- via Guix-patches via
@ 2022-05-07 16:34 ` paren--- via Guix-patches via
  2022-05-07 17:09 ` [bug#53833] [PATCH] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: paren--- via Guix-patches via @ 2022-05-07 16:34 UTC (permalink / raw)
  To: 53833; +Cc: liliana.prikler

Hi Liliana,

> IMHO, paren's initial patch is slightly better in quality than 55151,
> but there are two (three) things lacking. First, the synopsis and
> description are subpar. 55151 has a slightly better synopsis, don't
> feel too sure about the description though. Second, the "fix-cc" phase
> from 55151 should be added after unpack ("patch-test-script" sounds
> like a better phase name). It might be better to use (cc-for-target)
> in the substitution rather than gcc, but note that this substitution
> only applies for native compilation anyway.

I have made your suggested improvements, plus substantial changes to the build recipe that allows
you to cross-compile both QBE and cproc. I have confirmed that cross-compilation works for aarch64
and riscv64. Here is the updated code: <https://git.sr.ht/~whereiseveryone/guixrus/tree/master/guixrus/packages/qbe.scm>.

The changes are as follows for qbe:
* Patch the makefile to support cross-building with a TARGET variable. This is done with a standalone
patch.
* Set "TARGET" to the appropriate target system.
* Set the correct supported systems. (It supports x86_64, aarch64, and riscv64 currently.)
* Improve the synopsis and description.
* Update to the latest commit.
Note that tests still aren't provided because they use QEMU.

And cproc:
* Reenable tests. Not sure why they were disabled in the first place...
* Instead of skipping the configuration phase, replace it with an invocation of cproc's hand-written
./configure. Pass the correct arguments to it to allow cross-compilation to aarch64.
* Use gcc:lib as an input to support cross-compilation.
* Set the correct supported systems. (It supports riscv64 only under musl libc right now.)
* Improve the synopsis and description.
* Update to the latest commit.

I think they are ready for upstreaming now. I will send improved patches to the appropriate issue
threads.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: Add qbe.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (3 preceding siblings ...)
  2022-05-07 16:34 ` [bug#53833] QBE and cproc upstreaming paren--- via Guix-patches via
@ 2022-05-07 17:09 ` (unmatched-parenthesis via Guix-patches via
  2022-05-07 17:11 ` [bug#53833] [PATCH] gnu: patches: Add qbe-makefile-add-target.patch (unmatched-parenthesis via Guix-patches via
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: (unmatched-parenthesis via Guix-patches via @ 2022-05-07 17:09 UTC (permalink / raw)
  To: 53833; +Cc: (unmatched-parenthesis

* gnu/packages/c.scm (qbe): New variable.

Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
---
 gnu/packages/c.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index da034d5fd9..1e3296dae1 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -1064,3 +1064,36 @@ (define-public utf8-h
 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 qbe
+  (let ((commit "2caa26e388b1c904d2f12fb09f84df7e761d8331")
+        (revision "1"))
+   (package
+    (name "qbe")
+    (version (git-version "0.0" revision commit))
+    (source
+     (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "git://c9x.me/qbe")
+            (commit commit)))
+      (file-name (git-file-name name version))
+      (patches (search-patches "qbe-makefile-add-target.patch"))
+      (sha256
+       (base32 "1gv03ym0gqrl4wkbhysa82025xwrkr1fg44z814b6vnggwlqgljc"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; Tests require a running qemu
+       #:make-flags ,#~(list (string-append "CC=" #$(cc-for-target))
+                             (string-append "PREFIX=" #$output)
+                             (string-append "TARGET=" #$(or (%current-target-system)
+                                                            (%current-system))))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
+    (synopsis "Simple, straightforward backend compiler")
+    (description "QBE is a compiler backend with the goal of reaching 70% of the
+performance of advanced compilers such as LLVM and GCC in only 10% of the code.")
+    (home-page "https://c9x.me/compile/")
+    (license license:expat))))
-- 
2.36.0





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: patches: Add qbe-makefile-add-target.patch.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (4 preceding siblings ...)
  2022-05-07 17:09 ` [bug#53833] [PATCH] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
@ 2022-05-07 17:11 ` (unmatched-parenthesis via Guix-patches via
  2022-05-07 17:21 ` [bug#53833] [PATCH] gnu: packages: c: Add (unmatched parenthesis copyright statement (unmatched-parenthesis via Guix-patches via
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: (unmatched-parenthesis via Guix-patches via @ 2022-05-07 17:11 UTC (permalink / raw)
  To: 53833; +Cc: (unmatched-parenthesis

* gnu/packages/patches/qbe-makefile-add-target.patch: New variable.

Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
---
 .../patches/qbe-makefile-add-target.patch     | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 gnu/packages/patches/qbe-makefile-add-target.patch

diff --git a/gnu/packages/patches/qbe-makefile-add-target.patch b/gnu/packages/patches/qbe-makefile-add-target.patch
new file mode 100644
index 0000000000..e87559c3fa
--- /dev/null
+++ b/gnu/packages/patches/qbe-makefile-add-target.patch
@@ -0,0 +1,56 @@
+This patch modifies the QBE makefile to add a TARGET variable that allows us to support
+cross-compiling it. We modify the case...esac in the config.h target to use this variable
+instead of TARGET.
+--- a/Makefile
++++ b/Makefile
+@@ -17,6 +17,8 @@ OBJ      = $(SRC:%.c=$(OBJDIR)/%.o) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ)
+ 
+ CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
+ 
++TARGET = unknown
++
+ $(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
+ 	@test -z "$(V)" || echo "ld $@"
+ 	$(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
+@@ -39,26 +41,21 @@ $(RV64OBJ): rv64/all.h
+ $(OBJDIR)/main.o: config.h
+ 
+ config.h:
+-	@case `uname` in                               \
+-	*Darwin*)                                      \
+-		echo "#define Defasm Gasmacho";        \
+-		echo "#define Deftgt T_amd64_sysv";    \
+-		;;                                     \
+-	*)                                             \
+-		echo "#define Defasm Gaself";          \
+-		case `uname -m` in                     \
+-		*aarch64*)                             \
+-			echo "#define Deftgt T_arm64"; \
+-			;;                             \
+-		*riscv64*)                             \
+-			echo "#define Deftgt T_rv64";  \
+-			;;                             \
+-		*)                                     \
+-			echo "#define Deftgt T_amd64_sysv";\
+-			;;                             \
+-		esac                                   \
+-		;;                                     \
+-	esac > $@
++	@echo "#define Defasm Gaself" >> $@
++	@case $(TARGET) in \
++	*x86_64*) \
++		echo "#define Deftgt T_amd64_sysv"; \
++		;; \
++	*aarch64*) \
++		echo "#define Deftgt T_arm64"; \
++		;; \
++	*riscv64*) \
++		echo "#define Deftgt T_rv64"; \
++		;; \
++	*) \
++		echo "#error target not set to x86_64, aarch64, or riscv64 in makefile"; \
++		;; \
++	esac >> $@
+ 
+ install: $(OBJDIR)/$(BIN)
+ 	mkdir -p "$(DESTDIR)/$(PREFIX)/bin/"
-- 
2.36.0





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH] gnu: packages: c: Add (unmatched parenthesis copyright statement.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (5 preceding siblings ...)
  2022-05-07 17:11 ` [bug#53833] [PATCH] gnu: patches: Add qbe-makefile-add-target.patch (unmatched-parenthesis via Guix-patches via
@ 2022-05-07 17:21 ` (unmatched-parenthesis via Guix-patches via
  2022-05-07 18:19 ` [bug#53833] Upstreaming QBE and cproc paren--- via Guix-patches via
  2022-05-08 20:21 ` [bug#53833] [PATCH v2] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
  8 siblings, 0 replies; 14+ messages in thread
From: (unmatched-parenthesis via Guix-patches via @ 2022-05-07 17:21 UTC (permalink / raw)
  To: 53833; +Cc: (unmatched-parenthesis

* gnu/packages/c.scm: Add my copyright line.

Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
---
I forgot to add my copyright AGAIN /o\ I am extremely absent-minded :P

 gnu/packages/c.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e03ea2e6eb..1477734718 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2021 David Dashyan <mail@davie.li>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
-- 
2.36.0





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#53833] Upstreaming QBE and cproc
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (6 preceding siblings ...)
  2022-05-07 17:21 ` [bug#53833] [PATCH] gnu: packages: c: Add (unmatched parenthesis copyright statement (unmatched-parenthesis via Guix-patches via
@ 2022-05-07 18:19 ` paren--- via Guix-patches via
  2022-05-08 20:21 ` [bug#53833] [PATCH v2] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
  8 siblings, 0 replies; 14+ messages in thread
From: paren--- via Guix-patches via @ 2022-05-07 18:19 UTC (permalink / raw)
  To: 53833

I just noticed that the QBE makefile patch contains a mistake in the description:

> This patch modifies the QBE makefile to add a TARGET variable that allows us to support
> cross-compiling it. We modify the case...esac in the config.h target to use this variable
> instead of TARGET.

"instead of TARGET" should be "instead of uname". I can't really see much point in submitting a whole v2 patch for that, especially since i've already made further adjustments to the c.scm file for cproc, so could whoever merges this change that please? Thanks!




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH v2] gnu: Add qbe.
  2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
                   ` (7 preceding siblings ...)
  2022-05-07 18:19 ` [bug#53833] Upstreaming QBE and cproc paren--- via Guix-patches via
@ 2022-05-08 20:21 ` (unmatched-parenthesis via Guix-patches via
  2022-05-24  6:50   ` Liliana Marie Prikler
  8 siblings, 1 reply; 14+ messages in thread
From: (unmatched-parenthesis via Guix-patches via @ 2022-05-08 20:21 UTC (permalink / raw)
  To: 53833; +Cc: (unmatched-parenthesis

* gnu/packages/c.scm (qbe): New variable.

Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
---
This improved patch (1) squashes the three commits together, (2) enables
tests for QBE, and (3) fixes some style nits.

Thanks to lilyp for feedback on #guix!

 gnu/packages/c.scm | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index da034d5fd9..c9a25eb801 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2021 David Dashyan <mail@davie.li>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1064,3 +1065,46 @@ (define-public utf8-h
 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 qbe
+  (let ((commit "2caa26e388b1c904d2f12fb09f84df7e761d8331")
+        (revision "1"))
+   (package
+    (name "qbe")
+    (version (git-version "0.0" revision commit))
+    (source
+     (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "git://c9x.me/qbe")
+            (commit commit)))
+      (file-name (git-file-name name version))
+      (sha256
+       (base32 "1gv03ym0gqrl4wkbhysa82025xwrkr1fg44z814b6vnggwlqgljc"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:make-flags
+           #~(list (string-append "CC=" #$(cc-for-target))
+                   (string-append "PREFIX=" #$output)
+                   ;; `GUIXTARGET` is used instead of `TARGET` to avoid changing
+                   ;; the meaning of tools/test.sh (which uses `TARGET` too).
+                   (string-append "GUIXTARGET=" #$(or (%current-target-system)
+                                                      (%current-system))))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'allow-cross-compilation
+                 (lambda _
+                   (substitute* "Makefile"
+                     (("`uname -m`") "$(GUIXTARGET)"))))
+               (add-after 'allow-cross-compilation 'use-gcc-for-tests
+                 (lambda _
+                   (substitute* "tools/test.sh"
+                     (("cc=\"cc -no-pie\"")
+                      (string-append "cc=\"${CC} -no-pie\"")))))
+               (delete 'configure))))
+    (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
+    (synopsis "Simple compiler backend")
+    (description "QBE is a small compiler backend using an SSA-based intermediate
+language as input.")
+    (home-page "https://c9x.me/compile/")
+    (license license:expat))))
-- 
2.36.0





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#53833] [PATCH v2] gnu: Add qbe.
  2022-05-08 20:21 ` [bug#53833] [PATCH v2] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
@ 2022-05-24  6:50   ` Liliana Marie Prikler
  2022-05-24 19:44     ` bug#53833: " Liliana Marie Prikler
  0 siblings, 1 reply; 14+ messages in thread
From: Liliana Marie Prikler @ 2022-05-24  6:50 UTC (permalink / raw)
  To: (unmatched-parenthesis, 53833

Hi, this is mostly a reminder for myself to push this soon.

Am Sonntag, dem 08.05.2022 um 21:21 +0100 schrieb (unmatched-
parenthesis:
> * gnu/packages/c.scm (qbe): New variable.
> 
> Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
Don't add sign-off headers for your own patches, those are for
committers signing of other people's patches :)

> [...]
> +    (arguments
> +     (list #:make-flags
> +           #~(list (string-append "CC=" #$(cc-for-target))
> +                   (string-append "PREFIX=" #$output)
> +                   ;; `GUIXTARGET` is used instead of `TARGET` to
> avoid changing
> +                   ;; the meaning of tools/test.sh (which uses
> `TARGET` too).
> +                   (string-append "GUIXTARGET=" #$(or (%current-
> target-system)
> +                                                      (%current-
> system))))
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'allow-cross-compilation
> +                 (lambda _
> +                   (substitute* "Makefile"
> +                     (("`uname -m`") "$(GUIXTARGET)"))))
Instead of going through the variable, why not inline it into the
substitute*?
> +               (add-after 'allow-cross-compilation 'use-gcc-for-
> tests
> +                 (lambda _
> +                   (substitute* "tools/test.sh"
> +                     (("cc=\"cc -no-pie\"")
> +                      (string-append "cc=\"${CC} -no-pie\"")))))
> +               (delete 'configure))))
> +    (supported-systems (list "x86_64-linux" "aarch64-linux"
> "riscv64-linux"))
> +    (synopsis "Simple compiler backend")
> +    (description "QBE is a small compiler backend using an SSA-based
> intermediate
> +language as input.")
> +    (home-page "https://c9x.me/compile/")
> +    (license license:expat))))

Otherwise LGTM.

Cheers




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#53833: [PATCH v2] gnu: Add qbe.
  2022-05-24  6:50   ` Liliana Marie Prikler
@ 2022-05-24 19:44     ` Liliana Marie Prikler
  0 siblings, 0 replies; 14+ messages in thread
From: Liliana Marie Prikler @ 2022-05-24 19:44 UTC (permalink / raw)
  To: (unmatched-parenthesis, 53833-done

Am Dienstag, dem 24.05.2022 um 08:50 +0200 schrieb Liliana Marie
Prikler:
> Hi, this is mostly a reminder for myself to push this soon.
> 
> Am Sonntag, dem 08.05.2022 um 21:21 +0100 schrieb (unmatched-
> parenthesis:
> > * gnu/packages/c.scm (qbe): New variable.
> > 
> > Signed-off-by: (unmatched-parenthesis <paren@disroot.org>
> Don't add sign-off headers for your own patches, those are for
> committers signing of other people's patches :)
> 
> > [...]
> > +    (arguments
> > +     (list #:make-flags
> > +           #~(list (string-append "CC=" #$(cc-for-target))
> > +                   (string-append "PREFIX=" #$output)
> > +                   ;; `GUIXTARGET` is used instead of `TARGET` to
> > avoid changing
> > +                   ;; the meaning of tools/test.sh (which uses
> > `TARGET` too).
> > +                   (string-append "GUIXTARGET=" #$(or (%current-
> > target-system)
> > +                                                      (%current-
> > system))))
> > +           #:phases
> > +           #~(modify-phases %standard-phases
> > +               (add-after 'unpack 'allow-cross-compilation
> > +                 (lambda _
> > +                   (substitute* "Makefile"
> > +                     (("`uname -m`") "$(GUIXTARGET)"))))
> Instead of going through the variable, why not inline it into the
> substitute*?
> > +               (add-after 'allow-cross-compilation 'use-gcc-for-
> > tests
> > +                 (lambda _
> > +                   (substitute* "tools/test.sh"
> > +                     (("cc=\"cc -no-pie\"")
> > +                      (string-append "cc=\"${CC} -no-pie\"")))))
> > +               (delete 'configure))))
> > +    (supported-systems (list "x86_64-linux" "aarch64-linux"
> > "riscv64-linux"))
> > +    (synopsis "Simple compiler backend")
> > +    (description "QBE is a small compiler backend using an SSA-
> > based
> > intermediate
> > +language as input.")
> > +    (home-page "https://c9x.me/compile/")
> > +    (license license:expat))))
> 
> Otherwise LGTM.
Applied with the above as well as my liberal interpretation of what
passes as `guix style'.

Cheers




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-05-24 19:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07  1:13 [bug#53833] [PATCH] gnu: Add qbe jgart via Guix-patches via
2022-02-07  9:47 ` Liliana Marie Prikler
2022-02-08 21:10   ` jgart via Guix-patches via
2022-04-05 16:11     ` bug#53833: " Ludovic Courtès
2022-04-25 20:08 ` [bug#53833] " paren--- via Guix-patches via
2022-04-26 18:16 ` paren--- via Guix-patches via
2022-05-07 16:34 ` [bug#53833] QBE and cproc upstreaming paren--- via Guix-patches via
2022-05-07 17:09 ` [bug#53833] [PATCH] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
2022-05-07 17:11 ` [bug#53833] [PATCH] gnu: patches: Add qbe-makefile-add-target.patch (unmatched-parenthesis via Guix-patches via
2022-05-07 17:21 ` [bug#53833] [PATCH] gnu: packages: c: Add (unmatched parenthesis copyright statement (unmatched-parenthesis via Guix-patches via
2022-05-07 18:19 ` [bug#53833] Upstreaming QBE and cproc paren--- via Guix-patches via
2022-05-08 20:21 ` [bug#53833] [PATCH v2] gnu: Add qbe (unmatched-parenthesis via Guix-patches via
2022-05-24  6:50   ` Liliana Marie Prikler
2022-05-24 19:44     ` bug#53833: " Liliana Marie Prikler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).