summaryrefslogtreecommitdiff
path: root/java/antlr2
diff options
context:
space:
mode:
Diffstat (limited to 'java/antlr2')
-rw-r--r--java/antlr2/PKGBUILD100
-rw-r--r--java/antlr2/gcc4.4.patch12
-rw-r--r--java/antlr2/mono.patch31
-rw-r--r--java/antlr2/runantlr2.sh5
4 files changed, 148 insertions, 0 deletions
diff --git a/java/antlr2/PKGBUILD b/java/antlr2/PKGBUILD
new file mode 100644
index 000000000..4269d30c7
--- /dev/null
+++ b/java/antlr2/PKGBUILD
@@ -0,0 +1,100 @@
+# $Id: PKGBUILD 167380 2012-10-01 19:24:15Z guillaume $
+# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: George Giorgidze <giorgidze (at) gmail.com>
+# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
+
+pkgbase=antlr2
+pkgname=(antlr2 antlr2-{java,python2,cxx,sharp})
+pkgver=2.7.7
+url="http://www.antlr2.org/"
+license=('custom:Public Domain')
+
+pkgrel=3
+arch=('i686' 'x86_64')
+makedepends=('java-environment' 'python2' 'sh' 'nant' 'jh')
+source=("http://www.antlr2.org/download/antlr-${pkgver}.tar.gz"
+ "http://repo.maven.apache.org/maven2/antlr/antlr/$pkgver/antlr-$pkgver.pom"
+ 'runantlr2.sh' 'gcc4.4.patch' 'mono.patch')
+
+build() {
+ cd "${srcdir}/antlr-${pkgver}"
+
+ patch -Np1 -i "${srcdir}"/gcc4.4.patch
+ patch -Np1 -i "${srcdir}"/mono.patch
+
+ ./configure --prefix=/usr --disable-examples
+ make -j1
+
+ cd lib/csharp
+ nant release
+}
+
+_install_license() {
+ install -Dm644 "$srcdir"/antlr-${pkgver}/LICENSE.txt \
+ "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+
+package_antlr2() {
+ pkgdesc="ANother Tool for Language Recognition (formerly PCCTS)"
+ depends=('sh' 'antlr2-java')
+
+ install -Dm755 "$srcdir"/runantlr2.sh "$pkgdir"/usr/bin/runantlr2
+ _install_license
+}
+
+package_antlr2-java() {
+ pkgdesc="ANother Tool for Language Recognition (formerly PCCTS) (Java version)"
+ depends=('java-runtime')
+
+ provides=("java-antlr2=$pkgver")
+ conflicts=("java-antlr2")
+ replaces=("java-antlr2")
+
+ DESTDIR="$pkgdir" jh mvn-install antlr antlr $pkgver \
+ "$srcdir"/antlr-${pkgver}.pom \
+ "$srcdir"/antlr-${pkgver}/antlr/antlr.jar \
+ antlr2.jar
+
+ _install_license
+}
+
+package_antlr2-python2() {
+ pkgdesc="ANother Tool for Language Recognition (formerly PCCTS) (Python version)"
+ depends=('antlr2' 'python2')
+
+ provides=("python2-antlr2=$pkgver")
+ conflicts=("python2-antlr2")
+ replaces=("python2-antlr2")
+
+ cd "$srcdir"/antlr-${pkgver}/lib/python
+ python2 setup.py install --root="${pkgdir}" --optimize=1
+
+ _install_license
+}
+
+package_antlr2-cxx() {
+ pkgdesc="ANother Tool for Language Recognition (formerly PCCTS) (C++ version)"
+ depends=('java-runtime')
+
+ cd "$srcdir"/antlr-${pkgver}/lib/cpp
+ make -j1 prefix="${pkgdir}/usr" install
+
+ _install_license
+}
+
+package_antlr2-sharp() {
+ pkgdesc="ANother Tool for Language Recognition (formerly PCCTS) (C Sharp version)"
+ depends=('antlr2' 'mono')
+
+ cd "$srcdir"/antlr-${pkgver}/lib/csharp
+ install -d "$pkgdir"/usr/share
+ make -j1 prefix="${pkgdir}/usr" install
+
+ _install_license
+}
+
+md5sums=('01cc9a2a454dd33dcd8c856ec89af090'
+ '78af3de823003f6d8dded39c70bc30ae'
+ 'e4aa827cf78f97c4e5fae086831192d6'
+ '158677e4c0f357afbb56656231a54815'
+ '0d1960d27ff81f2fea0dd35a8290216f')
diff --git a/java/antlr2/gcc4.4.patch b/java/antlr2/gcc4.4.patch
new file mode 100644
index 000000000..15e25fb00
--- /dev/null
+++ b/java/antlr2/gcc4.4.patch
@@ -0,0 +1,12 @@
+diff -Nur antlr-2.7.7.orig/lib/cpp/antlr/CharScanner.hpp antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp
+--- antlr-2.7.7.orig/lib/cpp/antlr/CharScanner.hpp
++++ antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp
+@@ -10,6 +10,8 @@
+
+ #include <antlr/config.hpp>
+
++#include <cstdio>
++#include <cstring>
+ #include <map>
+
+ #ifdef HAS_NOT_CCTYPE_H
diff --git a/java/antlr2/mono.patch b/java/antlr2/mono.patch
new file mode 100644
index 000000000..59c78d811
--- /dev/null
+++ b/java/antlr2/mono.patch
@@ -0,0 +1,31 @@
+diff -ruN antlr-2.7.7.orig/lib/csharp/antlr.runtime.build antlr-2.7.7/lib/csharp/antlr.runtime.build
+--- antlr-2.7.7.orig/lib/csharp/antlr.runtime.build 2006-11-01 16:37:17.000000000 -0500
++++ antlr-2.7.7/lib/csharp/antlr.runtime.build 2013-05-14 20:07:32.000000000 -0400
+@@ -25,6 +25,9 @@
+
+ <!-- Use script task to get this from AssemblyInfo.cs using a regular expression -->
+ <script language="C#">
++ <imports>
++ <import namespace="System.Text.RegularExpressions" />
++ </imports>
+ <code><![CDATA[
+ public static void ScriptMain(Project project) {
+ string assemblyInfoFileName = Path.Combine(project.BaseDirectory, "antlr.runtime/AssemblyInfo.cs");
+@@ -122,7 +125,7 @@
+ </csc>
+
+ <!-- copy the antlr.runtime assembly to the astframe build folder -->
+- <copy file="${compile.dir}\${project.FileName}.dll" tofile="${astframe.compile.dir}\${project.FileName}.dll" />
++ <copy file="${compile.dir}/${project.FileName}.dll" tofile="${astframe.compile.dir}/${project.FileName}.dll" />
+
+ <!-- compile antlr.astframe.dll -->
+ <csc target="library" output="${astframe.compile.dir}/${astframe.FileName}.dll" debug="${debug}" doc="${astframe.build.dir}/${astframe.FileName}.xml">
+@@ -134,7 +137,7 @@
+ <include name="System.dll" />
+ <include name="System.Drawing.dll" />
+ <include name="System.Windows.Forms.dll" />
+- <include name="${astframe.compile.dir}\${project.FileName}.dll" />
++ <include name="${astframe.compile.dir}/${project.FileName}.dll" />
+ </references>
+ <arg value="/nowarn:1591"/>
+ </csc>
diff --git a/java/antlr2/runantlr2.sh b/java/antlr2/runantlr2.sh
new file mode 100644
index 000000000..716f6f887
--- /dev/null
+++ b/java/antlr2/runantlr2.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+echo Running 'java antlr.Tool $*' with /usr/share/java/antlr2.jar appended to the CLASSPATH variable
+export CLASSPATH
+CLASSPATH=$CLASSPATH:/usr/share/java/antlr2.jar
+java antlr.Tool $*