File icedtea-web.spec of Package icedtea-web.import4832

#
# spec file for package icedtea-web
#
# 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/
#


# this is the right version openjdk for us!
%define openjdk_ver 1.6.0.0_b22.1.10.1

# for openSUSE 11.1 we need use update repo as it were not
# released with this version
%define xulrunner_ver 191
%if 0%{?suse_version} > 1130
%define xulrunner_ver 20
%endif
%if 0%{?suse_version} == 1130
%define xulrunner_ver 192
%endif

%ifarch %{ix86}
%define archinstall i386
%endif
%ifarch x86_64
%define archinstall amd64
%endif
%define priority        17106

%define javaver         1.6.0

# use a same name of alternatives as Sun/IBM Java
%define javaplugin      javaplugin

%define pluginsdir      %{_libdir}/browser-plugins
%define jredir          jre-%{javaver}-openjdk
%define sdkdir          java-%{javaver}-openjdk
%define pluginpath      %{_libdir}
%define pluginname      IcedTeaPlugin.so

%define suse_insert_debug_package ERROR %{suse_insert_debug_package}

Name:           icedtea-web
Version:        1.1
Release:        0.<RELEASE4>
Summary:        Java Web Start and plugin implementation
Group:          Development/Languages/Java
License:        GPLv2 ; - with the OpenJDK Assembly Exception and the GNU Classpath Exception
Url:            http://icedtea.classpath.org
# hg clone http://icedtea.classpath.org/hg/release/icedtea-web-1.1/
# (cd icedtea-web-1.1; ./autogen.sh)
# tar --exclude-vcs -czf icedtea-web-1.1.tar.gz icedtea-web-1.1/
Source0:        http://icedtea.classpath.org/download/source/%{name}-%{version}.tar.gz
Patch0:         icedtea-web-1.0.2-no-return-in-nonvoid-function.patch
#PATCH-FIX-UPSTREAM:
# https://bugzilla.mozilla.org/show_bug.cgi?id=582130
# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=622
Patch1:         icedtea-web-1.1-moonlight-symbol-clash.patch
Patch1000:      icedtea-web-suse-desktop-files.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  java-1_6_0-openjdk-devel
BuildRequires:  pkgconfig >= 0.9.0

# IcedTeaPlugin build requirements.
BuildRequires:  glib2-devel
BuildRequires:  gtk2-devel
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-xulrunner%{xulrunner_ver}-devel
%if %defined suse_version
BuildRequires:  fdupes
BuildRequires:  procps
BuildRequires:  gcc-c++
BuildRequires:  update-desktop-files
BuildRequires:  zip
%endif

# to make sure the new package is installed in time of post
Requires(post):   java-1_6_0-openjdk >= %{openjdk_ver}
# Post requires alternatives to install tool alternatives.
Requires(post):   update-alternatives
# Postun requires alternatives to uninstall tool alternatives.
Requires(postun): update-alternatives

# there were nothing like 1.9.8 in openSUSE
Provides:       java-1_6_0-openjdk-plugin = %{openjdk_ver}
Obsoletes:      java-1_6_0-openjdk-plugin < %{openjdk_ver}
Provides:       java-1.6.0-openjdk-plugin = %{openjdk_ver}
Provides:       java-plugin = %{javaver}

%description
The IcedTea-Web project provides a Free Software web browser plugin running
applets written in the Java programming language and an implementation of Java
Web Start, originally based on the NetX project.
%package javadoc


Summary:        API documentation for %{name}
Group:          Documentation/Other
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description javadoc
This package contains Javadocs for the %{name}.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%patch1000 -p1

%build
%{configure} \
    --with-jdk-home=%{_jvmdir}/%{sdkdir} \
    --docdir=%{_javadocdir}/%{name} \
    --with-pkgversion=suse-%{release}-%{_arch} 

make

%install
%{makeinstall}

# the --program-suffix rename both binaries, so let's handle it here
mv %{buildroot}/%{_bindir}/javaws %{buildroot}/%{_bindir}/itweb-javaws
# and manual page is still used in u-a, so let's move it
mv %{buildroot}/%{_mandir}/man1/javaws.1 %{buildroot}/%{_datadir}/%{name}/
rm -rf %{buildroot}/%{_mandir}

# Install desktop files.
install -d -m 755 %{buildroot}%{_datadir}/{applications,pixmaps}
cp javaws.png %{buildroot}%{_datadir}/pixmaps
for d in javaws itweb-settings; do
   install -m 0644 $d.desktop %{buildroot}/%{_datadir}/applications/
    %suse_update_desktop_file $d
done

# needs for sle-11-sp1 and openSUSE evergreen
export NO_BRP_CHECK_BYTECODE_VERSION=true

%clean
rm -rf %{buildroot}

%posttrans
# java-1_6_0-openjdk-plugin -> icedtea-web is remove of the first package
# which causes a javaplugin removal, so let's move it here
/usr/sbin/update-alternatives \
  --install %{pluginsdir}/javaplugin.so %{javaplugin} \
  %{pluginpath}/%{pluginname} %{priority} \
  --slave %{_bindir}/javaws javaws %{_bindir}/itweb-javaws \
  --slave %{_mandir}/man1/javaws.1 javaws.1 \
  %{_datadir}/%{name}/javaws.1

%postun
if [ $1 -eq 0 ]
then
update-alternatives --remove %{javaplugin} \
    %{pluginpath}/%{pluginname}
fi

%files
%defattr(-,root,root,-)
%doc NEWS README COPYING
%{_bindir}/itweb-settings
%{_bindir}/itweb-javaws
%{pluginpath}/%{pluginname}
%{_datadir}/%{name}
%{_datadir}/applications/itweb-settings.desktop
%{_datadir}/applications/javaws.desktop
%{_datadir}/pixmaps/javaws.png

%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by