File ecj.spec of Package ecj

#
# spec file for package ecj
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#



Name:           ecj
%define section free
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}
Version:        3.3
Release:        119
Summary:        Eclipse Compiler for Java
Group:          Development/Languages/Java
License:        EPL-1.0
Url:            www.eclipse.org
# this tarball is generated by a script that uses the original eclipse sources
# script is included for documentation purposes in the docdir of the package
Source0:        %{name}-%{version}.tar.gz
# this is the changelog from the original JPackage eclipse package that is
# included for documentation and recognition purposes only
Source1:        eclipse-jpackage-changelog.txt
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if ! %{gcj_support}
BuildArch:      noarch
%endif
BuildRequires:  ant
BuildRequires:  jpackage-utils >= 1.7
%if %{gcj_support}
BuildRequires:  gcc-java >= 4.0.0
Requires:       libgcj >= 4.0.0
Requires(post): java-gcj-compat
Requires(postun): java-gcj-compat
%else
BuildRequires:  java-devel
BuildRequires:  sed
Requires:       java
%endif
%if %defined suse_version
BuildRequires:  unzip
%endif

%description
Eclipse Compiler for Java



%prep
%setup -q

%build
%{__cp} %{SOURCE1} .
unset CLASSPATH
%if %{gcj_support}
    for f in `find -name '*.java'`; do
        gcj -Wno-deprecated -C $f
    done
    find . \( -name '*.class' -o -name '*.properties' -o -name '*.rsc' \) \
        | xargs jar cf %{name}-%{version}.jar
%else
    # remove -Xlint:none from javac compiler arguments as it causes
    # Sun Java 1.4.2 to crap out
    %{__sed} -i -e 's,-Xlint:none ,,g' jdtcoresrc/compilejdtcorewithjavac.xml
    # first invocation builds with javac, second time around with ecj itself
    ant -f jdtcoresrc/compilejdtcorewithjavac.xml
    CLASSPATH="`pwd`/jdtcoresrc/%{name}.jar" \
        ant -f jdtcoresrc/compilejdtcore.xml
    # just to make sure there is no confusion, delete the bootstrap ecj jar
    %{__rm} jdtcoresrc/%{name}.jar
%endif

%install
%{__mkdir_p} ${RPM_BUILD_ROOT}%{_javadir}
%{__install} -m 0644 %{name}.jar \
    ${RPM_BUILD_ROOT}%{_javadir}/%{name}-%{version}.jar
pushd ${RPM_BUILD_ROOT}%{_javadir}
    %{__ln_s} %{name}-%{version}.jar %{name}.jar
popd
%if %{gcj_support}
    aot-compile-rpm
%endif

%if %{gcj_support}

%post
if [ -x "%{_bindir}/rebuild-gcj-db" ]; then
    %{_bindir}/rebuild-gcj-db
fi

%postun
if [ -x "%{_bindir}/rebuild-gcj-db" ]; then
    %{_bindir}/rebuild-gcj-db
fi
%endif

%files
%defattr(-,root,root,-)
%doc eclipse-jpackage-changelog.txt %{name}-tarballBuild.sh
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%if %{gcj_support}
%{_libdir}/gcj/%{name}
%endif

%changelog
openSUSE Build Service is sponsored by