File openjdk.spec of Package openjdk-1.8.0_192

#
# spec file for package openjdk
#
# Copyright (c) 2017 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/
#

%define full_name openjdk-1.8.0_192
Name:           %{full_name}
Version:        8.192b26
Release:        1
Summary: This is the openjdk binary used in buildpacks in SUSE CloudFoundry (SCF)
License:        GPL-2.0-with-classpath-exception
Group:          Cloud/Platform/scf
Url:            http://openjdk.java.net/
Source0:        1.8.0_192.tar.gz
Source1:        cacerts.pem
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  unzip
BuildRequires:  zip
BuildRequires:  java-1_8_0-openjdk-devel
BuildRequires:  gcc-c++
BuildRequires:  xorg-x11-devel
BuildRequires:  cups-devel
BuildRequires:  freetype2-devel
BuildRequires:  alsa-lib-devel
BuildRequires:	-post-build-checks

# BEGIN shared macros for all dependency packages
BuildRequires: aaa_stack_build_requires

%if 0%{?suse_version} == 1315
%if 0%{?is_opensuse}
%define stack opensuse42
%else
%define stack sle12
%endif
%else
%define stack sle15
%endif

%define otherdir %{_topdir}/OTHER
%define prefix_path /app/vendor/%{name}
%define destdir /tmp/%{name}
%define dependencydir %{destdir}%{prefix_path}
# END shared macros


%description

%prep
# Set up keystore
mkdir -p cacerts
awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/{ print $0; }' %{SOURCE1} | csplit -n 3 -s -f cacerts/ - '/-----BEGIN CERTIFICATE-----/' {*}
rm cacerts/000

for PEM in $(find cacerts -type f | sort); do
  keytool -importcert -noprompt -keystore cacerts.jks -storepass changeit -file $PEM -alias $(basename $PEM)
done

%setup -q -n jdk8u
./configure \
  --disable-debug-symbols \
  --disable-zip-debug-info \
  --enable-unlimited-crypto \
  --with-build-number=26 \
  --with-cacerts-file=$(pwd)/../cacerts.jks \
  --with-freetype-include=/usr/include/freetype2 \
  --with-freetype-lib=/usr/lib64 \
  --with-milestone=fcs \
  --with-extra-cflags="-Wno-error" \
  --with-update-version=192

%build
export LANG=en_US.UTF-8
COMPANY_NAME="SUSE LINUX GmbH" make images

%install
chmod -R a+r build/linux-x86_64-normal-server-release/images
TARBALL=%{otherdir}/%{full_name}-%{version}.tar.gz

# The upstream binary-builder is using `cp -r` which has the same effect
# as the --hard-dereference flag here.
# (https://github.com/cloudfoundry/binary-builder/blob/master/lib/archive_recipe.rb#L20)
tar czvf ${TARBALL} --hard-dereference -C build/linux-x86_64-normal-server-release/images/j2re-image . -C ../j2sdk-image ./lib/tools.jar ./bin/jcmd ./bin/jmap ./bin/jstack ./man/man1/jcmd.1 ./man/man1/jmap.1 ./man/man1/jstack.1 -C ./jre ./lib/amd64/libattach.so --owner=0 --group=0

CHECKSUM=`sha256sum ${TARBALL}`
NEW_TARBALL=%{otherdir}/%{full_name}-%{version}-%{stack}-${CHECKSUM:0:8}.tgz
mv ${TARBALL} ${NEW_TARBALL}

pushd $(dirname ${NEW_TARBALL})
sha256sum $(basename ${NEW_TARBALL}) > ${NEW_TARBALL}.sha256
popd

%post
%postun

%files
%defattr(-,root,root)

%changelog

openSUSE Build Service is sponsored by