File icedtea-web.spec of Package icedtea-web

#
# spec file for package icedtea-web
#
# Copyright (c) 2013 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

%ifarch %arm
%define origin icedtea
%else
%define origin openjdk
%endif

# 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} >= 1140
%define xulrunner_ver 20
%endif

%define with_npapisdk 0
%if 0%{?suse_version} > 1140
%define with_npapisdk 1
%endif

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

%define javaver         1.7.0

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

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

Name:           icedtea-web
Version:        1.4.1
Release:        0
Summary:        Java Web Start and plugin implementation
License:        GPL-2.0-with-classpath-exception
Group:          Development/Languages/Java
Url:            http://icedtea.classpath.org
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_7_0-%{origin}-devel
# owns javadocdir
# javapackages-tools now includes jpackage-utils
%if 0%{?suse_version} > 1230
BuildRequires:  javapackages-tools
%else
BuildRequires:  jpackage-utils
%endif
BuildRequires:  libX11-devel
BuildRequires:  libtool
BuildRequires:  pkgconfig >= 0.9.0
BuildRequires:  zlib-devel

# IcedTeaPlugin build requirements.
BuildRequires:  glib2-devel
%if %{with_npapisdk}
BuildRequires:  pkgconfig(npapi-sdk)
#FIXME: use after deprecation of mozilla-xulrunner* packages from Factory
#BuildRequires:  pkgconfig(libxul)
BuildRequires:  xulrunner-devel
%else
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-xulrunner%{xulrunner_ver}-devel
%endif
%if %defined suse_version
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  procps
BuildRequires:  update-desktop-files
BuildRequires:  zip
%endif

# to make sure the new package is installed in time of post
Requires(post):   java-1_7_0-%{origin}
# Post requires alternatives to install tool alternatives.
Requires(post):   update-alternatives
# Postun requires alternatives to uninstall tool alternatives.
Requires(postun): update-alternatives
Provides:       java-plugin = %{javaver}

%ifarch %{ix86} x86_64
# limit the provides/obsoleted only on arches when old package have existed
Provides:       java-1_6_0-openjdk-plugin = %{openjdk_ver}
Obsoletes:      java-1_6_0-openjdk-plugin < %{openjdk_ver}
%endif

# bnc#737105/FATE#313084
Supplements:    packageand(browser(npapi):java-%{origin})

%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 -n %{name}-%{version}
%patch0 -p1
%patch1 -p1

%patch1000 -p1

%build
%{configure} \
    --with-jdk-home=%{_jvmdir}/%{sdkdir} \
    --with-jre-home=%{_jvmdir}/jre/ \
    --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

%check
%{__make} check
%{__make} run-cpp-unit-tests
#FIXME: disabled for the moment as certificate related tests does fail on missing files et all
#export LC_ALL=en_US.UTF-8
#%{__make} run-netx-dist-tests

%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