Files
java-cup-compat/java-cup-compat.spec

87 lines
2.7 KiB
RPMSpec

#
# spec file for package java-cup-compat
#
# Copyright (c) 2024 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/
#
%define compat_name java_cup
%define compat_version 9e
Name: java-cup-compat
Version: 0.%{compat_version}
Release: 0
Summary: Java CUP Parser Generator
License: SMLNJ
Group: Development/Libraries/Java
URL: https://www2.cs.tum.edu/projects/cup/
Source0: https://www.cs.princeton.edu/~appel/modern/java/CUP/%{compat_name}_v%{compat_version}.tar.gz
Source1: http://www2.cs.tum.edu/projects/cup/licence.html
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildArch: noarch
%description
CUP is a system for generating LALR parsers from simple specifications.
It serves the same role as the widely used program YACC and in fact
offers most of the features of YACC. However, CUP is written in Java,
uses specifications including embedded Java code, and produces parsers
which are implemented in Java.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%setup -q -c
cp %{SOURCE1} .
mkdir -p classes javadoc
%build
javac -d classes -source 8 -target 8 %{compat_name}/runtime/*.java %{compat_name}/*.java
javadoc -d javadoc -source 8 -notimestamp %{compat_name}/runtime/*.java %{compat_name}/*.java
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
--date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
--create --file=%{compat_name}.jar -C classes .
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 %{compat_name}.jar %{buildroot}%{_javadir}/%{name}/%{compat_name}.jar
# maven data
%add_maven_depmap %{compat_name}:%{compat_name}:%{version} %{name}/%{compat_name}.jar -v %{version}
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr javadoc/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license licence.html
%doc manual.html README
%files javadoc
%license licence.html
%{_javadocdir}/%{name}
%changelog