LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File java-1_7_0-openjdk.spec of Package java-1_7_0-openjdk (Project openSUSE:Factory:ARM)

#
# spec file for package java-1_7_0-openjdk
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%{!?aarch64:%global aarch64 aarch64 arm64 armv8}
%global jit_arches %ix86 x86_64 ppc64 ppc64le
%global test_arches %ix86 x86_64 ppc64 ppc64le
%global icedtea_version 2.5.4
%global icedtea_sound_version 1.0.1
%global mauvedate 2008-10-22
%global buildoutputdir openjdk.build/
# Convert an absolute path to a relative path.  Each symbolic link is
# specified relative to the directory in which it is installed so that
# it will resolve properly within chrooted installations.
%global script 'use File::Spec; print File::Spec->abs2rel($ARGV[0], $ARGV[1])'
%global abs2rel perl -e %{script}
# Standard JPackage naming and versioning defines.
%global priority        17147
%global javaver         1.7.0
%global buildver        75
# Standard JPackage directories and symbolic links.
%global sdklnk          java-%{javaver}-openjdk
%global archname        %{sdklnk}
%global jrelnk          jre-%{javaver}-openjdk
%global sdkdir          %{sdklnk}-%{javaver}
%global jredir          %{sdkdir}/jre
%global sdkbindir       %{_jvmdir}/%{sdklnk}/bin
%global jrebindir       %{_jvmdir}/%{jrelnk}/bin
%global jvmjardir       %{_jvmjardir}/%{sdkdir}
%global jvmjarlink      %{_jvmjardir}/%{sdklnk}
# Prevent brp-java-repack-jars from being run.
%global __jar_repack 0
# cacert symlink
%global cacerts  %{_jvmdir}/%{jredir}/lib/security/cacerts
# real file made by update-ca-certificates
%global javacacerts %{_var}/lib/ca-certificates/java-cacerts
%global with_default_hotspot_tarball 1
# turn zero on non jit arches by default
%ifnarch %{jit_arches}
%global _with_zero 1
%endif
%if 0%{?suse_version} >= 1110
%global with_pulseaudio 1
%else
%global with_pulseaudio 0
%endif
%if 0%{?suse_version} >= 1220
%global with_system_lcms 1
%else
%global with_system_lcms 0
%endif
%ifnarch %{jit_arches}
%global archbuild %{_arch}
%global archinstall %{_arch}
%endif
%ifarch %ix86
%global archbuild i586
%global archinstall i386
%endif
%ifarch x86_64
%global archbuild amd64
%global archinstall amd64
%endif
%ifarch %{arm}
%global archbuild arm
%global archinstall arm
%endif
%ifarch %{aarch64}
%global archbuild aarch64
%global archinstall aarch64
%endif
%ifarch ppc64 ppc64le
%global archbuild ppc64
%global archinstall ppc64
%endif
# bnc#542545
# 32-bit versus 64-bit specific provides:
%ifarch %ix86 ppc s390
%global bits 32
%endif
%ifarch x86_64 ia64 s390x
%global bits 64
%endif
%if 0%{?__isa_bits}
%global bits %{__isa_bits}
%endif
%bcond_with bootstrap
%bcond_with zero
# Turn on/off some features depending on openSUSE version
%if 0%{?suse_version} >= 1130 && ! %{with zero}
%global with_systemtap 1
%else
%global with_systemtap 0
%endif
%if %{with_systemtap}
%global tapsetroot      %{_datadir}/systemtap
%global tapsetdir %{tapsetroot}/tapset/%{_build_cpu}
%endif
%ifarch %{aarch64}
%if ! %{with zero}
%global with_default_hotspot_tarball 0
%endif
%endif
%if %{with bootstrap}
%define _unpackaged_files_terminate_build 0
BuildRequires:  ecj-bootstrap
BuildRequires:  java-1_5_0-gcj-compat-devel
Conflicts:      java-1_7_0-openjdk
%else
#!BuildIgnore:  %{name} %{name}-devel %{name}-headless java java-devel
BuildRequires:  ecj
BuildRequires:  java-bootstrap >= 1.7.0
BuildRequires:  java-bootstrap-devel >= 1.7.0
%endif
Name:           java-1_7_0-openjdk
Version:        %{javaver}.%{buildver}
Release:        0
Summary:        Java runtime environment based on OpenJDK 7 and IcedTea 7
License:        GPL-2.0-with-classpath-exception
Group:          Development/Languages/Java
Url:            http://icedtea.classpath.org
Source0:        http://icedtea.classpath.org/download/source/icedtea-%{icedtea_version}.tar.xz
Source1:        http://icedtea.classpath.org/download/source/icedtea-sound-%{icedtea_sound_version}.tar.xz
# Mauve test suite
# FIXME: Is this applicable for 7?
Source3:        mauve-%{mauvedate}.tar.gz
Source4:        mauve_tests
Source5:        http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/openjdk.tar.bz2
Source6:        http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/corba.tar.bz2
Source7:        http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/jaxp.tar.bz2
Source8:        http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/jaxws.tar.bz2
Source9:        http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/jdk.tar.bz2
Source10:       http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/langtools.tar.bz2
Source11:       http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/hotspot.tar.bz2
Source12:       http://icedtea.classpath.org/download/drops/icedtea7/%{icedtea_version}/aarch64.tar.bz2
# those properties are for opeSUSE only
Source1001:     fontconfig.SUSE.properties
Source2000:     http://icedtea.classpath.org/download/source/icedtea-%{icedtea_version}.tar.xz.sig
Source2001:     http://icedtea.classpath.org/download/source/icedtea-sound-%{icedtea_sound_version}.tar.xz.sig
Source2002:     java-1_7_0-openjdk.keyring
Source2500:     pre_checkin.sh
# RPM/distribution specific patches
# Remove the use of __DATE__ and __TIME__ in order to diminish unnecessary rebuilds
Patch2:         file-contains-date-and-time.patch
# Disable access to access-bridge packages by untrusted apps
Patch3:         java-1.7.0-openjdk-java-access-bridge-security.patch
# Ignore AWTError when assistive technologies are loaded
Patch4:         java-1.7.0-openjdk-accessible-toolkit.patch
#
# OpenJDK specific patches
#
# Fix build with giflib5
Patch105:       java-1_7_0-openjdk-giflib5.patch
Patch106:       java-1.7.0-openjdk-freetype-check-fix.patch
# Fix use of unintialized memory in adlc parser
Patch107:       java-1.7.0-openjdk-adlc-parser.patch
# Increase default thread stack size
Patch108:       java-1.7.0-openjdk-thread-stack-size.patch
# allow to create hs_pid.log in tmp (in 700 permissions) if working directory is unwritable
Patch200:       abrt_friendly_hs_log_jdk7.patch
#
# Optional component packages
#
Patch403:       PStack-808293.patch
Patch404:       RH661505-toBeReverted.patch
# End of tmp patches
# SUSE patches - from java-1_6_0-openjdk package
Patch1000:      java-1_7_0-openjdk-suse-desktop-files.patch
Patch1001:      openjdk-7-src-b147-no-return-in-nonvoid.patch
Patch1002:      openjdk-7-src-b147-stringcompare.patch
# PATCH-FIX-OPENSUSE: limit the maximum heap size of a rewriter - it fails on some servers
Patch1003:      java-1_7_0-openjdk-add-memory-limit.patch
Patch1004:      java-1_7_0-openjdk-zero-annotate-aborting-functions-zero.patch
# Avoid too much silence from javadoc
Patch1005:      java-1_7_0-openjdk-javadoc-verbose.patch
Patch1006:      java-1_7_0-openjdk-override.patch
Patch10011:     openjdk-7-src-b147-no-return-in-nonvoid-hotspot.patch
BuildRequires:  alsa-lib-devel
#BuildRequires:  xalan-j2
# make sure to use bootstrap requires of ant
#BuildRequires:  xerces-j2-bootstrap
#!BuildIgnore: xerces-j2 xml-commons-resolver xml-commons-apis xml-commons
BuildRequires:  ant
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cups-devel
BuildRequires:  desktop-file-utils
BuildRequires:  fastjar
BuildRequires:  fdupes
BuildRequires:  gawk
BuildRequires:  gcc-c++
BuildRequires:  giflib-devel
BuildRequires:  gtk2-devel
BuildRequires:  jpackage-utils >= 1.7.5
BuildRequires:  krb5-devel
# can be disabled using --disable-compile-against-syscalls
BuildRequires:  libattr-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  mozilla-nss-devel
BuildRequires:  perl
BuildRequires:  procps
BuildRequires:  rhino
BuildRequires:  unzip
BuildRequires:  update-desktop-files
# ignore depenencies of rhino to prevent a build cycle
#!BuildIgnore:  bea-stax-api jline xmlbeans xmlbeans-mini
BuildRequires:  wget
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-devel
BuildRequires:  xorg-x11-proto-devel
BuildRequires:  xz
BuildRequires:  zip
BuildRequires:  zlib-devel
#require headless subvariant
Requires:       %{name}-headless = %{version}-%{release}
# mozilla-nss has to be installed to prevent
# java.security.ProviderException: Could not initialize NSS
# ...
# java.io.FileNotFoundException: /usr/lib64/libnss3.so
#was bnc#634793
Requires:       mozilla-nss
Requires(pre):  update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# Standard JPackage base provides.
%if ! %{with bootstrap}
Provides:       java = %{javaver}
Provides:       java-%{javaver} = %{version}-%{release}
Provides:       java-%{javaver}-openjdk = %{version}-%{release}
Provides:       java-openjdk = %{version}-%{release}
Provides:       jre = %{javaver}
Provides:       jre-%{javaver} = %{version}-%{release}
Provides:       jre-%{javaver}-openjdk = %{version}-%{release}
Provides:       jre-openjdk = %{version}-%{release}
# Standard JPackage extensions provides.
Provides:       jaas = %{version}
Provides:       java-sasl = %{version}
Provides:       jce = %{version}
Provides:       jdbc-stdext = %{version}
Provides:       jdbc-stdext = 4.1
Provides:       jndi = %{version}
Provides:       jndi-cos = %{version}
Provides:       jndi-dns = %{version}
Provides:       jndi-ldap = %{version}
Provides:       jndi-rmi = %{version}
Provides:       jsse = %{version}
# Required at least by fop
Provides:       java-%{bits} = %{javaver}
Provides:       java-%{javaver}-%{bits}
Provides:       java-openjdk-%{bits} = %{version}-%{release}
Provides:       jre-%{bits} = %{javaver}
Provides:       jre-%{javaver}-%{bits}
Provides:       jre-%{javaver}-openjdk-%{bits} = %{version}-%{release}
Provides:       jre-openjdk-%{bits} = %{version}-%{release}
Provides:       jre1.3.x
Provides:       jre1.4.x
Provides:       jre1.5.x
Provides:       jre1.6.x
Provides:       jre1.7.x
%else
Provides:       java-bootstrap = %{javaver}
%endif
# Reduce build time from 27 hours to 12 hours by only running test
# suites on JIT architectures.
%ifarch %{test_arches}
%bcond_with tests
%endif
%if %{with_system_lcms}
# since 2.4.1 release, newest lcms2 is needed
BuildRequires:  liblcms2-devel >= 2.5
%endif
%if 0%{?suse_version} < 1200
BuildRequires:  libxslt
%else
%if 0%{?suse_version} < 1220
BuildRequires:  libxslt1
%else
BuildRequires:  libxslt-tools
%endif
%endif
%if 0%{?suse_version} >= 1220
BuildRequires:  xprop
%endif
# Mauve build requirements.
%if %{with tests}
BuildRequires:  ecj
BuildRequires:  fontconfig
BuildRequires:  freetype2-devel >= 2.3.0
BuildRequires:  xorg-x11-fonts
# for Xvfb
BuildRequires:  xorg-x11-server
BuildRequires:  xorg-x11-server-extra
%endif
# pulse audio requirements
%if %{with_pulseaudio}
BuildRequires:  libpulse-devel >= 0.9.11
BuildRequires:  pulseaudio >= 0.9.11
%endif
#system tap
%if %{with_systemtap}
BuildRequires:  systemtap-sdt-devel >= 1.0
%endif
%if 0%{?suse_version} > 1110
#the /etc/SUSE-release is needed as well
BuildRequires:  distribution-release
#fixing RedHat bug #648499
BuildRequires:  lsb-release
%endif
# runtime certificates generation available in 11.3+ - bnc#596177
%if 0%{?suse_version} >= 1130
BuildRequires:  java-ca-certificates
Requires(post): file
Requires(post): java-ca-certificates
%else
BuildRequires:  openssl-certs
# the certificates will converted in a prep to standard keystore file - cacerts
# The openssl requirment seems to be necessary for build only.
Requires:       openssl
%endif
%if 0%{?suse_version} >= 1230
BuildRequires:  gpg-offline
%endif
# Zero-assembler build requirement.
%if %{with zero}
BuildRequires:  libffi-devel
%endif

%description
This Java 7 compatible Java Runtime Environment is based on OpenJDK 7
and IcedTea 7.

It contains a Java virtual machine, runtime class libraries, and an
Java application launcher that are necessary to run programs written in
the Java progamming language. It is not a development environment and
does not contain development tools such as compilers and debuggers. For
development tools, see the %{name}-devel package.

%package headless
Summary:        JRE based on OpenJDK 7 and IcedTea 7 without X, audio and video support
Group:          Development/Languages/Java
Requires(pre):  update-alternatives
%if ! %{with bootstrap}
# Require zoneinfo data provided by tzdata-java subpackage.
Requires:       tzdata-java
Provides:       java-headless = %{version}-%{release}
Provides:       java-openjdk-headless = %{version}-%{release}
Provides:       jre-%{javaver}-headless = %{version}-%{release}
Provides:       jre-%{javaver}-openjdk-headless = %{version}-%{release}
Provides:       jre-headless = %{version}-%{release}
Provides:       jre-openjdk-headless = %{version}-%{release}
#FIXME: add extensions provides? Would not it be better to require full JRE?
# from http://en.opensuse.org/openSUSE:Package_dependencies#Splitting_off_a_sub-package
# provides a libjvm.so to ensure update is working well
Provides:       %{name}:%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server/libjvm.so
%else
Conflicts:      java-1_7_0-openjdk-headless
%endif
%if %{with_system_lcms}
# older lcms2 is known to have security issues, let's depends on fixed version
Requires:       lcms2 >= 2.5
%endif

%description headless
This Java 7 compatible Java Runtime Environment is based on
OpenJDK 7 and IcedTea 7. This build is without X, audio and
video support. If you need it, please install %{name}.

It contains a Java virtual machine, runtime class libraries, and an
Java application launcher that are necessary to run programs written in
the Java progamming language. It is not a development environment and
does not contain development tools such as compilers and debuggers. For
development tools, see the %{name}-devel package.

%package devel
Summary:        Java SDK based on OpenJDK 7 and IcedTea 7
Group:          Development/Languages/Java
Requires:       %{name} = %{version}-%{release}
Requires(pre):  %{_sbindir}/update-alternatives
%if ! %{with bootstrap}
Provides:       java-%{javaver}-devel = %{version}
Provides:       java-%{javaver}-openjdk-devel = %{version}-%{release}
Provides:       java-devel = %{javaver}
Provides:       java-devel-openjdk = %{version}
Provides:       java-sdk = %{javaver}
Provides:       java-sdk-%{javaver} = %{version}
Provides:       java-sdk-%{javaver}-openjdk = %{version}
Provides:       java-sdk-openjdk = %{version}
%else
Provides:       java-bootstrap-devel = %{javaver}
Conflicts:      java-1_7_0-openjdk-devel
%endif

%description devel
This Java 7 compatible Java SDK is based on OpenJDK 7 and IcedTea 7.

The Java 7 SDK is a development environment for building applications,
applets, and components using the Java programming language.

The Java 7 SDK includes tools useful for developing and testing
programs written in the Java programming language and running on the
Java platform. These tools are designed to be used from the command
line. Except for the appletviewer, these tools do not provide a
graphical user interface.

%if ! %{with bootstrap}
%package demo
Summary:        Sources for building demo applications with OpenJDK 7
Group:          Development/Languages/Java
Requires:       %{name}-devel = %{version}-%{release}
Provides:       java-%{javaver}-openjdk-demo = %{version}-%{release}

%description demo
This package provides sources of demonstration applications for OpenJDK
7 and is intented for aspiring Java developers which want to learn
about the features of OpenJDK 7.

%package src
Summary:        OpenJDK 7 Java class sources for developers
Group:          Development/Languages/Java
Requires:       %{name}-devel = %{version}-%{release}

%description src
This package provides Java Runtime librarcy class sources of OpenJDK 7
and is intented for developers which may need them for investigating
problems.

%package javadoc
Summary:        Documentation of the Java API of OpenJDK 7
Group:          Development/Languages/Java
Requires(pre):  %{_sbindir}/update-alternatives
Provides:       java-%{javaver}-javadoc = %{version}-%{release}
Provides:       java-%{javaver}-openjdk-javadoc = %{version}-%{release}
Provides:       java-javadoc = %{version}-%{release}
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description javadoc
This package provides documentation of the API provided by OpenJDK 7
and is intented for Java developers which need to which API features
are provided by OpenJDK 7.

%package accessibility
Summary:        Accessibility connector for OpenJDK 7
Group:          Development/Languages/Java
Requires:       %{name} = %{version}-%{release}
Requires:       java-atk-wrapper

%description accessibility
Enables accessibility support in OpenJDK by using java-at-wrapper. This allows
compatible at-spi2 based accessibility programs to work for AWT and Swing-based
programs.  Please note, the java-atk-wrapper is still in beta, and also OpenJDK
itself is still in phase of tuning to be working with accessibility features.
Although working pretty fine, there are known issues with accessibility on, so
do not rather install this package unless you really need.

%endif

%prep
#%if 0%{?suse_version} >= 1230
#gpg_verify -f %{SOURCE2002} %{SOURCE2000}
#gpg_verify -f %{SOURCE2002} %{SOURCE2001}
#%endif

%setup -q -n icedtea-%{icedtea_version} -a 3
%setup -q -D -n icedtea-%{icedtea_version} -T -a 1

cp %{SOURCE4} .

%patch1000 -p1
%patch1003 -p1

%build
export LANG=C
unset JAVA_HOME

# How many cpu's do we have?
export NUM_PROC=`%{_bindir}/getconf _NPROCESSORS_ONLN 2> /dev/null || :`
export NUM_PROC=${NUM_PROC:-1}

# handle zlib packages without pkg-config file
%if 0%{?suse_version} <= 1130
export ZLIB_CFLAGS=" "
export ZLIB_LIBS="-L/%{_lib} -lz"
%endif

%if %{with bootstrap}
# We'll use gcj for bootstrapping.  We need a javac that
# can compile language version 7.  The ecj.jar used by gcj does
# support that level, but gcj doesn't allow us to set it (-fsource
# only allows up to level 6) gcj also has imcompatible options from javac
# which we could translate with a wrapper script, but then again we
# wouldn't be able to use level 7 (and the equivalent to -sourcepath
# is missing anyway).  So instead write a wrapper that directly uses
# the ecj.jar file from the gcj package.  It's interface is a normal
# javac one.
JAVAC=`pwd`/javacwrap
ECJJAR=`gcc -print-file-name=ecj.jar`
cat <<EOF > $JAVAC
#!/bin/sh
exec gij -cp $ECJJAR org.eclipse.jdt.internal.compiler.batch.Main \${1+\$@}
EOF
chmod +x ${JAVAC}
%endif

export CFLAGS=$(rpm -E '%{optflags}' | sed 's/-Wall\>//')
export CXXFLAGS=${CFLAGS}
sh autogen.sh
%configure \
%if %{with bootstrap}
        --enable-bootstrap \
        --enable-bootstrap-tools \
        --with-javac=${JAVAC} \
        --disable-docs \
%else
        --disable-bootstrap \
%endif
        --disable-infinality \
        --disable-downloading \
        --with-abs-install-dir=%{_jvmdir}/%{sdkdir} \
%ifnarch %{arm} %{aarch64}
        --with-parallel-jobs="${NUM_PROC}" \
%endif
        --with-pkgversion="suse-%{release}-%{_arch}" \
        --with-jdk-home="%{_sysconfdir}/alternatives/java_sdk" \
%if %{with_systemtap}
        --enable-systemtap \
%endif
        --enable-nss \
%if %{with zero}
        --enable-zero \
%endif
%if 0%{?suse_version} <= 1110
        --disable-system-gio \
%endif
%if %{with_system_lcms}
        --enable-system-lcms \
%else
        --disable-system-lcms \
%endif
        --with-openjdk-src-zip=%{SOURCE5} \
        --with-corba-src-zip=%{SOURCE6} \
        --with-jaxp-src-zip=%{SOURCE7} \
        --with-jaxws-src-zip=%{SOURCE8} \
        --with-jdk-src-zip=%{SOURCE9} \
        --with-langtools-src-zip=%{SOURCE10} \
%if %{with_default_hotspot_tarball}
        --with-hotspot-build=default \
        --with-hotspot-src-zip=%{SOURCE11}
%else
        --with-hotspot-src-zip=%{SOURCE12}
%endif

make patch %{?_smp_mflags}

patch -p0 -i %{PATCH2}

%if %{with_default_hotspot_tarball}
patch -p0 -i %{PATCH3}
patch -p0 -i %{PATCH4}

patch -p0 -i %{PATCH106}
patch -p0 -i %{PATCH108}
patch -p0 -i %{PATCH200}

%if ! %{with zero}
patch -p0 -i %{PATCH403}
%endif
%endif

patch -p0 -i %{PATCH105}
patch -p0 -i %{PATCH107}

patch -p0 -R -i %{PATCH404}

#SUSE specific fixes
patch -p1 -i %{PATCH1002}

%if %{with zero}
patch -p0 -i %{PATCH1004}
patch -p1 -i %{PATCH1005}

#XXX: there are many issues in hotspot 2.1, but I would say noone will fix them
#     so ignore all Werror like troubles we can find
find . -name '*.gmk' -or -name '*.make' | xargs -L 1 \
    sed -i 's/-Wno-unused//;s/WARNINGS_ARE_ERRORS = -Werror//;s/CFLAGS_WARN = -Werror//;s/CFLAGS_WARN = -Werror//'
%endif

patch -p1 -i %{PATCH1001}

%if %{with_default_hotspot_tarball}
patch -p1 -i %{PATCH10011}
%endif

%if %{with bootstrap}
patch -p0 -i %{PATCH1006}
%endif

make %{?_smp_mflags}

export JAVA_HOME=$(pwd)/%{buildoutputdir}/j2sdk-image
# cacerts are generated in runtime in openSUSE
if [ -f %{buildoutputdir}/j2sdk-image/jre/lib/security/cacerts ]; then
        rm %{buildoutputdir}/j2sdk-image/jre/lib/security/cacerts
fi

%if 0%{?suse_version} < 1130
# ========== a default keystore ==========
# a cacerts generation - 11.3+ use java-ca-certificates package
for PEM in %{_sysconfdir}/ssl/certs/*.pem; do
    ALIAS=$(basename ${PEM} .pem)
    awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/{ print $0; }' ${PEM} > ${ALIAS}.pem

    yes | $JAVA_HOME/jre/bin/keytool -import -alias ${ALIAS} -keystore %{buildoutputdir}/j2sdk-image/jre/lib/security/cacerts -storepass 'changeit' -file ${ALIAS}.pem || :
    rm ${ALIAS}.pem
done
%endif

%if %{with_pulseaudio}
# Build the pulseaudio plugin
pushd icedtea-sound-%{icedtea_sound_version}
%configure \
    --with-jdk-home=$JAVA_HOME \
    --disable-docs
make %{?_smp_mflags}
cp icedtea-sound.jar $JAVA_HOME/jre/lib/ext/
cp build/native/libicedtea-sound.so $JAVA_HOME/jre/lib/%{archinstall}/
echo "#Config file to enable PulseAudio support" > $JAVA_HOME/jre/lib/pulseaudio.properties
echo "" >> $JAVA_HOME/jre/lib/pulseaudio.properties
echo "javax.sound.sampled.Clip=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider" >> $JAVA_HOME/jre/lib/pulseaudio.properties
echo "javax.sound.sampled.Port=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider" >> $JAVA_HOME/jre/lib/pulseaudio.properties
echo "javax.sound.sampled.SourceDataLine=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider" >> $JAVA_HOME/jre/lib/pulseaudio.properties
echo "javax.sound.sampled.TargetDataLine=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider" >> $JAVA_HOME/jre/lib/pulseaudio.properties
echo "" >> $JAVA_HOME/jre/lib/pulseaudio.properties
popd
%endif

# Copy tz.properties
echo "sun.zoneinfo.dir=%{_datadir}/javazi" >> $JAVA_HOME/jre/lib/tz.properties

%if %{with tests}
%check
# Run jtreg test suite.
export JAVA_HOME=$(pwd)/%{buildoutputdir}/j2sdk-image
{
  echo ====================JTREG TESTING========================

  # remove tests, which hangs
  rm -rf openjdk*/jdk/test/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java

  NUM=${RANDOM}
  rm -rf /tmp/.X${NUM}-lock /tmp/.X11-unix/X${NUM}
  export DISPLAY=:${NUM}
  strace -f -o xvfb.strace Xvfb ${DISPLAY} -screen 0 1x1x24 -ac&
  echo $! > Xvfb.pid
  if ! kill -0 $(< Xvfb.pid) &> /dev/null; then
    echo "ERROR: Xvfb does not run"
    exit 1
  fi
  strace -f -o make.jtregcheck.strace make --debug=j jtregcheck -k %{?_smp_mflags}
  kill -9 $(< Xvfb.pid)
  unset DISPLAY
  rm -f Xvfb.pid
  echo ====================JTREG TESTING END====================
} || :

# Run Mauve test suite.
{
  pushd mauve-%{mauvedate}
    ./configure
    make %{?_smp_mflags}
    echo ====================MAUVE TESTING========================
    NUM=${RANDOM}
    rm -rf /tmp/.X${NUM}.lock /tmp/.X11-unix/X${NUM}
    export DISPLAY=:${NUM}
    Xvfb ${DISPLAY} -screen 0 1x1x24 -ac&
    echo $! > Xvfb.pid
    if ! kill -0 $(< Xvfb.pid) &> /dev/null; then
        echo "ERROR: Xvfb does not run"
        exit 1
    fi
    $JAVA_HOME/bin/java Harness -vm $JAVA_HOME/bin/java \
      -file %{SOURCE6} -timeout 30000 2>&1 | tee mauve_output
    kill -9 `cat Xvfb.pid`
    unset DISPLAY
    rm -f Xvfb.pid
    echo ====================MAUVE TESTING END====================
  popd
} || :
%endif

%install
export LANG=en_US.UTF-8
#bnc#530046
export STRIP_KEEP_SYMTAB=libjvm*
# skip /usr/lib/rpm/brp-check-bytecode-version:
export NO_BRP_CHECK_BYTECODE_VERSION=true

pushd %{buildoutputdir}/j2sdk-image
  # Install main files.
  install -d -m 755 %{buildroot}%{_jvmdir}/%{sdkdir}
  cp -a bin include lib src.zip %{buildroot}%{_jvmdir}/%{sdkdir}

  install -d -m 755 %{buildroot}%{_jvmdir}/%{jredir}
  cp -a jre/bin jre/lib %{buildroot}%{_jvmdir}/%{jredir}
  # bnc#438674
  # Install a fontconfig file which don't reffer to agfa-fonts on openSUSE
  cp %{SOURCE1001} %{buildroot}%{_jvmdir}/%{jredir}/lib/

  popd

%if %{with_systemtap}
  # Install systemtap support files.
  cp -a tapset %{buildroot}%{_jvmdir}/%{sdkdir}
  install -d -m 755 %{buildroot}%{tapsetdir}
  pushd %{buildroot}%{tapsetdir}
    RELATIVE=$(%{abs2rel} %{_jvmdir}/%{sdkdir}/tapset %{tapsetdir})
    ln -sf $RELATIVE/*.stp .
  popd
%endif

  pushd %{buildoutputdir}/j2sdk-image

  # Install extension symlinks.
  install -d -m 755 %{buildroot}%{jvmjardir}
  pushd %{buildroot}%{jvmjardir}
    RELATIVE=$(%{abs2rel} %{_jvmdir}/%{jredir}/lib %{jvmjardir})
    ln -sf $RELATIVE/jsse.jar jsse-%{version}.jar
    ln -sf $RELATIVE/jce.jar jce-%{version}.jar
    ln -sf $RELATIVE/rt.jar jndi-%{version}.jar
    ln -sf $RELATIVE/rt.jar jndi-ldap-%{version}.jar
    ln -sf $RELATIVE/rt.jar jndi-cos-%{version}.jar
    ln -sf $RELATIVE/rt.jar jndi-rmi-%{version}.jar
    ln -sf $RELATIVE/rt.jar jaas-%{version}.jar
    ln -sf $RELATIVE/rt.jar jdbc-stdext-%{version}.jar
    ln -sf jdbc-stdext-%{version}.jar jdbc-stdext-3.0.jar
    ln -sf $RELATIVE/rt.jar sasl-%{version}.jar
    for jar in *-%{version}.jar
    do
      if [ x%{version} != x%{javaver} ]
      then
        ln -sf $jar $(echo $jar | sed "s|-%{version}.jar|-%{javaver}.jar|g")
      fi
      ln -sf $jar $(echo $jar | sed "s|-%{version}.jar|.jar|g")
    done
  popd

  # Install JCE policy symlinks.
  install -d -m 755 %{buildroot}%{_jvmprivdir}/%{archname}/jce/vanilla

  # Install versionless symlinks.
  pushd %{buildroot}%{_jvmdir}
    ln -sf %{jredir} %{jrelnk}
    ln -sf %{sdkdir} %{sdklnk}
  popd

  pushd %{buildroot}%{_jvmjardir}
    ln -sf %{sdkdir} %{jrelnk}
    ln -sf %{sdkdir} %{sdklnk}
  popd

  # Install man pages.
  install -d -m 755 %{buildroot}%{_mandir}/man1
  for manpage in man/man1/*
  do
    # Convert man pages to UTF8 encoding.
    iconv -f ISO_8859-1 -t UTF8 $manpage -o $manpage.tmp
    mv -f $manpage.tmp $manpage
    install -m 644 -p $manpage %{buildroot}%{_mandir}/man1/$(basename \
      $manpage .1)-%{sdklnk}.1
  done
  # Install demos and samples.
  cp -a demo %{buildroot}%{_jvmdir}/%{sdkdir}
  # enable short-circuit
  mkdir -p sample/rmi
  [ -f bin/java-rmi.cgi ] && mv bin/java-rmi.cgi sample/rmi
  # fix: non-executable-script
  [ -f sample/rmi/java-rmi.cgi ] && chmod +x sample/rmi/java-rmi.cgi
  cp -a sample %{buildroot}%{_jvmdir}/%{sdkdir}

popd

%if ! %{with bootstrap}

# Install Javadoc documentation.
install -d -m 755 %{buildroot}%{_javadocdir}
cp -a %{buildoutputdir}/docs %{buildroot}%{_javadocdir}/%{sdklnk}

%endif

# Install icons and menu entries.
for s in 16 24 32 48 ; do
  install -D -p -m 644 \
    openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${s}.png \
    %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/java.png
done

# Install desktop files.
install -d -m 0755 %{buildroot}%{_datadir}/pixmaps
install -d -m 0755 %{buildroot}/%{_jvmdir}/%{sdkdir}/jre/lib/desktop/
for d in jconsole policytool; do
    install -m 0644 $d.desktop %{buildroot}/%{_jvmdir}/%{sdkdir}/jre/lib/desktop/
    %suse_update_desktop_file %{buildroot}/%{_jvmdir}/%{sdkdir}/jre/lib/desktop/$d.desktop
done

# Create links which leads to separately installed java-atk-bridge and allow configuration
# links points to java-atk-wrapper - an dependence
# mvyskocil: links are handled in post, lets make ghost files there
  touch %{buildroot}/%{_jvmdir}/%{jredir}/lib/%{archinstall}/libatk-wrapper.so
  touch %{buildroot}/%{_jvmdir}/%{jredir}/lib/ext/java-atk-wrapper.jar
  pushd %{buildroot}/%{_jvmdir}/%{jredir}/lib/
    echo "#Config file to  enable java-atk-wrapper" > accessibility.properties
    echo "" >> accessibility.properties
    echo "assistive_technologies=org.GNOME.Accessibility.AtkWrapper" >> accessibility.properties
    echo "" >> accessibility.properties
  popd

# fdupes links the files from JDK to JRE, so it breaks a JRE
# use it carefully :))
%fdupes -s %{buildroot}/%{_jvmdir}/%{jredir}/
%fdupes -s %{buildroot}/%{_jvmdir}/%{sdkdir}/demo
%fdupes -s %{buildroot}%{_javadocdir}/%{sdklnk}

%if 0%{?suse_version} <= 1130
# bnc496378 - check the size of installed cacerts
# 32 bytes means a default empty one
if [[ $(stat -c "%{s}" %{buildroot}/%{cacerts}) == "32" ]]; then
    echo "ERROR: Default keystore seems empty"
    exit 1
fi
%endif

%post headless
ext=.gz
update-alternatives \
  --install %{_bindir}/java java %{jrebindir}/java %{priority} \
  --slave %{_jvmdir}/jre jre %{_jvmdir}/%{jrelnk} \
  --slave %{_jvmjardir}/jre jre_exports %{_jvmjardir}/%{jrelnk} \
  --slave %{_bindir}/keytool keytool %{jrebindir}/keytool \
  --slave %{_bindir}/orbd orbd %{jrebindir}/orbd \
  --slave %{_bindir}/policytool policytool %{jrebindir}/policytool \
  --slave %{_bindir}/rmid rmid %{jrebindir}/rmid \
  --slave %{_bindir}/rmiregistry rmiregistry %{jrebindir}/rmiregistry \
  --slave %{_bindir}/servertool servertool %{jrebindir}/servertool \
  --slave %{_bindir}/tnameserv tnameserv %{jrebindir}/tnameserv \
  --slave %{_mandir}/man1/java.1$ext java.1$ext \
  %{_mandir}/man1/java-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/keytool.1$ext keytool.1$ext \
  %{_mandir}/man1/keytool-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/orbd.1$ext orbd.1$ext \
  %{_mandir}/man1/orbd-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/policytool.1$ext policytool.1$ext \
  %{_mandir}/man1/policytool-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/rmid.1$ext rmid.1$ext \
  %{_mandir}/man1/rmid-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/rmiregistry.1$ext rmiregistry.1$ext \
  %{_mandir}/man1/rmiregistry-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/servertool.1$ext servertool.1$ext \
  %{_mandir}/man1/servertool-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/tnameserv.1$ext tnameserv.1$ext \
  %{_mandir}/man1/tnameserv-%{sdklnk}.1$ext  \
  --slave %{_datadir}/applications/policytool.desktop policytool.desktop \
  %{_jvmdir}/%{sdkdir}/jre/lib/desktop/policytool.desktop

update-alternatives \
  --install %{_jvmdir}/jre-openjdk \
  jre_openjdk %{_jvmdir}/%{jrelnk} %{priority} \
  --slave %{_jvmjardir}/jre-openjdk \
  jre_openjdk_exports %{_jvmjardir}/%{jrelnk}
update-alternatives \
  --install %{_jvmdir}/jre-%{javaver} \
  jre_%{javaver} %{_jvmdir}/%{jrelnk} %{priority} \
  --slave %{_jvmjardir}/jre-%{javaver} \
  jre_%{javaver}_exports %{_jvmjardir}/%{jrelnk}

%postun headless
if [ $1 -eq 0 ]
then
  if test -f /proc/sys/fs/binfmt_misc/jarexec
  then
    echo '-1' > /proc/sys/fs/binfmt_misc/jarexec
  fi
  update-alternatives --remove java %{jrebindir}/java
  update-alternatives --remove jre_openjdk %{_jvmdir}/%{jrelnk}
  update-alternatives --remove jre_%{javaver} %{_jvmdir}/%{jrelnk}
fi

%if 0%{?suse_version} >= 1130
%posttrans headless
# bnc#781690#c11: don't trust user defined JAVA_HOME and use the current VM
# XXX: this might conflict between various versions of openjdk
export JAVA_HOME=%{_jvmdir}/%{jrelnk}

# check if the java-cacerts is a valid keystore (bnc#781690)
if [ X"`%{_bindir}/file --mime-type -b %{javacacerts}`" \
    != "Xapplication/x-java-keystore;" ]; then
%if 0%{?suse_version} <= 1310
    # workaround for bnc#847952 - pre 13.1 keyring.jar attempts to load invalid keystore and fail on it
    rm -f "%{javacacerts}"
%endif
    %{_sbindir}/update-ca-certificates
fi

# remove the default empty cacert file, if it's installed
if [ 0`stat -c "%{s}" %{cacerts} 2>/dev/null` = "032" ] ; then
    rm -f %{cacerts}
fi

# if cacerts does exists, neither does not contain/point to a
# valid keystore (bnc#781690) ...
if [ X"`%{_bindir}/file --mime-type -b -L %{cacerts}`" \
    != "Xapplication/x-java-keystore;" ]; then
    # bnc#727223
    rm -f %{cacerts}
    ln -s %{javacacerts} %{cacerts}
fi
%endif

%post devel
ext=.gz
update-alternatives \
  --install %{_bindir}/javac javac %{sdkbindir}/javac %{priority} \
  --slave %{_jvmdir}/java java_sdk %{_jvmdir}/%{sdklnk} \
  --slave %{_jvmjardir}/java java_sdk_exports %{jvmjarlink} \
  --slave %{_bindir}/appletviewer appletviewer %{sdkbindir}/appletviewer \
  --slave %{_bindir}/apt apt %{sdkbindir}/apt \
  --slave %{_bindir}/extcheck extcheck %{sdkbindir}/extcheck \
  --slave %{_bindir}/jar jar %{sdkbindir}/jar \
  --slave %{_bindir}/jarsigner jarsigner %{sdkbindir}/jarsigner \
  --slave %{_bindir}/javadoc javadoc %{sdkbindir}/javadoc \
  --slave %{_bindir}/javah javah %{sdkbindir}/javah \
  --slave %{_bindir}/javap javap %{sdkbindir}/javap \
  --slave %{_bindir}/jconsole jconsole %{sdkbindir}/jconsole \
  --slave %{_bindir}/pack200                  pack200                     %{sdkbindir}/pack200 \
  --slave %{_bindir}/unpack200                unpack200                   %{sdkbindir}/unpack200 \
  --slave %{_bindir}/jdb jdb %{sdkbindir}/jdb \
  --slave %{_bindir}/jhat jhat %{sdkbindir}/jhat \
  --slave %{_bindir}/jinfo jinfo %{sdkbindir}/jinfo \
  --slave %{_bindir}/jmap jmap %{sdkbindir}/jmap \
  --slave %{_bindir}/jps jps %{sdkbindir}/jps \
  --slave %{_bindir}/jrunscript jrunscript %{sdkbindir}/jrunscript \
  --slave %{_bindir}/jsadebugd jsadebugd %{sdkbindir}/jsadebugd \
  --slave %{_bindir}/jstack jstack %{sdkbindir}/jstack \
  --slave %{_bindir}/jstat jstat %{sdkbindir}/jstat \
  --slave %{_bindir}/jstatd jstatd %{sdkbindir}/jstatd \
  --slave %{_bindir}/native2ascii native2ascii %{sdkbindir}/native2ascii \
  --slave %{_bindir}/rmic rmic %{sdkbindir}/rmic \
  --slave %{_bindir}/schemagen schemagen %{sdkbindir}/schemagen \
  --slave %{_bindir}/serialver serialver %{sdkbindir}/serialver \
  --slave %{_bindir}/wsgen wsgen %{sdkbindir}/wsgen \
  --slave %{_bindir}/wsimport wsimport %{sdkbindir}/wsimport \
  --slave %{_bindir}/xjc xjc %{sdkbindir}/xjc \
  --slave %{_mandir}/man1/appletviewer.1$ext appletviewer.1$ext \
  %{_mandir}/man1/appletviewer-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/apt.1$ext apt.1$ext \
  %{_mandir}/man1/apt-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/extcheck.1$ext extcheck.1$ext \
  %{_mandir}/man1/extcheck-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jar.1$ext jar.1$ext \
  %{_mandir}/man1/jar-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jarsigner.1$ext jarsigner.1$ext \
  %{_mandir}/man1/jarsigner-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/javac.1$ext javac.1$ext \
  %{_mandir}/man1/javac-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/javadoc.1$ext javadoc.1$ext \
  %{_mandir}/man1/javadoc-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/javah.1$ext javah.1$ext \
  %{_mandir}/man1/javah-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/javap.1$ext javap.1$ext \
  %{_mandir}/man1/javap-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jconsole.1$ext jconsole.1$ext \
  %{_mandir}/man1/jconsole-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jcmd.1$ext jcmd.1$ext \
  %{_mandir}/man1/jcmd-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jdb.1$ext jdb.1$ext \
  %{_mandir}/man1/jdb-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/pack200.1$ext pack200.1$ext \
  %{_mandir}/man1/pack200-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/unpack200.1$ext unpack200.1$ext \
  %{_mandir}/man1/unpack200-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jhat.1$ext jhat.1$ext \
  %{_mandir}/man1/jhat-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jinfo.1$ext jinfo.1$ext \
  %{_mandir}/man1/jinfo-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jmap.1$ext jmap.1$ext \
  %{_mandir}/man1/jmap-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jps.1$ext jps.1$ext \
  %{_mandir}/man1/jps-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jrunscript.1$ext jrunscript.1$ext \
  %{_mandir}/man1/jrunscript-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jsadebugd.1$ext jsadebugd.1$ext \
  %{_mandir}/man1/jsadebugd-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jstack.1$ext jstack.1$ext \
  %{_mandir}/man1/jstack-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jstat.1$ext jstat.1$ext \
  %{_mandir}/man1/jstat-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/jstatd.1$ext jstatd.1$ext \
  %{_mandir}/man1/jstatd-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/native2ascii.1$ext native2ascii.1$ext \
  %{_mandir}/man1/native2ascii-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/rmic.1$ext rmic.1$ext \
  %{_mandir}/man1/rmic-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/schemagen.1$ext schemagen.1$ext \
  %{_mandir}/man1/schemagen-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/serialver.1$ext serialver.1$ext \
  %{_mandir}/man1/serialver-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/wsgen.1$ext wsgen.1$ext \
  %{_mandir}/man1/wsgen-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/wsimport.1$ext wsimport.1$ext \
  %{_mandir}/man1/wsimport-%{sdklnk}.1$ext \
  --slave %{_mandir}/man1/xjc.1$ext xjc.1$ext \
  %{_mandir}/man1/xjc-%{sdklnk}.1$ext \
  --slave %{_datadir}/applications/jconsole.desktop jconsole.desktop \
  %{_jvmdir}/%{sdkdir}/jre/lib/desktop/jconsole.desktop

update-alternatives \
  --install %{_jvmdir}/java-openjdk \
  java_sdk_openjdk %{_jvmdir}/%{sdklnk} %{priority} \
  --slave %{_jvmjardir}/java-openjdk \
  java_sdk_openjdk_exports %{jvmjarlink}
update-alternatives \
  --install %{_jvmdir}/java-%{javaver} \
  java_sdk_%{javaver} %{_jvmdir}/%{sdklnk} %{priority} \
  --slave %{_jvmjardir}/java-%{javaver} \
  java_sdk_%{javaver}_exports %{jvmjarlink}

%postun devel
if [ $1 -eq 0 ]
then
  update-alternatives --remove javac %{sdkbindir}/javac
  update-alternatives --remove java_sdk_openjdk %{_jvmdir}/%{sdklnk}
  update-alternatives --remove java_sdk_%{javaver} %{_jvmdir}/%{sdklnk}
fi

%if ! %{with bootstrap}
%post javadoc
update-alternatives \
  --install %{_javadocdir}/java javadocdir %{_javadocdir}/%{sdklnk}/api \
  %{priority}

%postun javadoc
if [ $1 -eq 0 ]
then
  update-alternatives --remove javadocdir %{_javadocdir}/%{sdklnk}/api
fi

%post accessibility
# create links to java-atk-wrapper
if [ ! -e %{_jvmdir}/%{jredir}/lib/%{archinstall}/libatk-wrapper.so ]; then
    ln -sf %{_libdir}/java-atk-wrapper/libatk-wrapper.so.0  %{_jvmdir}/%{jredir}/lib/%{archinstall}/libatk-wrapper.so
fi
if [ ! -e %{_jvmdir}/%{jredir}/lib/ext/java-atk-wrapper.jar ]; then
    ln -sf %{_libdir}/java-atk-wrapper/java-atk-wrapper.jar %{_jvmdir}/%{jredir}/lib/ext/java-atk-wrapper.jar
fi

%endif

%files
%defattr(0644,root,root,0755)
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/xawt
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libjsoundalsa.so
%if %{with_pulseaudio}
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libicedtea-sound.so
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/pulseaudio.properties
%endif
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libsplashscreen.so
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/xawt/libmawt.so

%files headless
%defattr(0644,root,root,0755)
%doc %{buildoutputdir}/j2sdk-image/jre/ASSEMBLY_EXCEPTION
%doc %{buildoutputdir}/j2sdk-image/jre/LICENSE
%doc %{buildoutputdir}/j2sdk-image/jre/THIRD_PARTY_README

%dir %{_jvmdir}/%{sdkdir}/jre/lib/desktop/
%{_jvmdir}/%{sdkdir}/jre/lib/desktop/policytool.desktop
%{_datadir}/icons/hicolor/*/apps/java.png

%{_jvmdir}/java-%{javaver}-openjdk
%dir %{_jvmdir}/%{sdkdir}
%{_jvmdir}/%{jrelnk}

%{jvmjarlink}
%{_jvmjardir}/%{sdkdir}
%{_jvmjardir}/%{jrelnk}

%dir %{_jvmdir}/%{sdkdir}/jre/
%dir %{_jvmdir}/%{sdkdir}/jre/bin
%dir %{_jvmdir}/%{sdkdir}/jre/lib
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}
%ifarch %ix86
%{_jvmdir}/%{sdkdir}/jre/lib/i386/client/Xusage.txt
%endif
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/headless
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/jli
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/xawt

%attr(775,root,root) %{_jvmdir}/%{sdkdir}/jre/bin/*
# jre/lib
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/*.so
#belongs to accessibility
%exclude %{_jvmdir}/%{jredir}/lib/%{archinstall}/libatk-wrapper.so
#belongs to full package
%exclude %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libjsoundalsa.so

%if %{with_pulseaudio}
%exclude %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libicedtea-sound.so
%exclude %{_jvmdir}/%{sdkdir}/jre/lib/pulseaudio.properties
%endif
%exclude %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/libsplashscreen.so

%ifarch %ix86
%dir %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/client
%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/client/libjsig.so
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/client/libjvm.so
%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/client/Xusage.txt
%endif
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/jli/libjli.so
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/headless/libmawt.so
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server/libjvm.*
%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server/libjsig.so
#belongs to full package
%exclude %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/xawt/libmawt.so
%config(noreplace) %{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/jvm.cfg

%if ! %{with zero}
%ifnarch ppc64 ppc64le
%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server/classes.jsa
%endif
%endif
%{_jvmdir}/%{sdkdir}/jre/lib/%{archinstall}/server/Xusage.txt
%{_jvmdir}/%{sdkdir}/jre/lib/applet/
%{_jvmdir}/%{sdkdir}/jre/lib/cmm/
%{_jvmdir}/%{sdkdir}/jre/lib/ext/
# belongs to accessibility
%exclude %{_jvmdir}/%{jredir}/lib/ext/java-atk-wrapper.jar
%{_jvmdir}/%{sdkdir}/jre/lib/images/
%dir %{_jvmdir}/%{jredir}/lib/management/
%dir %{_jvmdir}/%{jredir}/lib/security
%{_jvmdir}/%{sdkdir}/jre/lib/zi/
%{_jvmdir}/%{sdkdir}/jre/lib/*jar
%{_jvmdir}/%{sdkdir}/jre/lib/classlist
%{_jvmdir}/%{sdkdir}/jre/lib/currency.data
%attr(755,root,root) %{_jvmdir}/%{sdkdir}/jre/lib/jexec
%{_jvmdir}/%{sdkdir}/jre/lib/jvm.hprof.txt
%{_jvmdir}/%{sdkdir}/jre/lib/meta-index

%if 0%{?suse_version} <= 1130
%config(noreplace) %{cacerts}
%endif
# % ghost %{_jvmdir}/%{jredir}/lib/security/cacerts
# % endif
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.policy
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.security
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/nss.cfg
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/US_export_policy.jar
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/local_policy.jar
# belongs to accessibility
%exclude %{_jvmdir}/%{jredir}/lib/accessibility.properties
#bnc#637224
%config(noreplace) %{_jvmdir}/%{jredir}/lib/fontconfig*bfc
%config(noreplace) %{_jvmdir}/%{jredir}/lib/fontconfig*src
%config(noreplace) %{_jvmdir}/%{jredir}/lib/*.properties
%config(noreplace) %{_jvmdir}/%{jredir}/lib/psfont.properties.ja
%config(noreplace) %{_jvmdir}/%{jredir}/lib/management/*

%{_mandir}/man1/java-%{sdklnk}.1*
%{_mandir}/man1/keytool-%{sdklnk}.1*
%{_mandir}/man1/orbd-%{sdklnk}.1*
%{_mandir}/man1/policytool-%{sdklnk}.1*
%{_mandir}/man1/rmid-%{sdklnk}.1*
%{_mandir}/man1/rmiregistry-%{sdklnk}.1*
%{_mandir}/man1/servertool-%{sdklnk}.1*
%{_mandir}/man1/tnameserv-%{sdklnk}.1*

%files devel
%defattr(0644,root,root,0755)

%dir %{_jvmdir}/%{sdkdir}
%dir %{_jvmdir}/%{sdkdir}/bin
%dir %{_jvmdir}/%{sdkdir}/include
%dir %{_jvmdir}/%{sdkdir}/lib

%if %{with_systemtap}
%dir %{_datadir}/systemtap/tapset
%dir %{tapsetdir}
%dir %{_jvmdir}/%{sdkdir}/tapset
%{tapsetdir}/*
%{_jvmdir}/%{sdkdir}/tapset/*
%endif

%attr(755,root,root) %{_jvmdir}/%{sdkdir}/bin/*
%{_jvmdir}/%{sdkdir}/include/*
%{_jvmdir}/%{sdkdir}/lib/*

%{_jvmdir}/%{sdkdir}/jre/lib/desktop/jconsole.desktop

%{_mandir}/man1/appletviewer-%{sdklnk}.1*
%{_mandir}/man1/apt-%{sdklnk}.1*
%{_mandir}/man1/extcheck-%{sdklnk}.1*
%{_mandir}/man1/idlj-%{sdklnk}.1*
%{_mandir}/man1/jar-%{sdklnk}.1*
%{_mandir}/man1/jarsigner-%{sdklnk}.1*
%{_mandir}/man1/javac-%{sdklnk}.1*
%{_mandir}/man1/javadoc-%{sdklnk}.1*
%{_mandir}/man1/javah-%{sdklnk}.1*
%{_mandir}/man1/javap-%{sdklnk}.1*
%{_mandir}/man1/jconsole-%{sdklnk}.1*
%{_mandir}/man1/jcmd-%{sdklnk}.1*
%{_mandir}/man1/pack200-%{sdklnk}.1*
%{_mandir}/man1/unpack200-%{sdklnk}.1*
%{_mandir}/man1/jdb-%{sdklnk}.1*
%{_mandir}/man1/jhat-%{sdklnk}.1*
%{_mandir}/man1/jinfo-%{sdklnk}.1*
%{_mandir}/man1/jmap-%{sdklnk}.1*
%{_mandir}/man1/jps-%{sdklnk}.1*
%{_mandir}/man1/jrunscript-%{sdklnk}.1*
%{_mandir}/man1/jsadebugd-%{sdklnk}.1*
%{_mandir}/man1/jstack-%{sdklnk}.1*
%{_mandir}/man1/jstat-%{sdklnk}.1*
%{_mandir}/man1/jstatd-%{sdklnk}.1*
%{_mandir}/man1/native2ascii-%{sdklnk}.1*
%{_mandir}/man1/rmic-%{sdklnk}.1*
%{_mandir}/man1/schemagen-%{sdklnk}.1*
%{_mandir}/man1/serialver-%{sdklnk}.1*
%{_mandir}/man1/wsgen-%{sdklnk}.1*
%{_mandir}/man1/wsimport-%{sdklnk}.1*
%{_mandir}/man1/xjc-%{sdklnk}.1*

%if ! %{with bootstrap}
%files demo
%defattr(0644,root,root,0755)
%{_jvmdir}/%{sdkdir}/demo
%{_jvmdir}/%{sdkdir}/sample

%files src
%defattr(0644,root,root,0755)
%{_jvmdir}/%{sdkdir}/src.zip

%files javadoc
%defattr(0644,root,root,0755)
%dir %{_javadocdir}/%{sdklnk}
%{_javadocdir}/%{sdklnk}/*

%files accessibility
%defattr(-,root,root,0755)
%config(noreplace) %{_jvmdir}/%{jredir}/lib/accessibility.properties
%ghost %{_jvmdir}/%{jredir}/lib/%{archinstall}/libatk-wrapper.so
%ghost %{_jvmdir}/%{jredir}/lib/ext/java-atk-wrapper.jar

%endif

%changelog