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

# this is the right version openjdk for us!
%define openjdk_ver

%ifarch %arm
%define origin icedtea
%define origin openjdk

# 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

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

%ifarch %{ix86}
%define archinstall i386
%ifarch x86_64
%define archinstall amd64
%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

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
Patch0:         icedtea-web-1.0.2-no-return-in-nonvoid-function.patch
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
BuildRequires:  jpackage-utils
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
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-xulrunner%{xulrunner_ver}-devel
%if %defined suse_version
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  procps
BuildRequires:  update-desktop-files
BuildRequires:  zip

# 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}

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

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

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

%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1

%patch1000 -p1

%{configure} \
    --with-jdk-home=%{_jvmdir}/%{sdkdir} \
    --with-jre-home=%{_jvmdir}/jre/ \
    --docdir=%{_javadocdir}/%{name} \



# 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

# needs for sle-11-sp1 and openSUSE evergreen

%{__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

# 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} \
  %{pluginpath}/%{pluginname} %{priority} \
  --slave %{_bindir}/javaws javaws %{_bindir}/itweb-javaws \
  --slave %{_mandir}/man1/javaws.1 javaws.1 \

if [ $1 -eq 0 ]
update-alternatives --remove %{javaplugin} \


%files javadoc

openSUSE Build Service is sponsored by