diff mbox series

[bug#57625] WIP: gnu: Add pnet.

Message ID d9c91744-9f26-3f87-c054-d2f9105bd685@disroot.org
State New
Headers show
Series [bug#57625] WIP: gnu: Add pnet. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Adam Faiz Sept. 6, 2022, 3:53 p.m. UTC
From c1283813b73f0fd076f4007851d25db99ee2fe7a Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 6 Sep 2022 16:04:09 +0800
Subject: [PATCH 3/3] WIP: gnu: Add pnet.

* gnu/packages/dotgnu.scm (pnet): New variable.
---
  gnu/packages/dotgnu.scm | 66 +++++++++++++++++++++++++++++++++++++++++
  1 file changed, 66 insertions(+)

+                     ; Maybe GC_CreateThread can be used as replacement?
+                     (("result = GC_run_thread.*;")
+                      "result = thread_func(arg);")))))))
+    (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html")
+    (synopsis "Bootstrap compiler and libraries for the C# programming 
language")
+    (description
+     "The goal of this project is to build a suite of Free Software tools
+to build and execute .NET applications, including a C# compiler,
+assembler, disassembler, and runtime engine.  The initial target
+platform is GNU/Linux, with other platforms to follow in the future.")
+    (license license:gpl2+)))

Comments

M Sept. 6, 2022, 5:23 p.m. UTC | #1
On 06-09-2022 17:53, Adam Faiz via Guix-patches via wrote:
> From c1283813b73f0fd076f4007851d25db99ee2fe7a Mon Sep 17 00:00:00 2001
> From: AwesomeAdam54321 <adam.faiz@disroot.org>
> Date: Tue, 6 Sep 2022 16:04:09 +0800
> Subject: [PATCH 3/3] WIP: gnu: Add pnet.
>
> * gnu/packages/dotgnu.scm (pnet): New variable.
> ---
>  gnu/packages/dotgnu.scm | 66 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
>
> diff --git a/gnu/packages/dotgnu.scm b/gnu/packages/dotgnu.scm
> index 14e11b3653..976c4f1f15 100644
> --- a/gnu/packages/dotgnu.scm
> +++ b/gnu/packages/dotgnu.scm
> @@ -50,3 +50,69 @@ (define-public treecc
>  and other language-based tools.  It manages the generation of code to 
> handle
>  abstract syntax trees and operations upon the trees.")
>      (license license:gpl2+)))
> +
> +(define-public pnet
> +  (package
> +    (name "pnet")
> +    (version "0.8.0")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> + "https://download.savannah.gnu.org/releases/dotgnu-pnet/pnet-"
> +                    version ".tar.gz"))
> +              (sha256
> +               (base32
> + "1fsi8nkgvawjib2n4kyygfhfr31637bin84xkmr0apvsavihld7i"))))
> +    (build-system gnu-build-system)
> +    (native-inputs (list automake autoconf libatomic-ops))
> +    (inputs (list treecc libffi libgc libgc-private-headers-for-pnet))
> +    (arguments
> +     (list #:configure-flags
> +           #~(list
> +              (string-append "CPPFLAGS=-I" #$libffi "/include/ffi"
> +                             " -I" #$libgc "/include/gc"
> +                             " -I" #$libgc-private-headers-for-pnet 
> "/include/private"))

Do #$(this-package-input "libgc") instead of #$libgc. That way, package 
transformations can take effect. Likewise for 
libgc-private-headers-for-pnet.

> + #:make-flags
> +           #~(list (string-append "GCLIBS=")) ; libgc is already in 
> the linker path
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'unbundle-dependencies
> +                 (lambda _
> +                   (for-each delete-file-recursively '("libffi" 
> "libgc"))))

Move this delete-file-recursively two to a source snippet. From 
(guix)Snippets versus Phases:

> Origin snippets are
> typically used to remove unwanted files such as bundled libraries, [...]

> + (add-before 'configure 'fix-makefile
> +                 (lambda _
> +                   (substitute* "configure.in" ; Fix missing 
> reference to RANLIB
> +                     (("AC_PROG_MAKE_SET")
> +                      "AC_PROG_MAKE_SET\nAC_PROG_RANLIB"))
> +                   (substitute* "Makefile.am" ; Fix to not require 
> bundled dependencies
> +                     (("OPT_SUBDIRS \\+= lib.*") ""))
> +                   ; Fix bug where codegen/*.c files aren't compiled 
> in install
> +                   (substitute* "codegen/Makefile.in"
> +                     (("$(MAKE) $(AM_MAKEFLAGS) install-am")
> +                      "$(MAKE) $(AM_MAKEFLAGS) install-am\n\t.c.o 
> $(TREECC_SRCOUT)"))
> +                   (invoke "autoconf")
> +                   (invoke "aclocal")
> +                   (invoke "automake" "--add-missing")
> +                   (invoke "automake")))

This can be simplified -- after the 'unpack' phase, insert a phase that 
deletes 'configure'. Another phase will automatically call autoconf and 
the rest. Even better would be to delete it in a snippet, to avoid the 
result of "guix build --source" containing non-source code.

If you do that, you might as well remove 'compile', 'compile.guess', 
'depcomp', 'install-sh', 'ltconfig', 'Makefile.in', 'ltcf-c.sh', 
'ltmain.sh' too. There are also various Makefile.in in subdirectories, 
you can find them with (find-files "." "Makefile\\.in").

> + (add-before 'build 'fix-headers
> +                 (lambda _
> +                   (substitute* "support/hb_gc.c"
> +                     (("#include .*/libgc/include/gc.h.") "#include 
> <gc.h>")
> +                     (("#include .*/libgc/include/gc_typed.h.") 
> "#include <gc_typed.h>"))
> +                   (substitute* "support/pt_defs.c"
> +                     (("#include <errno.h>")
> +                      "#include <errno.h>\n#include 
> <gc_pthread_redirects.h>"))))
> +               (add-after 'fix-headers 'replace-removed-libgc-function
> +                 (lambda _
> +                   (substitute* "support/thread.c"
> +                     ; Maybe GC_CreateThread can be used as replacement?
> +                     (("result = GC_run_thread.*;")
> +                      "result = thread_func(arg);")))))))

If my proposal of deleting libffi and libgc in a snippet is followed, 
then I think these substitutions (and the change to codegen/Makefile.in, 
Makefile.am and configure.in) should be moved as well to the snippet. 
 From (guix)Snippets versus Phases:

> The source derived
> from an origin (*) should produce a source that can be used to build the
> package on any system that the upstream package supports (i.e., act as
> the corresponding source).
(*): this is the result of "./pre-inst-env guix build --source pnet"

> + (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html")
> +    (synopsis "Bootstrap compiler and libraries for the C# 
> programming language")
Where can I find the information that it's a 'Bootstrap compiler' and 
not just a compiler?
> + (description
> +     "The goal of this project is to build a suite of Free Software 
> tools
Why is 'free sofware' capitalised?
> +to build and execute .NET applications, including a C# compiler,
> +assembler, disassembler, and runtime engine.  The initial target
> +platform is GNU/Linux, with other platforms to follow in the future.")

Given that DotGNU has been decommissioned, I think the future goals 
aren't relevant anymore. How about:

"DotGNU Portable.NET is an implementation of .NET.  It can build and execute
.NET applications, including a C# compiler, assembler, disassembler,
and runtime engine."

instead?  If it turns out it doesn't support GNU/Hurd, we have a 
'supported-systems' field to encode that information in, duplicating it 
in the description in unnecessary.

> + (license license:gpl2+)))

Greetings,
Maxime
diff mbox series

Patch

diff --git a/gnu/packages/dotgnu.scm b/gnu/packages/dotgnu.scm
index 14e11b3653..976c4f1f15 100644
--- a/gnu/packages/dotgnu.scm
+++ b/gnu/packages/dotgnu.scm
@@ -50,3 +50,69 @@  (define-public treecc
  and other language-based tools.  It manages the generation of code to 
handle
  abstract syntax trees and operations upon the trees.")
      (license license:gpl2+)))
+
+(define-public pnet
+  (package
+    (name "pnet")
+    (version "0.8.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+ 
"https://download.savannah.gnu.org/releases/dotgnu-pnet/pnet-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "1fsi8nkgvawjib2n4kyygfhfr31637bin84xkmr0apvsavihld7i"))))
+    (build-system gnu-build-system)
+    (native-inputs (list automake autoconf libatomic-ops))
+    (inputs (list treecc libffi libgc libgc-private-headers-for-pnet))
+    (arguments
+     (list #:configure-flags
+           #~(list
+              (string-append "CPPFLAGS=-I" #$libffi "/include/ffi"
+                             " -I" #$libgc "/include/gc"
+                             " -I" #$libgc-private-headers-for-pnet 
"/include/private"))
+           #:make-flags
+           #~(list (string-append "GCLIBS=")) ; libgc is already in the 
linker path
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'unbundle-dependencies
+                 (lambda _
+                   (for-each delete-file-recursively '("libffi" "libgc"))))
+               (add-before 'configure 'fix-makefile
+                 (lambda _
+                   (substitute* "configure.in" ; Fix missing reference 
to RANLIB
+                     (("AC_PROG_MAKE_SET")
+                      "AC_PROG_MAKE_SET\nAC_PROG_RANLIB"))
+                   (substitute* "Makefile.am" ; Fix to not require 
bundled dependencies
+                     (("OPT_SUBDIRS \\+= lib.*") ""))
+                   ; Fix bug where codegen/*.c files aren't compiled in 
install
+                   (substitute* "codegen/Makefile.in"
+                     (("$(MAKE) $(AM_MAKEFLAGS) install-am")
+                      "$(MAKE) $(AM_MAKEFLAGS) install-am\n\t.c.o 
$(TREECC_SRCOUT)"))
+                   (invoke "autoconf")
+                   (invoke "aclocal")
+                   (invoke "automake" "--add-missing")
+                   (invoke "automake")))
+               (add-before 'build 'fix-headers
+                 (lambda _
+                   (substitute* "support/hb_gc.c"
+                     (("#include .*/libgc/include/gc.h.") "#include 
<gc.h>")
+                     (("#include .*/libgc/include/gc_typed.h.") 
"#include <gc_typed.h>"))
+                   (substitute* "support/pt_defs.c"
+                     (("#include <errno.h>")
+                      "#include <errno.h>\n#include 
<gc_pthread_redirects.h>"))))
+               (add-after 'fix-headers 'replace-removed-libgc-function
+                 (lambda _
+                   (substitute* "support/thread.c"