Epoch:          1

%global bundle_ver 3.29.0

Name:           ecj
Version:        4.23
Release:        1
Summary:        the Eclipse Compiler for Java
License:        EPL-2.0
URL:            http://www.eclipse.org

Source0:        https://download.eclipse.org/eclipse/downloads/drops4/R-%{version}-202203080310/ecjsrc-%{version}.jar
Source1:        https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/%{bundle_ver}/ecj-%{bundle_ver}.pom
Source2:        MANIFEST.MF

Patch0:         0001-Always-generate-bytecode-debuginfo.patch

BuildArch:      noarch
BuildRequires:  ant javapackages-local
BuildRequires:  java-11-openjdk-devel

%description
ECJ is the the Eclipse Compiler for Java.  It is also known as the JDT Core batch compiler.

%package_help

%prep
%autosetup -c -n %{name}-%{version} -p1

sed -i -e "s/Xlint:none/Xlint:none -encoding cp1252/g" build.xml
rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java
cp %{SOURCE1} pom.xml
mkdir -p scripts/binary/META-INF/
cp %{SOURCE2} scripts/binary/META-INF/MANIFEST.MF

%mvn_alias org.eclipse.jdt:ecj org.eclipse.jdt:core org.eclipse.jdt.core.compiler:ecj \
  org.eclipse.tycho:org.eclipse.jdt.core org.eclipse.tycho:org.eclipse.jdt.compiler.apt

%build
export JAVA_HOME=/usr/lib/jvm/java-11
ant

%install
%mvn_artifact pom.xml ecj.jar
%mvn_install

%jpackage_script org.eclipse.jdt.internal.compiler.batch.Main '' '' ecj ecj true
mkdir -p %{buildroot}%{_mandir}/man1
install -m 644 -p ecj.1 %{buildroot}%{_mandir}/man1/ecj.1

%files -f .mfiles
%defattr(-,root,root)
%doc about.html
%{_bindir}/ecj

%files help
%defattr(-,root,root)
%{_mandir}/man1/ecj*

%changelog
* Wed May 18 2022 chenchen <chen_aka_jan@163.com> -  1:4.23-1
- update to 4.23

* Wed Dec 4 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:4.9-3
- Package init
