forked from pool/antlr4
org.antlr.v4.gui.TestRig for testing/debugging grammars (boo#1241063) OBS-URL: https://build.opensuse.org/package/show/Java:packages/antlr4?expand=0&rev=42
219 lines
7.4 KiB
RPMSpec
219 lines
7.4 KiB
RPMSpec
#
|
|
# spec file for package antlr4
|
|
#
|
|
# Copyright (c) 2025 SUSE LLC
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%{!?make_build:%global make_build make %{?_smp_mflags}}
|
|
%define libver 4_13_0
|
|
%define runtime_cpp_lib libantlr4-runtime
|
|
%define runtime_cpp_libver %{runtime_cpp_lib}%{libver}
|
|
Name: antlr4
|
|
Version: 4.13.0
|
|
Release: 0
|
|
Summary: Java parser generator
|
|
# C# runtime is MIT-licensed, but currently it is not used in this package
|
|
License: BSD-3-Clause
|
|
URL: https://www.antlr.org/
|
|
Source0: https://github.com/antlr/antlr4/archive/%{version}.tar.gz#/antlr4-%{version}.tar.gz
|
|
Source100: antlr4-install-path.patch.in
|
|
Patch0: unicodedata.patch
|
|
BuildRequires: cmake
|
|
BuildRequires: fdupes
|
|
%if 0%{?suse_version} >= 1500
|
|
BuildRequires: gcc >= 7
|
|
BuildRequires: gcc-c++ >= 7
|
|
%else
|
|
BuildRequires: gcc7
|
|
BuildRequires: gcc7-c++
|
|
%endif
|
|
BuildRequires: libstdc++-devel
|
|
BuildRequires: maven-local
|
|
BuildRequires: pkgconfig
|
|
BuildRequires: utfcpp-devel
|
|
BuildRequires: mvn(com.google.code.maven-replacer-plugin:maven-replacer-plugin)
|
|
BuildRequires: mvn(com.ibm.icu:icu4j)
|
|
BuildRequires: mvn(org.abego.treelayout:org.abego.treelayout.core)
|
|
BuildRequires: mvn(org.antlr:ST4)
|
|
BuildRequires: mvn(org.antlr:antlr-runtime)
|
|
BuildRequires: mvn(org.antlr:antlr3-maven-plugin)
|
|
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
|
BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
|
|
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
|
|
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
|
|
BuildRequires: mvn(org.apache.maven:maven-compat)
|
|
BuildRequires: mvn(org.apache.maven:maven-core)
|
|
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
|
|
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
|
|
BuildRequires: mvn(org.codehaus.plexus:plexus-compiler-api)
|
|
BuildRequires: mvn(org.codehaus.plexus:plexus-utils)
|
|
BuildRequires: mvn(org.glassfish:javax.json)
|
|
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
|
|
BuildRequires: mvn(org.sonatype.plexus:plexus-build-api)
|
|
BuildRequires: pkgconfig(uuid)
|
|
#!BuildRequires: stringtemplate4 antlr3-tool
|
|
|
|
%description
|
|
ANTLR (ANother Tool for Language Recognition) is a parser
|
|
generator for reading, processing, executing, or translating
|
|
structured text or binary files. It can be used to build languages,
|
|
tools, and frameworks. From a grammar, ANTLR generates a parser that
|
|
can build and walk parse trees.
|
|
|
|
%package java
|
|
Summary: ANTLR 4 Java runtime
|
|
Provides: %{name}-runtime = %{version}-%{release}
|
|
Obsoletes: %{name}-runtime < %{version}-%{release}
|
|
BuildArch: noarch
|
|
|
|
%description java
|
|
This package provides Java runtime library used by parsers generated by
|
|
ANTLR 4.
|
|
|
|
%package tool
|
|
Summary: ANTLR 4 Tool
|
|
# Explicit requires for javapackages-tools since antlr4-script
|
|
# uses /usr/share/java-utils/java-functions
|
|
Requires: javapackages-tools
|
|
Provides: %{name} = %{version}-%{release}
|
|
Obsoletes: %{name} < %{version}-%{release}
|
|
BuildArch: noarch
|
|
|
|
%description tool
|
|
ANTLR (ANother Tool for Language Recognition) is a parser
|
|
generator for reading, processing, executing, or translating
|
|
structured text or binary files. It can be used to build languages,
|
|
tools, and frameworks. From a grammar, ANTLR generates a parser that
|
|
can build and walk parse trees.
|
|
|
|
This package provides the ANTLR 4 grammar compiler.
|
|
|
|
%package maven-plugin
|
|
Summary: ANTLR 4 plugin for Apache Maven
|
|
BuildArch: noarch
|
|
|
|
%description maven-plugin
|
|
This package provides plugin for Apache Maven which can be used to
|
|
generate ANTLR parsers during build.
|
|
|
|
%package javadoc
|
|
Summary: API documentation for %{name}
|
|
BuildArch: noarch
|
|
|
|
%description javadoc
|
|
This package contains %{summary}.
|
|
|
|
%package -n %{runtime_cpp_libver}
|
|
Summary: Runtime C++ ANTRL libraries
|
|
|
|
%description -n %{runtime_cpp_libver}
|
|
ANTLR runtime libraries for C++.
|
|
ANTLR (ANother Tool for Language Recognition) is a parser generator
|
|
for reading, processing, executing, or translating structured text or
|
|
binary files.
|
|
|
|
%package -n %{runtime_cpp_lib}-devel
|
|
Summary: Development files for the ANTRL libraries
|
|
Requires: %{runtime_cpp_libver} = %{version}
|
|
Requires: utfcpp-devel
|
|
|
|
%description -n %{runtime_cpp_lib}-devel
|
|
ANTLR runtime libraries for C++.
|
|
ANTLR (ANother Tool for Language Recognition) is a parser generator
|
|
for reading, processing, executing, or translating structured text or
|
|
binary files.
|
|
|
|
%prep
|
|
%setup -q
|
|
cat %{SOURCE100} | sed 's#@LIBVER@#%{libver}#g' | patch -p1 -u
|
|
|
|
find -name \*.jar -delete
|
|
perl -pi -e 's#\\>#>#g' tool/resources/org/antlr/v4/tool/templates/unicodedata.st
|
|
|
|
# Temporary solution to a proble of code too big when generated with newer ICU4J versions
|
|
%pom_remove_plugin :string-template-maven-plugin tool
|
|
%patch -P 0
|
|
|
|
# Missing test deps: org.seleniumhq.selenium:selenium-java
|
|
%pom_disable_module runtime-testsuite
|
|
%pom_disable_module tool-testsuite
|
|
|
|
# Don't bundle dependencies
|
|
%pom_remove_plugin :maven-shade-plugin tool
|
|
# Don't use the takari lifecycle, use the usual maven lifecycle instead
|
|
%pom_remove_plugin :takari-lifecycle-plugin antlr4-maven-plugin
|
|
# Don't use graphviz
|
|
%pom_remove_plugin :graphviz-maven-plugin runtime/Java
|
|
|
|
%pom_remove_plugin -r :maven-javadoc-plugin
|
|
|
|
%{mvn_package} :antlr4-master antlr4-runtime
|
|
|
|
%build
|
|
%{mvn_build} -s -f -- \
|
|
-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ) \
|
|
-Dsource=8
|
|
|
|
pushd runtime/Cpp
|
|
%if 0%{?suse_version} < 1500
|
|
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fstack-clash-protection//g'`
|
|
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
|
|
export CXX=g++-7
|
|
export CFLAGS="$RPM_OPT_FLAGS"
|
|
export CXXFLAGS="$RPM_OPT_FLAGS"
|
|
%endif
|
|
%cmake -DWITH_DEMO=OFF -DANTLR_BUILD_CPP_TESTS=OFF -DANTLR_BUILD_SHARED=ON -DANTLR_BUILD_STATIC=OFF -DANTLR4_INSTALL=ON
|
|
%make_build
|
|
popd
|
|
|
|
%install
|
|
%mvn_install
|
|
%fdupes -s %{buildroot}%{_javadocdir}
|
|
|
|
%jpackage_script org.antlr.v4.Tool "" "" antlr4/antlr4:antlr3-runtime:antlr4/antlr4-runtime:stringtemplate4:treelayout %{name} true
|
|
%jpackage_script org.antlr.v4.gui.TestRig "" "" antlr4/antlr4:antlr3-runtime:antlr4/antlr4-runtime:stringtemplate4:treelayout %{name}-test-rig true
|
|
|
|
pushd runtime/Cpp
|
|
%cmake_install
|
|
popd
|
|
|
|
%post -n %{runtime_cpp_libver} -p /sbin/ldconfig
|
|
%postun -n %{runtime_cpp_libver} -p /sbin/ldconfig
|
|
|
|
%files tool -f .mfiles-antlr4
|
|
%{_bindir}/%{name}
|
|
%{_bindir}/%{name}-test-rig
|
|
|
|
%files java -f .mfiles-antlr4-runtime
|
|
%doc CHANGES.txt README.md
|
|
%license LICENSE.txt
|
|
|
|
%files maven-plugin -f .mfiles-antlr4-maven-plugin
|
|
|
|
%files javadoc -f .mfiles-javadoc
|
|
%license LICENSE.txt
|
|
|
|
%files -n %{runtime_cpp_libver}
|
|
%license LICENSE.txt
|
|
%doc runtime/Cpp/README.md runtime/Cpp/VERSION
|
|
%{_libdir}/lib%{name}-runtime.so.%{version}
|
|
|
|
%files -n %{runtime_cpp_lib}-devel
|
|
%{_libdir}/lib%{name}-runtime.so
|
|
%{_libdir}/cmake/antlr4*
|
|
%{_includedir}/%{name}-runtime/
|
|
|
|
%changelog
|