Package ecj3: Specfile

BuildRequires: /proc
BuildRequires: jpackage-compat
# Copyright (c) 2000-2010, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

#def_with gcj_support
%bcond_with gcj_support

%if %with gcj_support
%define gcj_support 0
%else
%define gcj_support 0
%endif

Name:           ecj3
Version:        3.6
Release:        alt1_2jpp6
Epoch:          1
Summary:        Eclipse Compiler for Java
Group:          System/Internationalization
License:        EPL
URL:            http://www.eclipse.org/
Source0:        http://mirrors.ibiblio.org/pub/mirrors/eclipse/eclipse/downloads/drops/R-3.6-201006080911/ecjsrc-3.6.zip
BuildRequires: ant
BuildRequires: jpackage-utils >= 0:1.7
%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
%else
BuildArch:      noarch
%endif
Source44: import.info

%description
Eclipse Compiler for Java.

%prep
%setup -q -c

%build
export CLASSPATH=
export OPT_JAR_LIST=:
%if %{gcj_support}
    for f in `%{_bindir}/find -name '*.java'`; do
        %{_bindir}/gcj -Wno-deprecated -C $f
    done
    %{_bindir}/find . \( -name '*.class' -o -name '*.properties' -o -name '*.rsc' \) \
        | %{_bindir}/xargs %{jar} cf %{name}-%{version}.jar
%else
    %{ant}
%endif

%install

%{__mkdir_p} ${RPM_BUILD_ROOT}%{_javadir}
%{__cp} -p ecj.jar ${RPM_BUILD_ROOT}%{_javadir}/%{name}-%{version}.jar
%{__ln_s} %{name}-%{version}.jar ${RPM_BUILD_ROOT}%{_javadir}/%{name}.jar

%if %{gcj_support}
%{_bindir}/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
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%{_libdir}/gcj/%{name}/*
%endif

%changelog
* Mon Feb 14 2011 Igor Vlasenko <viy@altlinux.ru> 1:3.6-alt1_2jpp6
- new version