File eclipse-swt.spec of Package eclipse-swt

#
# spec file for package eclipse-swt
#
# Copyright (c) 2012 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:           eclipse-swt
Summary:        SWT Library for GTK2
License:        EPL-1.0
Group:          Development/Libraries/Other
Version:        3.735
Release:        0
%define		version_suffix 3.7.3.5
%define		so_suffix 3735
Url:            http://www.eclipse.org/swt/
Source0:        libswt-%{version}.tar.bz2
Source1:        org.eclipse.swt-3.7.0.tar.bz2
Source2:        build.xml
Patch0:         libswt-optflags.patch
Patch1:         libswt-includes.patch
Patch2:         libswt-build.patch
Patch3:         libswt-version.patch
Provides:       libswt3-gtk2 = %{version}
%if 0%{?suse_version} <= 1210
Requires:       mozilla-xulrunner192
%endif
Requires:       java >= 1.6
BuildRequires:  ant
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  java-devel >= 1.6
BuildRequires:  jpackage-utils
BuildRequires:  libgcj-devel
BuildRequires:  libwebkit-devel
BuildRequires:  make
BuildRequires:  pkg-config
BuildRequires:  unzip
%if 0%{?suse_version} <= 1210
BuildRequires:  mozilla-xulrunner192-devel
%else
BuildRequires:  libXt-devel
BuildRequires:  libXtst-devel
%endif
BuildRequires:  Mesa-devel
BuildRequires:  cairo
BuildRequires:  glib2-devel
BuildRequires:  gnome-vfs2-devel
BuildRequires:  gtk2-devel
BuildRequires:  libgnome-devel
BuildRequires:  libgnomeui-devel
BuildRequires:  mozilla-nspr-devel

%description
SWT is the software component that delivers native widget functionality
for the Eclipse platform in an operating system independent manner.  It
is analogous to AWT/Swing in Java with a difference - SWT uses a rich
set of native widgets.

%prep
%setup -n libswt-%{version}
%patch0
%patch1
%patch2
pushd org/eclipse
tar -xvjf %{S:1}
%patch3
popd
pushd org/eclipse/swt
cp %{S:2} .
# remove all third party jars
find . -iname '*.jar' | xargs rm -rf
# change architecture if needed
%ifarch x86_64
sed -i -e 's|x86|x86_64|g' build.xml
%endif
popd

%build
#export JAVA_HOME=%{_libdir}/jvm/java-1.6.0-sun-1.6.0
#export XULRUNNER_VERSION=%{xul_version}
export LIBDIR=%{_libdir}
export NO_STRIP=TRUE
%if 0%{?suse_version} <= 1140
export GCJ_VERSION=4.5
%else
export GCJ_VERSION=4.6
%endif
%ifarch x86_64
export ARCH=x86_64
%else
export ARCH=i586
%endif
build.sh

pushd org/eclipse/swt
%ant \
    -Dversion.suffix=%{version_suffix} \
    -Djar.filename=swt-%{version}.jar \
    build.jars
rm build.xml
popd
jar uf org/eclipse/swt/swt-%{version}.jar *.so

%install
install -d -m755 %{buildroot}%{_libdir}/eclipse
install -m644 *.so %{buildroot}%{_libdir}/eclipse
install -D -m644 org/eclipse/swt/swt-%{version}.jar %{buildroot}%{_libdir}/java/swt-gtk-%{version}.jar
pushd %{buildroot}%{_libdir}/eclipse
%if 0%{?suse_version} <= 1210
for i in atk-gtk awt-gtk cairo-gtk glx-gtk gnome-gtk gtk mozilla-gtk pi-gtk webkit-gtk; do
  ln -sf libswt-"$i"-%{so_suffix}.so libswt-"$i".so;
  ln -sf libswt-"$i"-%{so_suffix}.so swt-"$i".so;
done
%else
# Drop mozilla-gtk in openSUSE 12.2 because of not existing mozilla-xulrunner192-devel
for i in atk-gtk awt-gtk cairo-gtk glx-gtk gnome-gtk gtk pi-gtk webkit-gtk; do
  ln -sf libswt-"$i"-%{so_suffix}.so libswt-"$i".so;
  ln -sf libswt-"$i"-%{so_suffix}.so swt-"$i".so;
done
%endif
popd
pushd %{buildroot}%{_libdir}/java
ln -sf swt-gtk-%{version}.jar swt.jar
ln -sf swt-gtk-%{version}.jar swt-gtk.jar
popd

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_libdir}/eclipse/libswt-atk-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-atk-gtk.so
%{_libdir}/eclipse/swt-atk-gtk.so
%{_libdir}/eclipse/libswt-awt-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-awt-gtk.so
%{_libdir}/eclipse/swt-awt-gtk.so
%{_libdir}/eclipse/libswt-cairo-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-cairo-gtk.so
%{_libdir}/eclipse/swt-cairo-gtk.so
%{_libdir}/eclipse/libswt-glx-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-glx-gtk.so
%{_libdir}/eclipse/swt-glx-gtk.so
%{_libdir}/eclipse/libswt-gnome-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-gnome-gtk.so
%{_libdir}/eclipse/swt-gnome-gtk.so
%{_libdir}/eclipse/libswt-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-gtk.so
%{_libdir}/eclipse/swt-gtk.so
%if 0%{?suse_version} <= 1210
%{_libdir}/eclipse/libswt-mozilla-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-mozilla-gtk.so
%{_libdir}/eclipse/swt-mozilla-gtk.so
%endif
%{_libdir}/eclipse/libswt-pi-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-pi-gtk.so
%{_libdir}/eclipse/swt-pi-gtk.so
%{_libdir}/eclipse/libswt-webkit-gtk-%{so_suffix}.so
%{_libdir}/eclipse/libswt-webkit-gtk.so
%{_libdir}/eclipse/swt-webkit-gtk.so
%{_libdir}/java/swt.jar
%{_libdir}/java/swt-gtk.jar
%{_libdir}/java/swt-gtk-%{version}.jar
%doc about_files/*
%dir %{_libdir}/eclipse
%dir %{_libdir}/java

%changelog
openSUSE Build Service is sponsored by