From unknown Thu Sep 11 14:10:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26487: Add antlr3 Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Apr 2017 20:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26487 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 26487@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149211641428328 (code B ref -1); Thu, 13 Apr 2017 20:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Apr 2017 20:46:54 +0000 Received: from localhost ([127.0.0.1]:46121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyldh-0007Ml-Ew for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyldf-0007MY-OD for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyldX-0004Pl-Eu for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyldX-0004Ph-AI for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyldU-0000vg-2D for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyldQ-0004Kd-2V for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:36 -0400 Received: from dau94-h03-89-91-205-84.dsl.sta.abo.bbox.fr ([89.91.205.84]:43243 helo=skaro.lepiller.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyldP-0004Ja-62 for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:31 -0400 Received: from localhost (localhost [127.0.0.1]) by skaro.lepiller.eu (Postfix) with ESMTP id CA84681638 for ; Thu, 13 Apr 2017 22:46:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492116387; bh=PutbeiqkaZ/6KUseVCx29kSOlwMCrQPx45wy6krBW08=; h=Date:From:To:Subject:From; b=K5Ca9OvgygO8iLWctGyZyuLquPpSrXi0bXgvLxHhysM/yBkESSIfTRfAXmSSpUzAg 6Otkze/8ho0NQjFH0c5X3DeEcJm0JxPzlFgM+KsuA8x5DU0VgfM0hK6tuxXFx3R52w pw6O0yNI2ZDPKsSbmZtdyPZxA8giTvRlRCyKXaEZJa2ymZY5j76+U+MFumjOmrYx4q JJAz8gYu5KMHilmXDqeRktFNDHc41R78L7FKQ8k5vrb4XJmjL1lY73LWjKxS5clyAa WHhNBvrmRdwsIUxLWtXUSe8+W8jDs/pCTjc98coMcWPBB+qShpZAhcC9ehHyyxqt34 ukoGbFC6SfTfxFFcuIYuRvmUV4ypE4jfULr7z37oNOulI5WS6gSlRG0U+BKpuzhiO+ RgfkcV9gO9R7rq/sCRFiW8DuAUvukUPfeRBR+muKfGQn5PXCErWd3kj0+NNzkN1wgZ XMOId2/Nza1auHiUVn1fgnLerHYX4+xWeAYZZnxmICPm8ulT7H1tNvAuJfWX7LdHyt KdQRmilrpc/5J2WHSVOjvy4Sp8BICTQEFiNq45LzfE5LMlz7K2bL+ID3Whg3v27INH n6G92vm7eU1SwBUhEy7uD7vABjEpJ7aylFX2LgxJxt6jGabnYnemi7bTAk8nKAG3VJ CcL0xgEhtflMOvW94dj3nZQg= X-Virus-Scanned: Debian amavisd-new at lepiller.eu Received: from skaro.lepiller.eu ([127.0.0.1]) by localhost (lepiller.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qOgkfj7JzaVH for ; Thu, 13 Apr 2017 22:46:18 +0200 (CEST) Received: from localhost (89-93-157-164.hfc.dyn.abo.bbox.fr [89.93.157.164]) by skaro.lepiller.eu (Postfix) with ESMTPSA id 64B4A80BB9 for ; Thu, 13 Apr 2017 22:46:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492116377; bh=PutbeiqkaZ/6KUseVCx29kSOlwMCrQPx45wy6krBW08=; h=Date:From:To:Subject:From; b=S7sRQUcisbkc4dmxUfjmBWxu/N3PA1hJQv1Zi74wS0Jk/s72MWhOrItqB3XgCiHdH xGBCSq1wfk8laUEfYh6UiOCbg4pegZNbUp7ckcCEfIefrZWscSsMBG8J5v7aedS8uA cZ7pZnot3HXWMFAe3ID9JgFJFniaxpo0/E+4EWKqKtLpjB6LPESAaiMuHBUPX6h/9e Rv5kVfZ/XrjuGvPAb1PnSTGGFrKPyzU+dnkVaUmPUdvuBN90F5lcq4eqzF8cUB7cmT 8bM30MR/nL0exyewZtXKLkTSkqNsHJH9hcfpRIOHq6B0Y/oLKhcjqatgT/PvGMl5iy UKqnW6KuRMqeJPS4Aj1uaHTZTGyeKA7gQu456zurWZR1jwg0KyT+8ya7Y1Ju7AL67k 5Lp8Leyt2URBh6YRVKOtUuBo8b4qzauSeVaxF7+GI3XkUuNCriw4GGsoe+omKTl2It DzEoxFvJLwOC3O4Yf3frR3SF+bBTAv8wnR793yQjUBfvEuTI759FedAw4sVs9khsOs adCNSsqeZjlhCL0j3lCkJwJevO3zWZVkAsNN9XTijCqsyYP6mGs0WTQsyqRo80M7Xq +e/xemnHJEnPfTzIbS5TaLaOke2Q5vcHT/fXMDI5kIvzdcPzqu1TxuIoFZfpA8Deue Z1mcywnk0hek5HBAQ0cGavHg= Date: Thu, 13 Apr 2017 22:46:13 +0200 From: Julien Lepiller Message-ID: <20170413224513.342184b2@lepiller.eu> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/TDsrR4MB0d3cUZA.49kDqy+" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, here are patches to add antlr3, a parser generator. * 0001-guix-ant-build-system-Add-src-dir-parameter.patch: adds a #:src-dir parameter to the ant-build-system, to change the source directory and possibly specify more than one directory. * 0002-gnu-Add-antlr2.patch: Adds antlr2, an older version of antlr, that is required by antlr3 to generate some of its source files, and because parts of it is used by antlr3 (such as the CommonTree class). * 0003-gnu-Add-stringtemplate3.patch: Adds stringtemplate3, a runtime requirement of antlr3. It is a library to generate strings using templates. * 0004-gnu-Add-antlr3-and-stringtemplate4.patch: a big patch that adds antlr3 and stringtemplate4 (ST4). ST4 is a newer version of ST3, is a runtime dependency of antlr3 and needs antlr3 to generate some of its source files. antlr3 depends on ST4 too. I didn't find a way to split this patch further. I wanted to package antlr4, but I'm still working on its dependencies (antlr3 is one of them). --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-ant-build-system-Add-src-dir-parameter.patch >From 9b82f683a34f9179b18e4b6a04652888ba347c68 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:18:15 +0200 Subject: [PATCH 1/4] guix: ant-build-system: Add src-dir parameter. * guix/build-system/ant.scm (ant-build): Add src-dir parameter. * guix/build/ant-build-system.scm (configure): Add src-dir parameter. (default-build.xml): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 6 +++++- guix/build-system/ant.scm | 2 ++ guix/build/ant-build-system.scm | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 07f52becf..b9dfc03e1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3321,7 +3321,11 @@ parameters, respectively. When the original package does not provide a suitable Ant build file, the parameter @code{#:jar-name} can be used to generate a minimal Ant build file @file{build.xml} with tasks to build the specified jar -archive. +archive. By default, @file{src} will be used as the source directory. +The parameter @code{#:src-dir} can be used to change the default source +directory. This parameter accepts the ant syntax for @code{srcdir} +parameters, allowing to specify more than one directory by separating +each directory with a semicolon (as in @code{"src1:src2"}). The parameter @code{#:build-target} can be used to specify the Ant task that should be run during the @code{build} phase. By default the diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm index 550f92bc7..cd544ad0d 100644 --- a/guix/build-system/ant.scm +++ b/guix/build-system/ant.scm @@ -98,6 +98,7 @@ (make-flags ''()) (build-target "jar") (jar-name #f) + (src-dir "src") (phases '(@ (guix build ant-build-system) %standard-phases)) (outputs '("out")) @@ -126,6 +127,7 @@ #:test-target ,test-target #:build-target ,build-target #:jar-name ,jar-name + #:src-dir ,src-dir #:phases ,phases #:outputs %outputs #:search-paths ',(map search-path-specification->sexp diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm index 00a4a46d8..e2f3d4a9e 100644 --- a/guix/build/ant-build-system.scm +++ b/guix/build/ant-build-system.scm @@ -35,7 +35,7 @@ ;; ;; Code: -(define (default-build.xml jar-name prefix) +(define (default-build.xml jar-name prefix src-dir) "Create a simple build.xml with standard targets for Ant." (call-with-output-file "build.xml" (lambda (port) @@ -58,7 +58,7 @@ (target (@ (name "compile")) (mkdir (@ (dir "${classes.dir}"))) (javac (@ (includeantruntime "false") - (srcdir "src") + (srcdir ,src-dir) (destdir "${classes.dir}") (classpath (@ (refid "classpath")))))) @@ -97,12 +97,13 @@ to the default GNU unpack strategy." ;; Use GNU unpack strategy for things that aren't jar archives. ((assq-ref gnu:%standard-phases 'unpack) #:source source))) -(define* (configure #:key inputs outputs (jar-name #f) +(define* (configure #:key inputs outputs (jar-name #f) (src-dir "src") #:allow-other-keys) (when jar-name (default-build.xml jar-name (string-append (assoc-ref outputs "out") - "/share/java"))) + "/share/java") + src-dir)) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) (setenv "CLASSPATH" (generate-classpath inputs))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-gnu-Add-antlr2.patch >From eaf67c17273bf82faad4aba1105418a9a5c04435 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:03:54 +0200 Subject: [PATCH 2/4] gnu: Add antlr2. * gnu/packages/java.scm (antlr2): New variable. --- gnu/packages/java.scm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 1d18a0b06..fc9e137b8 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1178,3 +1178,45 @@ testing frameworks, mocking libraries and UI validation rules.") JUnit provides assertions for testing expected results, test fixtures for sharing common test data, and test runners for running tests.") (license license:epl1.0))) + +(define-public antlr2 + (package + (name "antlr2") + (version "2.7.7") + (source (origin + (method url-fetch) + (uri (string-append "http://www.antlr2.org/download/antlr-" + version ".tar.gz")) + (sha256 + (base32 + "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5")) + (modules '((guix build utils))) + (snippet + '(begin + (delete-file "antlr.jar") + (substitute* "configure" + (("/bin/sh") "sh")))))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'configure 'fix-bin-ls + (lambda _ + (for-each (lambda (file) + (substitute* file + (("/bin/ls") "ls"))) + (find-files "Makefile"))))))) + (native-inputs + `(("which" ,which) + ("java" ,icedtea "jdk"))) + (inputs + `(("java" ,icedtea))) + (home-page "http://www.antlr2.org") + (synopsis "Framework for constructing recognizers, compilers, and translators") + (description "ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) +is a language tool that provides a framework for constructing recognizers, +compilers, and translators from grammatical descriptions containing Java, C#, +C++, or Python actions. ANTLR provides excellent support for tree construction, +tree walking, and translation.") + (license license:public-domain))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0003-gnu-Add-stringtemplate3.patch >From b9488bf5bea2720a8b320ff7009efef665e4be80 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:13:14 +0200 Subject: [PATCH 3/4] gnu: Add stringtemplate3. * gnu/packages/java.scm (stringtemplate3): New variable. --- gnu/packages/java.scm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index fc9e137b8..15b45a5e5 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1220,3 +1220,41 @@ compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions. ANTLR provides excellent support for tree construction, tree walking, and translation.") (license license:public-domain))) + +(define-public stringtemplate3 + (package + (name "stringtemplate3") + (version "3.2.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/website-st4/raw/" + "gh-pages/download/stringtemplate-" + version ".tar.gz")) + (sha256 + (base32 + "086yj68np1vqhkj7483diz3km6s6y4gmwqswa7524a0ca6vxn2is")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "stringtemplate-3.2.1.jar" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda _ + (let ((dir "src/org/antlr/stringtemplate/language/")) + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr" "-o" dir (string-append dir file))) + '("template.g" "angle.bracket.template.g" "action.g" + "eval.g" "group.g" "interface.g")))))))) + (native-inputs + `(("antlr" ,antlr2))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, emails, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localization. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0004-gnu-Add-antlr3-and-stringtemplate4.patch >From cc621531355e3c77c6fcce32cff53ad294d7b549 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 21:57:33 +0200 Subject: [PATCH 4/4] gnu: Add antlr3 and stringtemplate4. * gnu/packages/java.scm (antlr3, stringtemplate4): New variables. --- gnu/packages/java.scm | 337 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 337 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 15b45a5e5..d3f75731b 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1258,3 +1258,340 @@ or any other formatted text output. StringTemplate is particularly good at code generators, multiple site skins, and internationalization / localization. StringTemplate also powers ANTLR.") (license license:bsd-3))) + +;; antlr3 is partially written using antlr3 grammar files. It also depends on +;; ST4 (stringtemplate4), which is also partially written using antlr3 grammar +;; files and uses antlr3 at runtime. The latest version requires a recent version +;; of antlr3 at runtime. +;; Fortunately, ST4 4.0.6 can be built with an older antlr3, and we use antlr3.3. +;; This version of ST4 is sufficient for the latest antlr3. +;; We use ST4 4.0.6 to build a boostrap antlr3 (latest version), and build +;; the latest ST4 with it. Then we build our final antlr3 that will be linked +;; against the latest ST4. +;; antlr3.3 still depends on antlr3 to generate some files, so we use an +;; even older version, antlr3.1, to generate them. Fortunately antlr3.1 uses +;; only grammar files with the antlr2 syntax. +;; So we build antlr3.1 -> antlr3.3 -> ST4.0.6 -> antlr3-bootstrap -> ST4 -> antlr3. + +(define-public stringtemplate4 + (package + (name "stringtemplate4") + (version "4.0.8") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate4/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "1pri8hqa95rfdkjy55icl5q1m09zwp5k67ib14abas39s4v3w087")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f + #:jar-name (string-append ,name "-" ,version ".jar") + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda* (#:key inputs #:allow-other-keys) + (chdir "src/org/stringtemplate/v4/compiler/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("STParser.g" "Group.g" "CodeGenerator.g")) + (chdir "../../../../..")))))) + (inputs + `(("antlr3" ,antlr3-bootstrap) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, emails, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localization. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) + +(define stringtemplate4-4.0.6 + (package + (inherit stringtemplate4) + (name "stringtemplate4") + (version "4.0.6") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate4/archive/ST-" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0hjmh1ahdsh3w825i67mli9l4nncc4l6hdbf9ma91jvlj590sljp")))) + (inputs + `(("antlr3" ,antlr3-3.3) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))))) + +(define-public antlr3 + (package + (name "antlr3") + (version "3.5.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/antlr3/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "07zff5frmjd53rnqdx31h0pmswz1lv0p2lp28cspfszh25ysz6sj")))) + (build-system ant-build-system) + (arguments + `(#:jar-name (string-append ,name "-" ,version ".jar") + #:src-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/main/antlr3" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'install 'bin-install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((jar (string-append (assoc-ref outputs "out") "/share/java")) + (bin (string-append (assoc-ref outputs "out") "/bin"))) + (mkdir-p bin) + (with-output-to-file (string-append bin "/antlr3") + (lambda _ + (display + (string-append "#!" (which "sh") "\n" + "java -cp " jar "/" ,name "-" ,version ".jar:" + (string-concatenate + (find-files (assoc-ref inputs "stringtemplate") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (assoc-ref inputs "stringtemplate4") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (string-append + (assoc-ref inputs "antlr") + "/lib") + ".*\\.jar")) + " org.antlr.Tool $*")))) + (chmod (string-append bin "/antlr3") #o755)))) + (add-before 'build 'generate-grammar + (lambda _ + (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("ANTLR.g" "ANTLRTreePrinter.g" "ActionAnalysis.g" + "AssignTokenTypesWalker.g" + "ActionTranslator.g" "TreeToNFAConverter.g" + "ANTLRv3.g" "ANTLRv3Tree.g" "LeftRecursiveRuleWalker.g" + "CodeGenTreeWalker.g" "DefineGrammarItemsWalker.g")) + (substitute* "ANTLRParser.java" + (("public Object getTree") "public GrammarAST getTree")) + (substitute* "ANTLRv3Parser.java" + (("public Object getTree") "public CommonTree getTree")) + (chdir "../../../../../java") + (system* "antlr" "-o" "org/antlr/tool" + "org/antlr/tool/serialize.g") + (substitute* "org/antlr/tool/LeftRecursiveRuleAnalyzer.java" + (("import org.antlr.grammar.v3.\\*;") "import org.antlr.grammar.v3.*; +import org.antlr.grammar.v3.ANTLRTreePrinter;")) + (substitute* "org/antlr/tool/ErrorManager.java" + (("case NO_SUCH_ATTRIBUTE_PASS_THROUGH:") "")) + (chdir "../../../.."))) + (add-before 'build 'fix-build-xml + (lambda _ + (substitute* "build.xml" + ((" + + + + + + + + + + + + + + + + + + + + + Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 15 Apr 2017 20:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26487 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Julien Lepiller Cc: 26487@debbugs.gnu.org Received: via spool by 26487-submit@debbugs.gnu.org id=B26487.149228637225945 (code B ref 26487); Sat, 15 Apr 2017 20:00:01 +0000 Received: (at 26487) by debbugs.gnu.org; 15 Apr 2017 19:59:32 +0000 Received: from localhost ([127.0.0.1]:49401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1czTr1-0006kP-Qx for submit@debbugs.gnu.org; Sat, 15 Apr 2017 15:59:31 -0400 Received: from lb1.openmailbox.org ([5.79.108.160]:50251 helo=mail.openmailbox.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1czTr0-0006kG-Qd for 26487@debbugs.gnu.org; Sat, 15 Apr 2017 15:59:31 -0400 Received: by mail.openmailbox.org (Postfix, from userid 20002) id 989B1543451; Sat, 15 Apr 2017 21:59:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1492286369; bh=naIRGmDo+4WirP7wELbgEgBXkpwNw37xIgktkiVMuwo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Jlw4j0FimoyFEGFVYblznFlqoZrcpHwmW/sWh/ybKMlsnPEhxbUt0L4B5YNDP26Jk NAGTZrCXTM6JzM5GmnV4x8F17fnSyVd4MikXVS749V/TabsQDFX5TWtIPala5sc7aY eunQtJvos1Qb18fJoMoEuDrFGinSWthrRDdDxEOA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ZDZR003 X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=NO_RECEIVED,NO_RELAYS, T_DKIM_INVALID autolearn=disabled version=3.4.0 From: Kei Kebreau DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1492286369; bh=naIRGmDo+4WirP7wELbgEgBXkpwNw37xIgktkiVMuwo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Jlw4j0FimoyFEGFVYblznFlqoZrcpHwmW/sWh/ybKMlsnPEhxbUt0L4B5YNDP26Jk NAGTZrCXTM6JzM5GmnV4x8F17fnSyVd4MikXVS749V/TabsQDFX5TWtIPala5sc7aY eunQtJvos1Qb18fJoMoEuDrFGinSWthrRDdDxEOA= References: <20170413224513.342184b2@lepiller.eu> Date: Sat, 15 Apr 2017 15:59:17 -0400 In-Reply-To: <20170413224513.342184b2@lepiller.eu> (Julien Lepiller's message of "Thu, 13 Apr 2017 22:46:13 +0200") Message-ID: <87h91pmoh6.fsf@openmailbox.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Julien Lepiller writes: > Hi, here are patches to add antlr3, a parser generator. > > * 0001-guix-ant-build-system-Add-src-dir-parameter.patch: adds a > #:src-dir parameter to the ant-build-system, to change the source > directory and possibly specify more than one directory. > * 0002-gnu-Add-antlr2.patch: Adds antlr2, an older version of antlr, > that is required by antlr3 to generate some of its source files, and > because parts of it is used by antlr3 (such as the CommonTree class). > * 0003-gnu-Add-stringtemplate3.patch: Adds stringtemplate3, a runtime > requirement of antlr3. It is a library to generate strings using > templates. > * 0004-gnu-Add-antlr3-and-stringtemplate4.patch: a big patch that adds > antlr3 and stringtemplate4 (ST4). ST4 is a newer version of ST3, is a > runtime dependency of antlr3 and needs antlr3 to generate some of its > source files. antlr3 depends on ST4 too. I didn't find a way to split > this patch further. > > I wanted to package antlr4, but I'm still working on its dependencies > (antlr3 is one of them). Everything looks good except for the antlr2 jar file, where the timestamps inside the jar file differ. Is there a way to fix this that you are aware of? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAljye5UACgkQ5qXuPBlG eg3T1xAAtrWEpKrXRGwPvoNvsVF1lor8HdJQQraYunAIFomqZVOp2P3XBpH+y9+y Jr8cw/Nacmz5s/hwMonNzi/6JY4x/tY6CdFXMlzmwhWq4I51r/g6fG0fEaBAs9Rq GhIPR8N7l4tpvheA4bkDSblvWCnocDIlV1FR49/pqiRe0pcIIe7/244KWNel89Bi EVVpQdSzwxVvmm4/KsOafK/J3f5I6gTBgaMIcavY+wW0KoZ8tlRmQKKPWLioZhwa sYw2HLTiQUmJCbvH3bZrHJB3//ZHGFrGqzjLzQ6m7x+bihAFuoDKFvcl6jYgdqGS 9ERjx1TwJIug3tCrMZ/ZqTUS+2RLHyRCGuURQu+HL3dezMIucsJHqeVLcWmiCyBs moknPaUeMveGEuua/wX26cbLqYo8zLiBKrqiZ8jV9zXWkwY6Saj07qnwmhFnaCOf HcgF9ftN2UClPjyqsBifBihn4f9ZV2Dht51gp8i3tBbAOjd2Dk9F5MCj7lQhHNSu ChQe0vE/azcoZ7rwYyQFhFlPR7r9GQlGAgZp6Vnu31gOEIVe4gRSpR/XgfsbqpoO +vYrpp/H8md6Z2b7ViW8SX5hXbDFzzEcopvW6r4duyH/tWuTIGpjDuN40boyo3c6 l+e/WvDEO5bwwfHX7BiVSleAt5cj5/GiHkYWhOVZ/jfINgcqmvs= =LTzP -----END PGP SIGNATURE----- --=-=-=-- From unknown Thu Sep 11 14:10:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26487: Add antlr3 Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Apr 2017 13:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26487 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 26487@debbugs.gnu.org Received: via spool by 26487-submit@debbugs.gnu.org id=B26487.149243426916887 (code B ref 26487); Mon, 17 Apr 2017 13:05:02 +0000 Received: (at 26487) by debbugs.gnu.org; 17 Apr 2017 13:04:29 +0000 Received: from localhost ([127.0.0.1]:51672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d06KL-0004OB-Oj for submit@debbugs.gnu.org; Mon, 17 Apr 2017 09:04:28 -0400 Received: from dau94-h03-89-91-205-84.dsl.sta.abo.bbox.fr ([89.91.205.84]:42937 helo=skaro.lepiller.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d06KH-0004Nq-5E for 26487@debbugs.gnu.org; Mon, 17 Apr 2017 09:04:19 -0400 Received: from localhost (localhost [127.0.0.1]) by skaro.lepiller.eu (Postfix) with ESMTP id 4CD1F81245 for <26487@debbugs.gnu.org>; Mon, 17 Apr 2017 15:04:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492434250; bh=MRUzbDlc07TT/hMb8HvwW96amn0L1gUZCDnC7Mc42Bw=; h=Date:From:To:Subject:In-Reply-To:References:From; b=J46KK1WUhLKkXnv+frHn6J3MuJQeUxTDdv4uUTN3Wfu4bT6p2dUAs/tXBjjdQowpQ bgOCVj4nI9hv0FdZG+//7yZJ3LPLdgrmG5Ssfm3sRRJ38pdfxaEzPA2PFOGnXJsYzk WcjDaZJ9RxIz+p0b/UtK+DcMr0kdR+Nc+ZFZgHrZ+xM2an4bHn2jXNoQUcDyAjSXQO zZm+n/k0xMWvBm6KCucjJ0Fp64Lq8s/P4SEjIRH8oLkqXX51LbLRO1wZnT7bDWBiAh 5M5SDl6Rm3OTn6WCkyM/SrH6D9Wr7Gr8SXghGAGopxgBz8r34YcVEMDvv8QXDiYLyb jgfjJ4vCIGSiCwSquWEuI0Kn5ErYdcoSE4wS0pwZeoDe7ckJnqcYYlI3nk08LaaBno W3rH2ktFUEcLbCfKVEjd/iVChNFPJq2cyJgUxQ2flRHZw4z1lt6nuzaYzpxyFdRB8S zRsOrWzpuHCMsZnAwA+BdW8NTKiSSKTlUsnYcx7JHpbEQDyxBzRJ9+VZPlpdeUy/gj udTOtb9m4xSLwWzgck783xxDG74ee4q9JbyRPnzCG+SUE3aZMyK4ZuRXUJG3ESpFYq M4den90sCkkGTBrtTDmH5M4dPmWaYBmogqw6Qi+O5eJs9QwsFu3wE90sywwYsSParL o6kd7AYpuTAZUwlzAF/CV2H4= X-Virus-Scanned: Debian amavisd-new at lepiller.eu Received: from skaro.lepiller.eu ([127.0.0.1]) by localhost (lepiller.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1mlqI7N6SRZa for <26487@debbugs.gnu.org>; Mon, 17 Apr 2017 15:03:59 +0200 (CEST) Received: from localhost (89-93-157-164.hfc.dyn.abo.bbox.fr [89.93.157.164]) by skaro.lepiller.eu (Postfix) with ESMTPSA id 36E86810E9 for <26487@debbugs.gnu.org>; Mon, 17 Apr 2017 15:03:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492434238; bh=MRUzbDlc07TT/hMb8HvwW96amn0L1gUZCDnC7Mc42Bw=; h=Date:From:To:Subject:In-Reply-To:References:From; b=KaxIYuPk0m7HlXxkfkPZv4ultFm9CsVfwthFV0oW0DzbELTJGtAkT3WZdV1KK/ShI yr/b/jhHCjuW3Ek4mPxBDLwQsnuMOBO+tdk/EfYuoEGdnEsBiCLPlLBuAtydaV5zEk HT7PoZvdieK0mZDajqdFEvPRzgqo0b7uW76n2yfpzsiki9nChgoxS42PPANfPht6JZ ly+a18C5LNSRe1DZkSZ107m2hDcYNGS8OP//cZ1Oat/TK9Z+g/3ivoBUroBufFF1/8 pSslXo1/IW52wGn9tGoN+10G2IBVC6WlwvX5HNAIB4koQifuG9xAmPqJFirIUsT1mQ fDl1XtXxb2bTlLa1egaZD3CkuZrP+x0Zy8in9MzA1HH3QrbaIaE+0/UX2JrcNLBQIs vZFXHqs/McAm6PZTa7FAmyMnkiFS0CEvi35tSDZrpRlI0F3l0fxUfAbCO4y3+1br1R RwBZkbAeu9AcE4FwkQeDja/L5HivNj2c3opHrc+qwtxPE2YtJWvUUtqEtrmuijKQjA XPAwgjkmftmiFNOAKqlAEKBvtx+ZCZ0o8NkXbupdR6gDhIYTxMjJ8XpmfSfegT+/v2 4yajVyX6jE1XTn0jyUwY+WSUJDn9dWSPy0ZexmVjdhIFu/XtjLGJcklrz/InYgYnv2 /Rn6FL6tqzErQ2Wo02nhLino= Date: Mon, 17 Apr 2017 15:03:53 +0200 From: Julien Lepiller Message-ID: <20170417150349.7040ec6c@lepiller.eu> In-Reply-To: <87h91pmoh6.fsf@openmailbox.org> References: <20170413224513.342184b2@lepiller.eu> <87h91pmoh6.fsf@openmailbox.org> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/dIc.yCCmL+r97NmcSUFUA1E" X-Spam-Score: 0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) --MP_/dIc.yCCmL+r97NmcSUFUA1E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Sat, 15 Apr 2017 15:59:17 -0400, Kei Kebreau a =C3=A9crit : > Julien Lepiller writes: >=20 > > Hi, here are patches to add antlr3, a parser generator. > > > > * 0001-guix-ant-build-system-Add-src-dir-parameter.patch: adds a > > #:src-dir parameter to the ant-build-system, to change the source > > directory and possibly specify more than one directory. > > * 0002-gnu-Add-antlr2.patch: Adds antlr2, an older version of antlr, > > that is required by antlr3 to generate some of its source files, > > and because parts of it is used by antlr3 (such as the CommonTree > > class). > > * 0003-gnu-Add-stringtemplate3.patch: Adds stringtemplate3, a > > runtime requirement of antlr3. It is a library to generate strings > > using templates. > > * 0004-gnu-Add-antlr3-and-stringtemplate4.patch: a big patch that > > adds antlr3 and stringtemplate4 (ST4). ST4 is a newer version of > > ST3, is a runtime dependency of antlr3 and needs antlr3 to generate > > some of its source files. antlr3 depends on ST4 too. I didn't find > > a way to split this patch further. > > > > I wanted to package antlr4, but I'm still working on its > > dependencies (antlr3 is one of them). =20 >=20 > Everything looks good except for the antlr2 jar file, where the > timestamps inside the jar file differ. Is there a way to fix this that > you are aware of? Hi, I fixed the reproducibility issue by copying part of the ant-build-system in antlr2's recipe. --MP_/dIc.yCCmL+r97NmcSUFUA1E Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-guix-ant-build-system-Add-src-dir-parameter.patch =46rom bc2eaf6e11cea60169f16c35ca052a67f83990af Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:18:15 +0200 Subject: [PATCH 1/4] guix: ant-build-system: Add src-dir parameter. * guix/build-system/ant.scm (ant-build): Add src-dir parameter. * guix/build/ant-build-system.scm (configure): Add src-dir parameter. (default-build.xml): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 6 +++++- guix/build-system/ant.scm | 2 ++ guix/build/ant-build-system.scm | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 810139dbc..6e7e1f55f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3321,7 +3321,11 @@ parameters, respectively. When the original package does not provide a suitable Ant build file, the parameter @code{#:jar-name} can be used to generate a minimal Ant build file @file{build.xml} with tasks to build the specified jar -archive. +archive. By default, @file{src} will be used as the source directory. +The parameter @code{#:src-dir} can be used to change the default source +directory. This parameter accepts the ant syntax for @code{srcdir} +parameters, allowing to specify more than one directory by separating +each directory with a semicolon (as in @code{"src1:src2"}). =20 The parameter @code{#:build-target} can be used to specify the Ant task that should be run during the @code{build} phase. By default the diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm index 550f92bc7..cd544ad0d 100644 --- a/guix/build-system/ant.scm +++ b/guix/build-system/ant.scm @@ -98,6 +98,7 @@ (make-flags ''()) (build-target "jar") (jar-name #f) + (src-dir "src") (phases '(@ (guix build ant-build-system) %standard-phases)) (outputs '("out")) @@ -126,6 +127,7 @@ #:test-target ,test-target #:build-target ,build-target #:jar-name ,jar-name + #:src-dir ,src-dir #:phases ,phases #:outputs %outputs #:search-paths ',(map search-path-specification->sexp diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.= scm index 00a4a46d8..e2f3d4a9e 100644 --- a/guix/build/ant-build-system.scm +++ b/guix/build/ant-build-system.scm @@ -35,7 +35,7 @@ ;; ;; Code: =20 -(define (default-build.xml jar-name prefix) +(define (default-build.xml jar-name prefix src-dir) "Create a simple build.xml with standard targets for Ant." (call-with-output-file "build.xml" (lambda (port) @@ -58,7 +58,7 @@ (target (@ (name "compile")) (mkdir (@ (dir "${classes.dir}"))) (javac (@ (includeantruntime "false") - (srcdir "src") + (srcdir ,src-dir) (destdir "${classes.dir}") (classpath (@ (refid "classpath")))))) =20 @@ -97,12 +97,13 @@ to the default GNU unpack strategy." ;; Use GNU unpack strategy for things that aren't jar archives. ((assq-ref gnu:%standard-phases 'unpack) #:source source))) =20 -(define* (configure #:key inputs outputs (jar-name #f) +(define* (configure #:key inputs outputs (jar-name #f) (src-dir "src") #:allow-other-keys) (when jar-name (default-build.xml jar-name (string-append (assoc-ref outputs "out") - "/share/java"))) + "/share/java") + src-dir)) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) (setenv "CLASSPATH" (generate-classpath inputs))) =20 --=20 2.12.2 --MP_/dIc.yCCmL+r97NmcSUFUA1E Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0002-gnu-Add-antlr2.patch =46rom 320ebcdc61fb98ed48b49ddfc6595405ba6234a1 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:03:54 +0200 Subject: [PATCH 2/4] gnu: Add antlr2. * gnu/packages/java.scm (antlr2): New variable. --- gnu/packages/java.scm | 77 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 77 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 1d18a0b06..47c93aca9 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2016 Leo Famulari ;;; Copyright =C2=A9 2016, 2017 Roel Janssen ;;; Copyright =C2=A9 2017 Carlo Zancanaro +;;; Copyright =C2=A9 2017 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -1178,3 +1179,79 @@ testing frameworks, mocking libraries and UI validat= ion rules.") JUnit provides assertions for testing expected results, test fixtures for sharing common test data, and test runners for running tests.") (license license:epl1.0))) + +(define-public antlr2 + (package + (name "antlr2") + (version "2.7.7") + (source (origin + (method url-fetch) + (uri (string-append "http://www.antlr2.org/download/antlr-" + version ".tar.gz")) + (sha256 + (base32 + "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5")) + (modules '((guix build utils))) + (snippet + '(begin + (delete-file "antlr.jar") + (substitute* "lib/cpp/antlr/CharScanner.hpp" + (("#include ") + (string-append + "#include \n" + "#define EOF (-1)\n" + "#include "))) + (substitute* "configure" + (("/bin/sh") "sh")))))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'install 'strip-jar-timestamps + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (jar1 (string-append out "/lib/antlr.jar")) + (jar2 (string-append out "/share/antlr-2.7.7/antlr.jar= "))) + ;; XXX: copied from (guix build ant-build-system) + (define (strip-jar jar dir) + (let ((manifest (string-append dir "/META-INF/MANIFEST.MF= "))) + (mkdir-p dir) + (and (with-directory-excursion dir + (zero? (system* "jar" "xf" jar))) + (delete-file jar) + (for-each (lambda (file) + (let ((s (lstat file))) + (unless (eq? (stat:type s) 'symlink) + (utime file 0 0 0 0)))) + (find-files dir #:directories? #t)) + (with-directory-excursion dir + (let* ((files (find-files "." ".*" #:directories= ? #t))) + (unless (zero? (apply system* + `("zip" "-X" ,jar ,manif= est + ,@files))) + (error "'zip' failed")))) + (utime jar 0 0) + #t))) + (strip-jar jar1 "temp1") + (strip-jar jar2 "temp2")))) + (add-after 'configure 'fix-bin-ls + (lambda _ + (for-each (lambda (file) + (substitute* file + (("/bin/ls") "ls"))) + (find-files "." "Makefile"))))))) + (native-inputs + `(("which" ,which) + ("zip" ,zip) + ("java" ,icedtea "jdk"))) + (inputs + `(("java" ,icedtea))) + (home-page "http://www.antlr2.org") + (synopsis "Framework for constructing recognizers, compilers, and tran= slators") + (description "ANTLR, ANother Tool for Language Recognition, (formerly = PCCTS) +is a language tool that provides a framework for constructing recognizers, +compilers, and translators from grammatical descriptions containing Java, = C#, +C++, or Python actions. ANTLR provides excellent support for tree constru= ction, +tree walking, and translation.") + (license license:public-domain))) --=20 2.12.2 --MP_/dIc.yCCmL+r97NmcSUFUA1E Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0003-gnu-Add-stringtemplate3.patch =46rom 84011296bba87af30109457ad6539372d97e97cc Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:13:14 +0200 Subject: [PATCH 3/4] gnu: Add stringtemplate3. * gnu/packages/java.scm (stringtemplate3): New variable. --- gnu/packages/java.scm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 47c93aca9..624436a0a 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1255,3 +1255,41 @@ compilers, and translators from grammatical descript= ions containing Java, C#, C++, or Python actions. ANTLR provides excellent support for tree constru= ction, tree walking, and translation.") (license license:public-domain))) + +(define-public stringtemplate3 + (package + (name "stringtemplate3") + (version "3.2.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/website-st4/ra= w/" + "gh-pages/download/stringtemplate-" + version ".tar.gz")) + (sha256 + (base32 + "086yj68np1vqhkj7483diz3km6s6y4gmwqswa7524a0ca6vxn2is")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "stringtemplate-3.2.1.jar" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda _ + (let ((dir "src/org/antlr/stringtemplate/language/")) + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr" "-o" dir (string-append dir fi= le))) + '("template.g" "angle.bracket.template.g" "action= .g" + "eval.g" "group.g" "interface.g")))))))) + (native-inputs + `(("antlr" ,antlr2))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for= C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, ema= ils, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localizat= ion. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) --=20 2.12.2 --MP_/dIc.yCCmL+r97NmcSUFUA1E Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0004-gnu-Add-antlr3-and-stringtemplate4.patch =46rom da55fe9a311be5d4c758bc6441b60c8a689d8f54 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 21:57:33 +0200 Subject: [PATCH 4/4] gnu: Add antlr3 and stringtemplate4. * gnu/packages/java.scm (antlr3, stringtemplate4): New variables. --- gnu/packages/java.scm | 337 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 337 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 624436a0a..cb1c2bd0e 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1293,3 +1293,340 @@ or any other formatted text output. StringTemplate= is particularly good at code generators, multiple site skins, and internationalization / localizat= ion. StringTemplate also powers ANTLR.") (license license:bsd-3))) + +;; antlr3 is partially written using antlr3 grammar files. It also depends= on +;; ST4 (stringtemplate4), which is also partially written using antlr3 gra= mmar +;; files and uses antlr3 at runtime. The latest version requires a recent = version +;; of antlr3 at runtime. +;; Fortunately, ST4 4.0.6 can be built with an older antlr3, and we use an= tlr3.3. +;; This version of ST4 is sufficient for the latest antlr3. +;; We use ST4 4.0.6 to build a boostrap antlr3 (latest version), and build +;; the latest ST4 with it. Then we build our final antlr3 that will be lin= ked +;; against the latest ST4. +;; antlr3.3 still depends on antlr3 to generate some files, so we use an +;; even older version, antlr3.1, to generate them. Fortunately antlr3.1 us= es +;; only grammar files with the antlr2 syntax. +;; So we build antlr3.1 -> antlr3.3 -> ST4.0.6 -> antlr3-bootstrap -> ST4 = -> antlr3. + +(define-public stringtemplate4 + (package + (name "stringtemplate4") + (version "4.0.8") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate= 4/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "1pri8hqa95rfdkjy55icl5q1m09zwp5k67ib14abas39s4v3w087")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f + #:jar-name (string-append ,name "-" ,version ".jar") + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda* (#:key inputs #:allow-other-keys) + (chdir "src/org/stringtemplate/v4/compiler/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("STParser.g" "Group.g" "CodeGenerator.g")) + (chdir "../../../../..")))))) + (inputs + `(("antlr3" ,antlr3-bootstrap) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for= C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, ema= ils, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localizat= ion. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) + +(define stringtemplate4-4.0.6 + (package + (inherit stringtemplate4) + (name "stringtemplate4") + (version "4.0.6") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate= 4/archive/ST-" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0hjmh1ahdsh3w825i67mli9l4nncc4l6hdbf9ma91jvlj590sljp")))) + (inputs + `(("antlr3" ,antlr3-3.3) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))))) + +(define-public antlr3 + (package + (name "antlr3") + (version "3.5.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/antlr3/archive= /" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "07zff5frmjd53rnqdx31h0pmswz1lv0p2lp28cspfszh25ysz6sj")))) + (build-system ant-build-system) + (arguments + `(#:jar-name (string-append ,name "-" ,version ".jar") + #:src-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/m= ain/antlr3" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'install 'bin-install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((jar (string-append (assoc-ref outputs "out") "/share/j= ava")) + (bin (string-append (assoc-ref outputs "out") "/bin"))) + (mkdir-p bin) + (with-output-to-file (string-append bin "/antlr3") + (lambda _ + (display + (string-append "#!" (which "sh") "\n" + "java -cp " jar "/" ,name "-" ,version= ".jar:" + (string-concatenate + (find-files (assoc-ref inputs "strin= gtemplate") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (assoc-ref inputs "strin= gtemplate4") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (string-append + (assoc-ref inputs "ant= lr") + "/lib") + ".*\\.jar")) + " org.antlr.Tool $*")))) + (chmod (string-append bin "/antlr3") #o755)))) + (add-before 'build 'generate-grammar + (lambda _ + (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("ANTLR.g" "ANTLRTreePrinter.g" "ActionAnalysis.g" + "AssignTokenTypesWalker.g" + "ActionTranslator.g" "TreeToNFAConverter.g" + "ANTLRv3.g" "ANTLRv3Tree.g" "LeftRecursiveRuleWal= ker.g" + "CodeGenTreeWalker.g" "DefineGrammarItemsWalker.g= ")) + (substitute* "ANTLRParser.java" + (("public Object getTree") "public GrammarAST getTree")) + (substitute* "ANTLRv3Parser.java" + (("public Object getTree") "public CommonTree getTree")) + (chdir "../../../../../java") + (system* "antlr" "-o" "org/antlr/tool" + "org/antlr/tool/serialize.g") + (substitute* "org/antlr/tool/LeftRecursiveRuleAnalyzer.java" + (("import org.antlr.grammar.v3.\\*;") "import org.antlr.gra= mmar.v3.*; +import org.antlr.grammar.v3.ANTLRTreePrinter;")) + (substitute* "org/antlr/tool/ErrorManager.java" + (("case NO_SUCH_ATTRIBUTE_PASS_THROUGH:") "")) + (chdir "../../../.."))) + (add-before 'build 'fix-build-xml + (lambda _ + (substitute* "build.xml" + ((" + + + + + + + + + + + + + + + + + + + + + Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 May 2017 20:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26487 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Julien Lepiller Cc: 26487@debbugs.gnu.org Received: via spool by 26487-submit@debbugs.gnu.org id=B26487.149427463222397 (code B ref 26487); Mon, 08 May 2017 20:18:02 +0000 Received: (at 26487) by debbugs.gnu.org; 8 May 2017 20:17:12 +0000 Received: from localhost ([127.0.0.1]:60267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7p5j-0005pB-PN for submit@debbugs.gnu.org; Mon, 08 May 2017 16:17:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7p5h-0005oi-NJ for 26487@debbugs.gnu.org; Mon, 08 May 2017 16:17:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7p5Z-0002sw-HL for 26487@debbugs.gnu.org; Mon, 08 May 2017 16:17:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7p5Z-0002ss-EY; Mon, 08 May 2017 16:17:01 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:59440 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d7p5Y-0001k1-LI; Mon, 08 May 2017 16:17:01 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170413224513.342184b2@lepiller.eu> <87h91pmoh6.fsf@openmailbox.org> <20170417150349.7040ec6c@lepiller.eu> Date: Mon, 08 May 2017 22:16:58 +0200 In-Reply-To: <20170417150349.7040ec6c@lepiller.eu> (Julien Lepiller's message of "Mon, 17 Apr 2017 15:03:53 +0200") Message-ID: <878tm7je85.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hello! Julien Lepiller skribis: > Hi, I fixed the reproducibility issue by copying part of the > ant-build-system in antlr2's recipe. > > From bc2eaf6e11cea60169f16c35ca052a67f83990af Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Thu, 13 Apr 2017 20:18:15 +0200 > Subject: [PATCH 1/4] guix: ant-build-system: Add src-dir parameter. > > * guix/build-system/ant.scm (ant-build): Add src-dir parameter. > * guix/build/ant-build-system.scm (configure): Add src-dir parameter. > (default-build.xml): Use it. > * doc/guix.texi: Document it. [...] > --- a/guix/build-system/ant.scm > +++ b/guix/build-system/ant.scm > @@ -98,6 +98,7 @@ > (make-flags ''()) > (build-target "jar") > (jar-name #f) > + (src-dir "src") The general guideline (info "(guix) Formatting Code") is to use full words as identifiers. Could you change =E2=80=98src-dir=E2=80=99 to =E2=80= =98source-directory=E2=80=99? (In the code and .texi.) Kei already OKayed the remaining patches and they look good to me too. Thanks! Ludo=E2=80=99. From unknown Thu Sep 11 14:10:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Julien Lepiller Subject: bug#26487: closed (Re: bug#26487: Add antlr3) Message-ID: References: <87efvp6ckq.fsf@elephly.net> <20170413224513.342184b2@lepiller.eu> X-Gnu-PR-Message: they-closed 26487 X-Gnu-PR-Package: guix-patches Reply-To: 26487@debbugs.gnu.org Date: Mon, 15 May 2017 21:22:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1494883322-2396-1" This is a multi-part message in MIME format... ------------=_1494883322-2396-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #26487: Add antlr3 which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 26487@debbugs.gnu.org. --=20 26487: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D26487 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1494883322-2396-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 26487-done) by debbugs.gnu.org; 15 May 2017 21:21:36 +0000 Received: from localhost ([127.0.0.1]:47035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dANQu-0000bz-Jw for submit@debbugs.gnu.org; Mon, 15 May 2017 17:21:36 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21085) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dANQs-0000br-MW for 26487-done@debbugs.gnu.org; Mon, 15 May 2017 17:21:35 -0400 Received: from localhost (x2f7fa94.dyn.telefonica.de [2.247.250.148]) by mx.zohomail.com with SMTPS id 1494883290374512.7871799023724; Mon, 15 May 2017 14:21:30 -0700 (PDT) References: <20170413224513.342184b2@lepiller.eu> <87h91pmoh6.fsf@openmailbox.org> <20170417150349.7040ec6c@lepiller.eu> User-agent: mu4e 0.9.18; emacs 25.2.1 From: Ricardo Wurmus To: Julien Lepiller Subject: Re: bug#26487: Add antlr3 In-reply-to: <20170417150349.7040ec6c@lepiller.eu> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Mon, 15 May 2017 23:21:25 +0200 Message-ID: <87efvp6ckq.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 26487-done Cc: 26487-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) Hi Julien, thank you for tackling antlr! I saw that the patches have already been pushed, but here are a couple of comments anyway. * Please end all phases and snippets with “#t” or use (zero? …) when the last thing is “system*”. * All Java packages should be prefixed with “java-”. * Please capitalise “Java” in descriptions. * When disabling tests, please always explain why. * Instead of copying from the ant-build-system you can reference build phases directly. * Please use “with-directory-excursion” instead of multiple calls to “chdir” when possible. * Please put comments before package variants that use a seemingly arbitrary version or configuration. I’m going to make a couple of changes to your packages in the coming days as follow-up commits to address these issues. Thanks again! (Since the patches have been pushed already, I’m closing this bug.) -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net ------------=_1494883322-2396-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Apr 2017 20:46:54 +0000 Received: from localhost ([127.0.0.1]:46121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyldh-0007Ml-Ew for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyldf-0007MY-OD for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyldX-0004Pl-Eu for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyldX-0004Ph-AI for submit@debbugs.gnu.org; Thu, 13 Apr 2017 16:46:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyldU-0000vg-2D for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyldQ-0004Kd-2V for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:36 -0400 Received: from dau94-h03-89-91-205-84.dsl.sta.abo.bbox.fr ([89.91.205.84]:43243 helo=skaro.lepiller.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyldP-0004Ja-62 for guix-patches@gnu.org; Thu, 13 Apr 2017 16:46:31 -0400 Received: from localhost (localhost [127.0.0.1]) by skaro.lepiller.eu (Postfix) with ESMTP id CA84681638 for ; Thu, 13 Apr 2017 22:46:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492116387; bh=PutbeiqkaZ/6KUseVCx29kSOlwMCrQPx45wy6krBW08=; h=Date:From:To:Subject:From; b=K5Ca9OvgygO8iLWctGyZyuLquPpSrXi0bXgvLxHhysM/yBkESSIfTRfAXmSSpUzAg 6Otkze/8ho0NQjFH0c5X3DeEcJm0JxPzlFgM+KsuA8x5DU0VgfM0hK6tuxXFx3R52w pw6O0yNI2ZDPKsSbmZtdyPZxA8giTvRlRCyKXaEZJa2ymZY5j76+U+MFumjOmrYx4q JJAz8gYu5KMHilmXDqeRktFNDHc41R78L7FKQ8k5vrb4XJmjL1lY73LWjKxS5clyAa WHhNBvrmRdwsIUxLWtXUSe8+W8jDs/pCTjc98coMcWPBB+qShpZAhcC9ehHyyxqt34 ukoGbFC6SfTfxFFcuIYuRvmUV4ypE4jfULr7z37oNOulI5WS6gSlRG0U+BKpuzhiO+ RgfkcV9gO9R7rq/sCRFiW8DuAUvukUPfeRBR+muKfGQn5PXCErWd3kj0+NNzkN1wgZ XMOId2/Nza1auHiUVn1fgnLerHYX4+xWeAYZZnxmICPm8ulT7H1tNvAuJfWX7LdHyt KdQRmilrpc/5J2WHSVOjvy4Sp8BICTQEFiNq45LzfE5LMlz7K2bL+ID3Whg3v27INH n6G92vm7eU1SwBUhEy7uD7vABjEpJ7aylFX2LgxJxt6jGabnYnemi7bTAk8nKAG3VJ CcL0xgEhtflMOvW94dj3nZQg= X-Virus-Scanned: Debian amavisd-new at lepiller.eu Received: from skaro.lepiller.eu ([127.0.0.1]) by localhost (lepiller.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qOgkfj7JzaVH for ; Thu, 13 Apr 2017 22:46:18 +0200 (CEST) Received: from localhost (89-93-157-164.hfc.dyn.abo.bbox.fr [89.93.157.164]) by skaro.lepiller.eu (Postfix) with ESMTPSA id 64B4A80BB9 for ; Thu, 13 Apr 2017 22:46:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lepiller.eu; s=default; t=1492116377; bh=PutbeiqkaZ/6KUseVCx29kSOlwMCrQPx45wy6krBW08=; h=Date:From:To:Subject:From; b=S7sRQUcisbkc4dmxUfjmBWxu/N3PA1hJQv1Zi74wS0Jk/s72MWhOrItqB3XgCiHdH xGBCSq1wfk8laUEfYh6UiOCbg4pegZNbUp7ckcCEfIefrZWscSsMBG8J5v7aedS8uA cZ7pZnot3HXWMFAe3ID9JgFJFniaxpo0/E+4EWKqKtLpjB6LPESAaiMuHBUPX6h/9e Rv5kVfZ/XrjuGvPAb1PnSTGGFrKPyzU+dnkVaUmPUdvuBN90F5lcq4eqzF8cUB7cmT 8bM30MR/nL0exyewZtXKLkTSkqNsHJH9hcfpRIOHq6B0Y/oLKhcjqatgT/PvGMl5iy UKqnW6KuRMqeJPS4Aj1uaHTZTGyeKA7gQu456zurWZR1jwg0KyT+8ya7Y1Ju7AL67k 5Lp8Leyt2URBh6YRVKOtUuBo8b4qzauSeVaxF7+GI3XkUuNCriw4GGsoe+omKTl2It DzEoxFvJLwOC3O4Yf3frR3SF+bBTAv8wnR793yQjUBfvEuTI759FedAw4sVs9khsOs adCNSsqeZjlhCL0j3lCkJwJevO3zWZVkAsNN9XTijCqsyYP6mGs0WTQsyqRo80M7Xq +e/xemnHJEnPfTzIbS5TaLaOke2Q5vcHT/fXMDI5kIvzdcPzqu1TxuIoFZfpA8Deue Z1mcywnk0hek5HBAQ0cGavHg= Date: Thu, 13 Apr 2017 22:46:13 +0200 From: Julien Lepiller To: guix-patches@gnu.org Subject: Add antlr3 Message-ID: <20170413224513.342184b2@lepiller.eu> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/TDsrR4MB0d3cUZA.49kDqy+" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, here are patches to add antlr3, a parser generator. * 0001-guix-ant-build-system-Add-src-dir-parameter.patch: adds a #:src-dir parameter to the ant-build-system, to change the source directory and possibly specify more than one directory. * 0002-gnu-Add-antlr2.patch: Adds antlr2, an older version of antlr, that is required by antlr3 to generate some of its source files, and because parts of it is used by antlr3 (such as the CommonTree class). * 0003-gnu-Add-stringtemplate3.patch: Adds stringtemplate3, a runtime requirement of antlr3. It is a library to generate strings using templates. * 0004-gnu-Add-antlr3-and-stringtemplate4.patch: a big patch that adds antlr3 and stringtemplate4 (ST4). ST4 is a newer version of ST3, is a runtime dependency of antlr3 and needs antlr3 to generate some of its source files. antlr3 depends on ST4 too. I didn't find a way to split this patch further. I wanted to package antlr4, but I'm still working on its dependencies (antlr3 is one of them). --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-ant-build-system-Add-src-dir-parameter.patch >From 9b82f683a34f9179b18e4b6a04652888ba347c68 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:18:15 +0200 Subject: [PATCH 1/4] guix: ant-build-system: Add src-dir parameter. * guix/build-system/ant.scm (ant-build): Add src-dir parameter. * guix/build/ant-build-system.scm (configure): Add src-dir parameter. (default-build.xml): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 6 +++++- guix/build-system/ant.scm | 2 ++ guix/build/ant-build-system.scm | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 07f52becf..b9dfc03e1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3321,7 +3321,11 @@ parameters, respectively. When the original package does not provide a suitable Ant build file, the parameter @code{#:jar-name} can be used to generate a minimal Ant build file @file{build.xml} with tasks to build the specified jar -archive. +archive. By default, @file{src} will be used as the source directory. +The parameter @code{#:src-dir} can be used to change the default source +directory. This parameter accepts the ant syntax for @code{srcdir} +parameters, allowing to specify more than one directory by separating +each directory with a semicolon (as in @code{"src1:src2"}). The parameter @code{#:build-target} can be used to specify the Ant task that should be run during the @code{build} phase. By default the diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm index 550f92bc7..cd544ad0d 100644 --- a/guix/build-system/ant.scm +++ b/guix/build-system/ant.scm @@ -98,6 +98,7 @@ (make-flags ''()) (build-target "jar") (jar-name #f) + (src-dir "src") (phases '(@ (guix build ant-build-system) %standard-phases)) (outputs '("out")) @@ -126,6 +127,7 @@ #:test-target ,test-target #:build-target ,build-target #:jar-name ,jar-name + #:src-dir ,src-dir #:phases ,phases #:outputs %outputs #:search-paths ',(map search-path-specification->sexp diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm index 00a4a46d8..e2f3d4a9e 100644 --- a/guix/build/ant-build-system.scm +++ b/guix/build/ant-build-system.scm @@ -35,7 +35,7 @@ ;; ;; Code: -(define (default-build.xml jar-name prefix) +(define (default-build.xml jar-name prefix src-dir) "Create a simple build.xml with standard targets for Ant." (call-with-output-file "build.xml" (lambda (port) @@ -58,7 +58,7 @@ (target (@ (name "compile")) (mkdir (@ (dir "${classes.dir}"))) (javac (@ (includeantruntime "false") - (srcdir "src") + (srcdir ,src-dir) (destdir "${classes.dir}") (classpath (@ (refid "classpath")))))) @@ -97,12 +97,13 @@ to the default GNU unpack strategy." ;; Use GNU unpack strategy for things that aren't jar archives. ((assq-ref gnu:%standard-phases 'unpack) #:source source))) -(define* (configure #:key inputs outputs (jar-name #f) +(define* (configure #:key inputs outputs (jar-name #f) (src-dir "src") #:allow-other-keys) (when jar-name (default-build.xml jar-name (string-append (assoc-ref outputs "out") - "/share/java"))) + "/share/java") + src-dir)) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) (setenv "CLASSPATH" (generate-classpath inputs))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-gnu-Add-antlr2.patch >From eaf67c17273bf82faad4aba1105418a9a5c04435 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:03:54 +0200 Subject: [PATCH 2/4] gnu: Add antlr2. * gnu/packages/java.scm (antlr2): New variable. --- gnu/packages/java.scm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 1d18a0b06..fc9e137b8 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1178,3 +1178,45 @@ testing frameworks, mocking libraries and UI validation rules.") JUnit provides assertions for testing expected results, test fixtures for sharing common test data, and test runners for running tests.") (license license:epl1.0))) + +(define-public antlr2 + (package + (name "antlr2") + (version "2.7.7") + (source (origin + (method url-fetch) + (uri (string-append "http://www.antlr2.org/download/antlr-" + version ".tar.gz")) + (sha256 + (base32 + "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5")) + (modules '((guix build utils))) + (snippet + '(begin + (delete-file "antlr.jar") + (substitute* "configure" + (("/bin/sh") "sh")))))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'configure 'fix-bin-ls + (lambda _ + (for-each (lambda (file) + (substitute* file + (("/bin/ls") "ls"))) + (find-files "Makefile"))))))) + (native-inputs + `(("which" ,which) + ("java" ,icedtea "jdk"))) + (inputs + `(("java" ,icedtea))) + (home-page "http://www.antlr2.org") + (synopsis "Framework for constructing recognizers, compilers, and translators") + (description "ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) +is a language tool that provides a framework for constructing recognizers, +compilers, and translators from grammatical descriptions containing Java, C#, +C++, or Python actions. ANTLR provides excellent support for tree construction, +tree walking, and translation.") + (license license:public-domain))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0003-gnu-Add-stringtemplate3.patch >From b9488bf5bea2720a8b320ff7009efef665e4be80 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 20:13:14 +0200 Subject: [PATCH 3/4] gnu: Add stringtemplate3. * gnu/packages/java.scm (stringtemplate3): New variable. --- gnu/packages/java.scm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index fc9e137b8..15b45a5e5 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1220,3 +1220,41 @@ compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions. ANTLR provides excellent support for tree construction, tree walking, and translation.") (license license:public-domain))) + +(define-public stringtemplate3 + (package + (name "stringtemplate3") + (version "3.2.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/website-st4/raw/" + "gh-pages/download/stringtemplate-" + version ".tar.gz")) + (sha256 + (base32 + "086yj68np1vqhkj7483diz3km6s6y4gmwqswa7524a0ca6vxn2is")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "stringtemplate-3.2.1.jar" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda _ + (let ((dir "src/org/antlr/stringtemplate/language/")) + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr" "-o" dir (string-append dir file))) + '("template.g" "angle.bracket.template.g" "action.g" + "eval.g" "group.g" "interface.g")))))))) + (native-inputs + `(("antlr" ,antlr2))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, emails, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localization. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) -- 2.12.2 --MP_/TDsrR4MB0d3cUZA.49kDqy+ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0004-gnu-Add-antlr3-and-stringtemplate4.patch >From cc621531355e3c77c6fcce32cff53ad294d7b549 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 13 Apr 2017 21:57:33 +0200 Subject: [PATCH 4/4] gnu: Add antlr3 and stringtemplate4. * gnu/packages/java.scm (antlr3, stringtemplate4): New variables. --- gnu/packages/java.scm | 337 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 337 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 15b45a5e5..d3f75731b 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1258,3 +1258,340 @@ or any other formatted text output. StringTemplate is particularly good at code generators, multiple site skins, and internationalization / localization. StringTemplate also powers ANTLR.") (license license:bsd-3))) + +;; antlr3 is partially written using antlr3 grammar files. It also depends on +;; ST4 (stringtemplate4), which is also partially written using antlr3 grammar +;; files and uses antlr3 at runtime. The latest version requires a recent version +;; of antlr3 at runtime. +;; Fortunately, ST4 4.0.6 can be built with an older antlr3, and we use antlr3.3. +;; This version of ST4 is sufficient for the latest antlr3. +;; We use ST4 4.0.6 to build a boostrap antlr3 (latest version), and build +;; the latest ST4 with it. Then we build our final antlr3 that will be linked +;; against the latest ST4. +;; antlr3.3 still depends on antlr3 to generate some files, so we use an +;; even older version, antlr3.1, to generate them. Fortunately antlr3.1 uses +;; only grammar files with the antlr2 syntax. +;; So we build antlr3.1 -> antlr3.3 -> ST4.0.6 -> antlr3-bootstrap -> ST4 -> antlr3. + +(define-public stringtemplate4 + (package + (name "stringtemplate4") + (version "4.0.8") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate4/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "1pri8hqa95rfdkjy55icl5q1m09zwp5k67ib14abas39s4v3w087")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f + #:jar-name (string-append ,name "-" ,version ".jar") + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-grammar + (lambda* (#:key inputs #:allow-other-keys) + (chdir "src/org/stringtemplate/v4/compiler/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("STParser.g" "Group.g" "CodeGenerator.g")) + (chdir "../../../../..")))))) + (inputs + `(("antlr3" ,antlr3-bootstrap) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))) + (home-page "http://www.stringtemplate.org") + (synopsis "Template engine to generate formatted text output") + (description "StringTemplate is a java template engine (with ports for C#, +Objective-C, JavaScript, Scala) for generating source code, web pages, emails, +or any other formatted text output. StringTemplate is particularly good at +code generators, multiple site skins, and internationalization / localization. +StringTemplate also powers ANTLR.") + (license license:bsd-3))) + +(define stringtemplate4-4.0.6 + (package + (inherit stringtemplate4) + (name "stringtemplate4") + (version "4.0.6") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/stringtemplate4/archive/ST-" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0hjmh1ahdsh3w825i67mli9l4nncc4l6hdbf9ma91jvlj590sljp")))) + (inputs + `(("antlr3" ,antlr3-3.3) + ("antlr2" ,antlr2) + ("stringtemplate" ,stringtemplate3))))) + +(define-public antlr3 + (package + (name "antlr3") + (version "3.5.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/antlr/antlr3/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "07zff5frmjd53rnqdx31h0pmswz1lv0p2lp28cspfszh25ysz6sj")))) + (build-system ant-build-system) + (arguments + `(#:jar-name (string-append ,name "-" ,version ".jar") + #:src-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/main/antlr3" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'install 'bin-install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((jar (string-append (assoc-ref outputs "out") "/share/java")) + (bin (string-append (assoc-ref outputs "out") "/bin"))) + (mkdir-p bin) + (with-output-to-file (string-append bin "/antlr3") + (lambda _ + (display + (string-append "#!" (which "sh") "\n" + "java -cp " jar "/" ,name "-" ,version ".jar:" + (string-concatenate + (find-files (assoc-ref inputs "stringtemplate") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (assoc-ref inputs "stringtemplate4") + ".*\\.jar")) + ":" + (string-concatenate + (find-files (string-append + (assoc-ref inputs "antlr") + "/lib") + ".*\\.jar")) + " org.antlr.Tool $*")))) + (chmod (string-append bin "/antlr3") #o755)))) + (add-before 'build 'generate-grammar + (lambda _ + (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/") + (for-each (lambda (file) + (display file) + (newline) + (system* "antlr3" file)) + '("ANTLR.g" "ANTLRTreePrinter.g" "ActionAnalysis.g" + "AssignTokenTypesWalker.g" + "ActionTranslator.g" "TreeToNFAConverter.g" + "ANTLRv3.g" "ANTLRv3Tree.g" "LeftRecursiveRuleWalker.g" + "CodeGenTreeWalker.g" "DefineGrammarItemsWalker.g")) + (substitute* "ANTLRParser.java" + (("public Object getTree") "public GrammarAST getTree")) + (substitute* "ANTLRv3Parser.java" + (("public Object getTree") "public CommonTree getTree")) + (chdir "../../../../../java") + (system* "antlr" "-o" "org/antlr/tool" + "org/antlr/tool/serialize.g") + (substitute* "org/antlr/tool/LeftRecursiveRuleAnalyzer.java" + (("import org.antlr.grammar.v3.\\*;") "import org.antlr.grammar.v3.*; +import org.antlr.grammar.v3.ANTLRTreePrinter;")) + (substitute* "org/antlr/tool/ErrorManager.java" + (("case NO_SUCH_ATTRIBUTE_PASS_THROUGH:") "")) + (chdir "../../../.."))) + (add-before 'build 'fix-build-xml + (lambda _ + (substitute* "build.xml" + ((" + + + + + + + + + + + + + + + + + + + + +