antlr/antlr.spec
Jiri Vanek 760610389c Rebuilt for java-25-openjdk as preffered jdk
https://fedoraproject.org/wiki/Changes/Java25AndNoMoreSystemJdk
Note, that since f43, you should be always explicit on what jdk to use.
This commit should do exactly that.
2025-07-29 18:57:59 +02:00

121 lines
3.3 KiB
RPMSpec

# since we have only a static library
%global debug_package %{nil}
Name: antlr
Version: 2.7.7
Release: %autorelease
Summary: ANother Tool for Language Recognition
License: ANTLR-PD
URL: http://www.antlr2.org/
ExclusiveArch: %{java_arches}
# ./generate-tarball.sh
Source0: antlr-%{version}.tar.gz
Source1: %{name}-build.xml
Source3: http://repo2.maven.org/maven2/antlr/antlr/%{version}/%{name}-%{version}.pom
# Repack the tarball without prebuilt binaries of unknown origin
Source4: generate-tarball.sh
Patch: %{name}-%{version}-newgcc.patch
Patch: %{name}-%{version}-configure-c99.patch
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: ant-openjdk25
BuildRequires: javapackages-local-openjdk25
# TODO Remove in Fedora 46
Obsoletes: %{name}-javadoc < 2.7.7-86
%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
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
parsers].
%package tool
Summary: ANother Tool for Language Recognition
BuildArch: noarch
Provides: %{name} = %{version}-%{release}
%description tool
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
C++ or Java actions [You can use PCCTS 1.xx to generate C-based
parsers].
%package manual
Summary: Manual for %{name}
BuildArch: noarch
%description manual
Documentation for %{name}.
%package C++
Summary: C++ bindings for antlr2 generated parsers
Provides: antlr-static = %{version}-%{release}
%description C++
This package provides a static C++ library for parsers generated by ANTLR2.
%prep
%autosetup -p1 -C
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
cp -p %{SOURCE1} build.xml
# CRLF->LF
sed -i 's/\r//' LICENSE.txt
# set jar location
%mvn_file %{name}:%{name} %{name}
%build
ant jar
# make expects to find it here
cp work/lib/antlr.jar .
export CLASSPATH=.
%configure --without-examples
make CXXFLAGS="${CXXFLAGS} -fPIC" DEBUG=1 verbose=1
# no longer needed
rm antlr.jar
# fix doc permissions and remove Makefiles
rm doc/{Makefile,Makefile.in}
chmod 0644 doc/*
%install
# jars, POM and depmap
%mvn_artifact %{SOURCE3} work/lib/%{name}.jar
%mvn_alias %{name}:%{name} %{name}:%{name}all
%mvn_install
mkdir -p $RPM_BUILD_ROOT{%{_includedir}/%{name},%{_libdir},%{_bindir}}
# script
%jpackage_script antlr.Tool "" "" antlr antlr
# C++ lib and headers, antlr-config
install -p -m 644 lib/cpp/antlr/*.hpp $RPM_BUILD_ROOT%{_includedir}/%{name}
install -p -m 644 lib/cpp/src/libantlr.a $RPM_BUILD_ROOT%{_libdir}
install -p -m 755 scripts/antlr-config $RPM_BUILD_ROOT%{_bindir}
%files tool -f .mfiles
%license LICENSE.txt
%{_bindir}/antlr
# this is actually a development package for the C++ target
# as we ship only a static library, it doesn't make sense
# to have a separate -devel package for the headers
%files C++
%license LICENSE.txt
%{_includedir}/%{name}
%{_libdir}/libantlr.a
%{_bindir}/antlr-config
%files manual
%license LICENSE.txt
%doc doc/*
%changelog
%autochangelog