summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunmush <[email protected]>2024-11-26 12:44:56 +0200
committerEfraim Flashner <[email protected]>2024-12-22 15:37:33 +0200
commit1b1e9917ad043ac279bd829cd8ac6a842667f648 (patch)
tree2d1352b87a75ef566387a9242907596d1d78cafc
parentf2098a776afff1deb23c5cbcd2c2d80278b9a208 (diff)
gnu: Add pnet-git.
* gnu/packages/dotnet.scm (pnet-git): New variable. * gnu/packages/patches/pnet-fix-line-number-info.patch, gnu/packages/patches/pnet-fix-off-by-one.patch, gnu/packages/patches/pnet-newer-libgc-fix.patch, gnu/packages/patches/pnet-newer-texinfo-fix.patch: New patches. * gnu/local.mk (dist_patch_DATA): Register new patches. Signed-off-by: Efraim Flashner <[email protected]> Change-Id: Ic3e93dbaab24eb73fe9a35f711a710eed6a823a1
-rw-r--r--gnu/local.mk4
-rw-r--r--gnu/packages/dotnet.scm116
-rw-r--r--gnu/packages/patches/pnet-fix-line-number-info.patch13
-rw-r--r--gnu/packages/patches/pnet-fix-off-by-one.patch13
-rw-r--r--gnu/packages/patches/pnet-newer-libgc-fix.patch45
-rw-r--r--gnu/packages/patches/pnet-newer-texinfo-fix.patch13
6 files changed, 204 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 745290840b..6c042c576f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1927,6 +1927,10 @@ dist_patch_DATA = \
%D%/packages/patches/owncloud-disable-updatecheck.patch \
%D%/packages/patches/p7zip-CVE-2016-9296.patch \
%D%/packages/patches/p7zip-CVE-2017-17969.patch \
+ %D%/packages/patches/pnet-fix-line-number-info.patch \
+ %D%/packages/patches/pnet-fix-off-by-one.patch \
+ %D%/packages/patches/pnet-newer-libgc-fix.patch \
+ %D%/packages/patches/pnet-newer-texinfo-fix.patch \
%D%/packages/patches/p7zip-fix-build-with-gcc-11.patch \
%D%/packages/patches/p7zip-remove-unused-code.patch \
%D%/packages/patches/pam-krb5-CVE-2020-10595.patch \
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm
index e085b364e2..5c281087a0 100644
--- a/gnu/packages/dotnet.scm
+++ b/gnu/packages/dotnet.scm
@@ -60,3 +60,119 @@
of compilers and other language-based tools. It manages the generation of
code to handle abstract syntax trees and operations upon the trees.")
(license license:gpl2+)))
+
+;; Several improvements occurred past the 0.8.0 release that make it
+;; easier to bootstrap mono.
+(define-public pnet-git
+ (let ((commit "3baf94734d8dc3fdabba68a8891e67a43ed6c4bd")
+ (version "0.8.0")
+ (revision "0"))
+ (package
+ (name "pnet-git")
+ (version (git-version version revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://git.savannah.gnu.org/git/dotgnu-pnet/pnet.git")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0vznvrgz8l0mpib1rz5v3clr7cn570vyp80f7f1jvzivnc1imzn6"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ (for-each delete-file-recursively '("libffi" "libgc"))
+ (for-each delete-file
+ (append
+ (filter file-exists?
+ '("compile"
+ "configure"
+ "config.guess"
+ "config.sub"
+ "depcomp"
+ "install-sh"
+ "ltconfig"
+ "ltcf-c.sh"
+ "ltmain.sh"))
+ (find-files "." "Makefile(\\.in)?$")
+ (find-files "." "_(grammar|scanner)\\.(c|h)$")))
+ ;; Fix to not require bundled dependencies
+ (substitute* "configure.in"
+ (("GCLIBS='.*libgc.a'") "GCLIBS='-lgc'")
+ ;; AC_SEARCH_LIBJIT checks hardcoded header locations
+ (("search_libjit=true")
+ (string-append "search_libjit=false\n"
+ "JIT_LIBS=-ljit")))
+ (substitute* "Makefile.am"
+ (("OPT_SUBDIRS \\+= lib.*") ""))
+ (substitute* "support/hb_gc.c"
+ (("#include .*/libgc/include/gc.h.")
+ "#include <gc.h>")
+ (("#include .*/libgc/include/gc_typed.h.")
+ "#include <gc/gc_typed.h>"))
+ (substitute* (list "codegen/Makefile.am"
+ "cscc/bf/Makefile.am"
+ "cscc/csharp/Makefile.am"
+ "cscc/c/Makefile.am"
+ "cscc/java/Makefile.am")
+ ;; Generated files aren't prerequisites
+ (("TREECC_OUTPUT =.*") ""))
+ (substitute* "cscc/csharp/cs_grammar.y"
+ (("YYLEX") "yylex()"))
+ (substitute* "cscc/common/cc_main.h"
+ (("CCPreProc CCPreProcessorStream;" all)
+ (string-append "extern " all)))
+ (substitute* "csdoc/scanner.c"
+ (("int\ttoken;" all)
+ (string-append "extern " all)))
+ (substitute* "doc/cvmdoc.py"
+ (("python1.5")
+ "python"))
+ (substitute* "profiles/full"
+ ;; If this is left unmodified, it causes a segfault in
+ ;; pnetlib's tests. Unrollers are somewhat
+ ;; architecture-specific anyway, and it will fall back
+ ;; to using GNU C's labels-as-values feature (it can be
+ ;; made to further fall back to fully
+ ;; standards-portable interpreter implementations).
+ (("IL_CONFIG_UNROLL=y")
+ "IL_CONFIG_UNROLL=n"))))
+ (patches (search-patches "pnet-newer-libgc-fix.patch"
+ "pnet-newer-texinfo-fix.patch"
+ "pnet-fix-line-number-info.patch"
+ "pnet-fix-off-by-one.patch"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ (list autoconf
+ automake
+ bison
+ flex
+ libatomic-ops
+ libtool
+ python-minimal-wrapper
+ texinfo
+ treecc))
+ (inputs
+ (cons* libffi
+ libgc
+ (if (supported-package? libjit)
+ (list libjit)
+ '())))
+ (arguments
+ (append (if (this-package-input "libjit")
+ (list #:configure-flags #~(list "--with-jit"))
+ '())
+ (list #:make-flags
+ #~(list "CFLAGS=-O2 -g -Wno-pointer-to-int-cast"))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CSCC_LIB_PATH")
+ (files (list "lib/cscc/lib")))))
+ (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html")
+ (synopsis "Compiler 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.")
+ (license license:gpl2+))))
diff --git a/gnu/packages/patches/pnet-fix-line-number-info.patch b/gnu/packages/patches/pnet-fix-line-number-info.patch
new file mode 100644
index 0000000000..9e5af84941
--- /dev/null
+++ b/gnu/packages/patches/pnet-fix-line-number-info.patch
@@ -0,0 +1,13 @@
+diff --git a/codegen/cg_coerce.c b/codegen/cg_coerce.c
+index 92d2f59a..c90ad5e2 100644
+--- a/codegen/cg_coerce.c
++++ b/codegen/cg_coerce.c
+@@ -1203,6 +1203,8 @@ int ILCoerce(ILGenInfo *info, ILNode *node, ILNode **parent,
+ != ILMachineType_Void)
+ {
+ *parent = ILNode_CastSimple_create(node, constType);
++ yysetfilename(*parent, yygetfilename(node));
++ yysetlinenum(*parent, yygetlinenum(node));
+ return 1;
+ }
+ else if(indirect && GetIndirectConvertRules(info,fromType,toType,0,
diff --git a/gnu/packages/patches/pnet-fix-off-by-one.patch b/gnu/packages/patches/pnet-fix-off-by-one.patch
new file mode 100644
index 0000000000..858d226697
--- /dev/null
+++ b/gnu/packages/patches/pnet-fix-off-by-one.patch
@@ -0,0 +1,13 @@
+diff --git a/codegen/cg_genattr.c b/codegen/cg_genattr.c
+index 535852da..c3acc0dc 100644
+--- a/codegen/cg_genattr.c
++++ b/codegen/cg_genattr.c
+@@ -1532,7 +1532,7 @@ static int MarshalAsAttribute(ILGenInfo *info,
+ else
+ {
+ sizeParamIndex = attributeInfo->namedArgs[currentNamedArg].evalValue.un.i4Value;
+- if(sizeParamIndex <= 0)
++ if(sizeParamIndex < 0)
+ {
+ CGErrorForNode(info, attributeInfo->namedArgs[currentNamedArg].node,
+ _("The size parameter index must be >= 0"));
diff --git a/gnu/packages/patches/pnet-newer-libgc-fix.patch b/gnu/packages/patches/pnet-newer-libgc-fix.patch
new file mode 100644
index 0000000000..1084b5a5be
--- /dev/null
+++ b/gnu/packages/patches/pnet-newer-libgc-fix.patch
@@ -0,0 +1,45 @@
+diff --git a/support/hb_gc.c b/support/hb_gc.c
+index a5addb2d..41126963 100644
+--- a/support/hb_gc.c
++++ b/support/hb_gc.c
+@@ -104,12 +104,6 @@ static volatile int _FinalizersRunningSynchronously = 0;
+ #define GC_TRACE(a, b)
+ #endif
+
+-/*
+- * This is a internal global variable with the number of reclaimed bytes
+- * after a garbage collection.
+- */
+-extern GC_signed_word GC_bytes_found;
+-
+ /*
+ * Main entry point for the finalizer thread.
+ */
+@@ -432,6 +426,7 @@ int ILGCFullCollection(int timeout)
+ {
+ int lastFinalizingCount;
+ int hasThreads;
++ struct GC_prof_stats_s stats;
+
+ hasThreads = _ILHasThreads();
+
+@@ -462,7 +457,8 @@ int ILGCFullCollection(int timeout)
+ GC_TRACE("Last finalizingCount = %i\n", lastFinalizingCount);
+
+ GC_gcollect();
+- bytesCollected = GC_bytes_found;
++ GC_get_prof_stats(&stats, sizeof(stats));
++ bytesCollected = stats.bytes_reclaimed_since_gc;
+
+ GC_TRACE("GC: bytes collected = %i\n", bytesCollected);
+
+@@ -516,7 +512,8 @@ int ILGCFullCollection(int timeout)
+ GC_TRACE("Last finalizingCount = %i\n", lastFinalizingCount);
+
+ GC_gcollect();
+- bytesCollected = GC_bytes_found;
++ GC_get_prof_stats(&stats, sizeof(stats));
++ bytesCollected = stats.bytes_reclaimed_since_gc;
+
+ GC_TRACE("GC: bytes collected = %i\n", bytesCollected);
+
diff --git a/gnu/packages/patches/pnet-newer-texinfo-fix.patch b/gnu/packages/patches/pnet-newer-texinfo-fix.patch
new file mode 100644
index 0000000000..b57052eeea
--- /dev/null
+++ b/gnu/packages/patches/pnet-newer-texinfo-fix.patch
@@ -0,0 +1,13 @@
+diff --git a/doc/pnettools.texi b/doc/pnettools.texi
+index 916d90bb..cdbe05cf 100644
+--- a/doc/pnettools.texi
++++ b/doc/pnettools.texi
+@@ -59,7 +59,7 @@ Copyright @copyright{} 2001, 2002, 2003 Southern Storm Software, Pty Ltd
+ @center @titlefont{Portable.NET Development Tools}
+
+ @vskip 0pt plus 1fill
+-@center{Copyright @copyright{} 2001, 2002, 2003 Southern Storm Software, Pty Ltd}
++@center Copyright @copyright{} 2001, 2002, 2003 Southern Storm Software, Pty Ltd
+ @end titlepage
+
+ @c -----------------------------------------------------------------------