;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2020 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages dotgnu) #:use-module (guix build-system gnu) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages assembly) #:use-module (gnu packages autotools) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages bison) #:use-module (gnu packages flex)) (define-public treecc (package (name "treecc") (version "0.3.10") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/dotgnu-pnet/" "treecc-" version ".tar.gz")) (sha256 (base32 "1rzgnspg2xccdq3qsx0vi3j28h4qkrzbrjnhzvnny34fjfk217ay")))) (build-system gnu-build-system) (home-page "http://www.gnu.org/software/dotgnu/") (synopsis "Abstract syntax tree compiler compiler") (description "The treecc program is designed to assist in the development 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+))) (define-public pnet (package (name "pnet") (version "0.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/dotgnu-pnet/pnet-" version ".tar.gz")) (sha256 (base32 "1fsi8nkgvawjib2n4kyygfhfr31637bin84xkmr0apvsavihld7i")) (modules '((guix build utils))) (snippet #~(begin (for-each delete-file-recursively '("libffi" "libgc")) (for-each delete-file '("compile" "configure" "config.guess" "config.sub" "depcomp" "install-sh" "ltconfig" "ltcf-c.sh" "ltmain.sh")) (for-each delete-file (find-files "." "Makefile\\.in$")) (for-each delete-file (find-files "." "_grammar\\.(c|h)$")) (for-each delete-file (find-files "." "_scanner\\.(c|h)$")) ; Fix to not require bundled dependencies (substitute* "configure.in" (("FFILIBS='.*libffi.a'") "FFILIBS='-lffi'") (("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 ") (("#include .*/libgc/include/gc_typed.h.") "#include ")) (substitute* "support/thread.c" ; Maybe GC_CreateThread can be used as replacement? (("result = GC_run_thread.*;") "result = thread_func(arg);")) (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))))))) (build-system gnu-build-system) (native-inputs (list autoconf automake bison flex libtool libatomic-ops treecc)) (inputs (list libgc libgc-all-headers libjit)) (arguments (list #:configure-flags #~(list (string-append "CPPFLAGS=-I" #$(this-package-input "libgc") "/include/gc" " -I" #$(this-package-input "libgc-all-headers") "/include/private") "--with-jit"))) (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+))) (define-public pnetlib (package (name "pnetlib") (version "0.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/dotgnu-pnet/pnetlib-" version ".tar.gz")) (sha256 (base32 "1adr5nyrx6ip3rlcilr5kyahw11bpzj1ijb5zdjpn2lvn218ksms")) (modules '((guix build utils))) (snippet #~(begin (for-each delete-file '("configure" "config.guess" "config.sub" "install-sh" "ltmain.sh")) (for-each delete-file (find-files "." "Makefile\\.in")) (substitute* "tests/runtime/Makefile.am" (("TESTS_ENVIRONMENT.*") (string-append "LOG_COMPILER = $(SHELL)\n" "AM_LOG_FLAGS = $(top_builddir)/tools/run_test.sh" " $(top_builddir)"))) (substitute* "tools/run_test.sh.in" (("en_US") "en_US.utf8")) (substitute* "tools/wrapper.sh.in" (("exec .LN_S clrwrap ..1." all) (string-append "echo '#!@SHELL@' >> $1\n" "echo exec $CLRWRAP" " $(dirname $(dirname $1))" "/lib/cscc/lib/$(basename $1).exe '$*' >> $1\n" "chmod +x $1"))))))) (build-system gnu-build-system) (arguments (list #:tests? #f)) ; 4 tests fail (native-inputs (list autoconf automake libtool treecc)) (inputs (list pnet)) (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html") (synopsis "Libraries for the C# programming language") (description "DotGNU Portable.NET Library contains an implementation of the C# library, for use with .NET-capable runtime engines and applications.") (license license:gpl2+)))