Package antlr32: Specfile

Group: Development/Java
# BEGIN SourceDeps(oneline):
BuildRequires: rpm-build-java
# END SourceDeps(oneline)
BuildRequires: /proc
BuildRequires: jpackage-generic-compat
# see
%define _localstatedir %{_var}
%global bootstrap 0
%global bootstrap_version 3.1.3

Name:           antlr32
Version:        3.2
Release:        alt1_20jpp8
Summary:        ANother Tool for Language Recognition

License:        BSD

# These artifacts are taken verbatim from maven central with the exception of the
# jar in source 2, which additionally has the java 8 compatibility patch given below
# These sources are only used for bootstrapping antlr32 into a new distro
%if %{bootstrap}

# This is backported from upstream antlr 3.5.2 for java 8 compatibility
# See
Patch0:         java8-compat.patch

# Generate OSGi metadata
Patch1:         osgi-manifest.patch

# Patch to use exec maven plugin as alternative to unavailable antlr2 maven plugin
Patch2:         antlr2-usage.patch

BuildRequires:  maven-local
BuildRequires:  ant-antlr
BuildRequires:  exec-maven-plugin
BuildRequires:  maven-plugin-build-helper
BuildRequires:  maven-plugin-bundle
BuildRequires:  maven-plugin-plugin
BuildRequires:  stringtemplate >= 3.2

# Cannot require ourself when bootstrapping
%if ! %{bootstrap}
BuildRequires:  %{name}-maven-plugin = %{version}

BuildArch:      noarch

ANother Tool for Language Recognition, is a grammar parser generator.
This package is compatibility package containing an older version of
in order to support jython. No other packages should declare a
dependency on this one.

%package     maven-plugin
Group: Development/Java
Summary:     Maven plug-in for creating ANTLR-generated parsers
Requires:    %{name}-tool = %{version}-%{release}

%description maven-plugin
Maven plug-in for creating ANTLR-generated parsers.

%package     tool
Group: Development/Java
Summary:     Command line tool for creating ANTLR-generated parsers
Requires:    %{name}-java = %{version}-%{release}

%description tool
Command line tool for creating ANTLR-generated parsers.

%package     java
Group: Development/Java
Summary:     Java run-time support for ANTLR-generated parsers
Requires:    stringtemplate >= 3.2

%description java
Java run-time support for ANTLR-generated parsers.

%package     javadoc
Group: Development/Java
Summary:     API documentation for ANTLR
BuildArch: noarch

%description javadoc

%setup -q -n antlr-%{version}

%patch0 -b .orig
%patch1 -b .orig
%patch2 -b .orig

# remove pre-built artifacts
find -type f -a -name *.jar -delete
find -type f -a -name *.class -delete

# remove corrupted files
find -name "._*" -delete

# disable stuff we don't need
%pom_disable_module gunit
%pom_disable_module gunit-maven-plugin
%pom_remove_plugin org.codehaus.mojo:buildnumber-maven-plugin
%pom_xpath_remove pom:build/pom:extensions
%pom_xpath_remove pom:build/pom:extensions runtime/Java
%pom_xpath_remove pom:build/pom:extensions antlr3-maven-plugin

# separate artifacts into sub-packages
%mvn_package :antlr tool
%mvn_package :antlr-master java
%mvn_package :antlr-runtime java
%mvn_package :antlr3-maven-plugin maven-plugin

# use a valid build target
find -name "pom.xml" | xargs sed -i -e "s|>jsr14<|>1.5<|"

# set a build number
sed -i -e "s|\${buildNumber}|%{release}|" tool/src/main/resources/org/antlr/

%mvn_compat_version 'org.antlr:antlr3-maven-plugin' %{version} %{bootstrap_version}-1
%mvn_compat_version 'org.antlr:antlr{,-master,-runtime}' %{version} %{bootstrap_version}

mkdir -p .m2/org/antlr/antlr-master/%{version}/
cp -p pom.xml .m2/org/antlr/antlr-master/%{version}/antlr-master-%{version}.pom

%if %{bootstrap}
mkdir -p .m2/org/antlr/antlr-master/%{bootstrap_version}/
cp -p %{SOURCE1} .m2/org/antlr/antlr-master/%{bootstrap_version}/.
mkdir -p .m2/org/antlr/antlr/%{bootstrap_version}/
cp -p %{SOURCE2} %{SOURCE3} .m2/org/antlr/antlr/%{bootstrap_version}/.
mkdir -p .m2/org/antlr/antlr-runtime/%{bootstrap_version}/
cp -p %{SOURCE4} %{SOURCE5} .m2/org/antlr/antlr-runtime/%{bootstrap_version}/.
mkdir -p .m2/org/antlr/antlr3-maven-plugin/%{bootstrap_version}-1/
cp -p %{SOURCE6} %{SOURCE7} .m2/org/antlr/antlr3-maven-plugin/%{bootstrap_version}-1/.

# a small number of tests always fail for reasons I don't fully understand
%mvn_build -f


%files tool -f .mfiles-tool
%doc tool/LICENSE.txt

%files maven-plugin -f .mfiles-maven-plugin
%doc tool/LICENSE.txt

%files java -f .mfiles-java
%doc tool/LICENSE.txt
%dir %{_datadir}/java/antlr32

%files javadoc -f .mfiles-javadoc
%doc tool/LICENSE.txt

* Tue Feb 05 2019 Igor Vlasenko <> 3.2-alt1_20jpp8
- fc29 update

* Sun Apr 15 2018 Igor Vlasenko <> 3.2-alt1_19jpp8
- java update

* Thu Nov 09 2017 Igor Vlasenko <> 3.2-alt1_17jpp8
- fc27 update

* Sun Oct 22 2017 Igor Vlasenko <> 3.2-alt1_16jpp8
- new jpp release

* Fri Dec 16 2016 Igor Vlasenko <> 3.2-alt1_15jpp8
- new fc release

* Tue Nov 22 2016 Igor Vlasenko <> 3.2-alt1_14jpp8
- new fc release

* Tue Feb 02 2016 Igor Vlasenko <> 3.2-alt1_9jpp8
- new version