mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu: antlr3-3.3: Prettify build phases.
* gnu/packages/java.scm (antlr3-3.3)[arguments]: Prettify build phases "bin-install" and "generate-grammar".
This commit is contained in:
parent
9ecc4c69eb
commit
a9540107c6
1 changed files with 41 additions and 35 deletions
|
@ -4655,55 +4655,60 @@ (define antlr3-3.3
|
||||||
"0qgg5vgsm4l1d6dj9pfbaa25dpv2ry2gny8ajy4vvgvfklw97b3m"))))
|
"0qgg5vgsm4l1d6dj9pfbaa25dpv2ry2gny8ajy4vvgvfklw97b3m"))))
|
||||||
(arguments
|
(arguments
|
||||||
`(#:jar-name (string-append ,name "-" ,version ".jar")
|
`(#:jar-name (string-append ,name "-" ,version ".jar")
|
||||||
#:source-dir (string-append "tool/src/main/java:runtime/Java/src/main/java:"
|
#:source-dir (string-join '("tool/src/main/java"
|
||||||
"tool/src/main/antlr2:tool/src/main/antlr3")
|
"runtime/Java/src/main/java"
|
||||||
#:tests? #f
|
"tool/src/main/antlr2"
|
||||||
|
"tool/src/main/antlr3")
|
||||||
|
":")
|
||||||
|
#:tests? #f ; FIXME: tests seem to require maven plugin
|
||||||
|
#:modules ((guix build ant-build-system)
|
||||||
|
(guix build utils)
|
||||||
|
(srfi srfi-1))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(add-after 'install 'bin-install
|
(add-after 'install 'bin-install
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(let ((jar (string-append (assoc-ref outputs "out") "/share/java"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(bin (string-append (assoc-ref outputs "out") "/bin")))
|
(jar (string-append out "/share/java"))
|
||||||
|
(bin (string-append out "/bin")))
|
||||||
(mkdir-p bin)
|
(mkdir-p bin)
|
||||||
(with-output-to-file (string-append bin "/antlr3")
|
(with-output-to-file (string-append bin "/antlr3")
|
||||||
(lambda _
|
(lambda _
|
||||||
(display
|
(display
|
||||||
(string-append "#!" (which "sh") "\n"
|
(string-append
|
||||||
"java -cp " jar "/antlr3-3.3.jar:"
|
"#!" (which "sh") "\n"
|
||||||
(string-concatenate
|
"java -cp " jar "/antlr3-3.3.jar:"
|
||||||
(find-files (assoc-ref inputs "java-stringtemplate")
|
(string-join
|
||||||
".*\\.jar"))
|
(append (find-files (assoc-ref inputs "java-stringtemplate")
|
||||||
":"
|
".*\\.jar$")
|
||||||
(string-concatenate
|
(find-files (string-append (assoc-ref inputs "antlr")
|
||||||
(find-files (string-append
|
"/lib")
|
||||||
(assoc-ref inputs "antlr")
|
".*\\.jar$"))
|
||||||
"/lib")
|
":")
|
||||||
".*\\.jar"))
|
" org.antlr.Tool $*"))))
|
||||||
" org.antlr.Tool $*"))))
|
(chmod (string-append bin "/antlr3") #o755)
|
||||||
(chmod (string-append bin "/antlr3") #o755))))
|
#t)))
|
||||||
(add-before 'build 'generate-grammar
|
(add-before 'build 'generate-grammar
|
||||||
(lambda _
|
(lambda _
|
||||||
(let ((dir "tool/src/main/antlr2/org/antlr/grammar/v2/"))
|
|
||||||
(for-each (lambda (file)
|
|
||||||
(display file)
|
|
||||||
(newline)
|
|
||||||
(system* "antlr" "-o" dir (string-append dir file)))
|
|
||||||
'("antlr.g" "antlr.print.g" "assign.types.g"
|
|
||||||
"buildnfa.g" "codegen.g" "define.g")))
|
|
||||||
(chdir "tool/src/main/antlr3/org/antlr/grammar/v3/")
|
|
||||||
(for-each (lambda (file)
|
|
||||||
(display file)
|
|
||||||
(newline)
|
|
||||||
(system* "antlr3" file))
|
|
||||||
'("ActionAnalysis.g" "ActionTranslator.g" "ANTLRv3.g"
|
|
||||||
"ANTLRv3Tree.g"))
|
|
||||||
(chdir "../../../../../../../..")
|
|
||||||
(substitute* "tool/src/main/java/org/antlr/tool/Grammar.java"
|
(substitute* "tool/src/main/java/org/antlr/tool/Grammar.java"
|
||||||
(("import org.antlr.grammar.v2.\\*;")
|
(("import org.antlr.grammar.v2.\\*;")
|
||||||
"import org.antlr.grammar.v2.*;\n
|
"import org.antlr.grammar.v2.*;\n
|
||||||
import org.antlr.grammar.v2.TreeToNFAConverter;\n
|
import org.antlr.grammar.v2.TreeToNFAConverter;\n
|
||||||
import org.antlr.grammar.v2.DefineGrammarItemsWalker;\n
|
import org.antlr.grammar.v2.DefineGrammarItemsWalker;\n
|
||||||
import org.antlr.grammar.v2.ANTLRTreePrinter;"))))
|
import org.antlr.grammar.v2.ANTLRTreePrinter;"))
|
||||||
|
(and
|
||||||
|
(with-directory-excursion "tool/src/main/antlr2/org/antlr/grammar/v2/"
|
||||||
|
(every (lambda (file)
|
||||||
|
(format #t "~a\n" file)
|
||||||
|
(zero? (system* "antlr" file)))
|
||||||
|
'("antlr.g" "antlr.print.g" "assign.types.g"
|
||||||
|
"buildnfa.g" "codegen.g" "define.g")))
|
||||||
|
(with-directory-excursion "tool/src/main/antlr3/org/antlr/grammar/v3/"
|
||||||
|
(every (lambda (file)
|
||||||
|
(format #t "~a\n" file)
|
||||||
|
(zero? (system* "antlr3" file)))
|
||||||
|
'("ActionAnalysis.g" "ActionTranslator.g" "ANTLRv3.g"
|
||||||
|
"ANTLRv3Tree.g"))))))
|
||||||
(add-before 'build 'fix-build-xml
|
(add-before 'build 'fix-build-xml
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "build.xml"
|
(substitute* "build.xml"
|
||||||
|
@ -4714,7 +4719,8 @@ (define antlr3-3.3
|
||||||
<include name=\"**/*.sti\"/>
|
<include name=\"**/*.sti\"/>
|
||||||
<include name=\"**/STLexer.tokens\"/>
|
<include name=\"**/STLexer.tokens\"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy><exec")))))))
|
</copy><exec"))
|
||||||
|
#t)))))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("antlr" ,antlr2)
|
`(("antlr" ,antlr2)
|
||||||
("antlr3" ,antlr3-3.1)))
|
("antlr3" ,antlr3-3.1)))
|
||||||
|
|
Loading…
Reference in a new issue