# Copyright (c) 2021, Amazon.com, Inc. or its affiliates. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. Amazon designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). # # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # The Corretto github project provides tarfiles with five dotted # version parts. The first four are the typical Java version + build, # and the last one is the release ID. %global java_version $java_version %global java_major_version $java_spec_version %global java_security_version $java_security_version %global build_id $build_id %global release_id $release_id %global version_opt $version_opt %global experimental_feature $experimental_feature %global additional_configure_options $additional_configure_options %global zlib_option $zlib_option %global use_gcc_ver $use_gcc_ver # The experimental_feature macro gets set to %nil by the template, but that is still defined and # the spec doesn't have a quick is not nil check, just define/not defined, this makes it easier to # work with %if 0%{?experimental_feature:1} && "%{experimental_feature}" == "%{nil}" %undefine experimental_feature %endif %if 0%{?additional_configure_options:1} == 1 && "%{additional_configure_options}" == "%{nil}" %undefine additional_configure_options %endif %if 0%{?use_gcc_ver:1} == 1 && "%{use_gcc_ver}" == "%{nil}" %undefine use_gcc_ver %endif # If we need to rev the package for something outside of what the # Corretto team is doing, we can define release_ext. # %global release_ext 1 %global java_home %{_jvmdir}/%{name}.%{_arch} %global java_lib %{java_home}/lib %global java_inc %{java_home}/include # Where the make targets actually get written out %global java_imgdir build/linux-%{_arch}-normal-server-$debug_level/images/ # Higher numbers win for the alternatives program. %global alternatives_priority 2 # Instruct rpmbuild to copy jars rather than de-compress and re-compress. %global __jar_repack 0 # Don't create a separate debug package. Specifically disables running # this script: # https://github.com/rpm-software-management/rpm/blob/master/scripts/find-debuginfo.sh %define debug_package %{nil} # abs2rel: A macro to convert an absolute path to a relative path. # When making a symlink in an RPM, prefer a symbolic link to ensure # the link will work in a chroot environment. %global script 'use File::Spec; print File::Spec->abs2rel(\$ARGV[0], \$ARGV[1])' %global abs2rel %{__perl} -e %{script} # By default install a bootstrap jdk. If one is already available, # this can be skipped using --without bootjdk %bcond_without bootjdk Summary: Amazon Corretto development environment Name: java-%{java_major_version}-amazon-corretto%{?experimental_feature:-%{experimental_feature}} # Matches the 'full version' from Java's release notes: # https://www.oracle.com/technetwork/java/javase/11-0-2-relnotes-5188746.html # Eg: 11.0.2+7 Version: %{java_version}+%{build_id} Release: %{release_id}%{?dist} Epoch: 1 Group: Development/Languages AutoReqProv: 0 License: ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and GPLv2 with exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public Domain and W3C and zlib and ISC and FTL and RSA. Vendor: Amazon Url: https://github.com/corretto/corretto-11 Source0: amazon-corretto-source-%{java_version}.%{build_id}.%{release_id}.tar.gz %if "%{dist}" == ".amzn2" || "%{dist}" == ".amzn2int" BuildRequires: jpackage-utils %else BuildRequires: javapackages-filesystem %endif BuildRequires: autoconf BuildRequires: make BuildRequires: alsa-lib-devel BuildRequires: binutils BuildRequires: which BuildRequires: cups-devel BuildRequires: fontconfig-devel BuildRequires: freetype-devel BuildRequires: giflib-devel BuildRequires: gcc%{?use_gcc_ver}-c++ BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libxslt BuildRequires: libX11-devel BuildRequires: libXi-devel BuildRequires: libXinerama-devel BuildRequires: libXt-devel BuildRequires: libXrender-devel BuildRequires: libXrandr-devel BuildRequires: libXtst-devel BuildRequires: pkgconfig BuildRequires: xorg-x11-proto-devel %if %{with bootjdk} BuildRequires: java-11-devel %endif Requires: libX11 Requires: libXi Requires: libXinerama Requires: libXt Requires: libXrender Requires: libXrandr Requires: libXtst Requires: alsa-lib Requires: giflib Requires: libjpeg Requires: libpng Requires: dejavu-sans-fonts Requires: dejavu-serif-fonts Requires: dejavu-sans-mono-fonts # Require headless package. Requires: %{name}-headless%{?_isa} = %{epoch}:%{version}-%{release} Provides: java = %{epoch}:%{java_version} Provides: java-11 = %{epoch}:%{java_version} Provides: java-11 = %{epoch}:%{version}-%{release} Provides: java-devel = %{epoch}:%{java_version} Provides: java-11-devel = %{epoch}:%{java_version} Provides: java-11-devel = %{epoch}:%{version}-%{release} Provides: jre = %{java_version} Provides: jre-11 = %{epoch}:%{version}-%{release} Provides: jre-11-amazon-corretto = %{epoch}:%{version}-%{release} %description Amazon Corretto's packaging of the runtime core elements of the OpenJDK 11 code. %package headless Summary: Amazon Corretto headless development environment Group: Development/Tools AutoReqProv: 0 # jpackage-utils/javapackages-filesystem is required for both build and runtime. # For build, it provides the jvmdir macro. For runtime, # it provides the /usr/lib/jvm directory. %if "%{dist}" == ".amzn2" || "%{dist}" == ".amzn2int" Requires: jpackage-utils %else Requires: javapackages-filesystem %endif Requires: zlib Requires: fontconfig Requires: freetype Requires: ca-certificates %if "%{dist}" == ".amzn2" Requires: log4j-cve-2021-44228-cve-mitigations %endif Requires(post): chkconfig Requires(postun): chkconfig Provides: java-headless = %{epoch}:%{java_version} Provides: java-11-headless = %{epoch}:%{version}-%{release} Provides: jre-headless = %{epoch}:%{java_version} Provides: jre-11-headless = %{epoch}:%{version}-%{release} Provides: jre-11-amazon-corretto-headless = %{epoch}:%{version}-%{release} %description headless Amazon Corretto's packaging of the runtime core elements of the OpenJDK 11 code. (Headless environment) %package javadoc Summary: Amazon Corretto 11 API documentation Group: Documentation Provides: java-javadoc = %{epoch}:%{version}-%{release} Provides: java-11-javadoc = %{epoch}:%{version}-%{release} %description javadoc Amazon Corretto's packaging of the OpenJDK 11 API documentation. %prep %setup -q -n src -c %build bash ./configure \\ %ifarch aarch64 --with-extra-cflags="-moutline-atomics" \\ --with-extra-cxxflags="-moutline-atomics" \\ %endif %if 0%{?additional_configure_options:1} %{additional_configure_options} \\ %endif --with-jvm-features="zgc shenandoahgc" \\ --with-version-feature="11" \\ --with-freetype=system \\ --with-libjpeg=system \\ --with-giflib=system \\ --with-libpng=system \\ --with-zlib="%{zlib_option}" \\ --with-version-opt="LTS" \\ --with-version-build="%{build_id}" \\ --with-vendor-version-string="Corretto%{?experimental_feature:-%{experimental_feature}}-%{java_version}.%{build_id}.%{release_id}" \\ --with-version-pre= \\ --with-vendor-name="Amazon.com Inc." \\ --with-vendor-url="https://aws.amazon.com/corretto/" \\ --with-vendor-bug-url="https://github.com/corretto/corretto-11/issues/" \\ --with-vendor-vm-bug-url="https://github.com/corretto/corretto-11/issues/" \\ --with-debug-level=$debug_level \\ --with-native-debug-symbols=none make images make LOG=debug docs %install rm -rf %{buildroot} install -d -m 755 %{buildroot}%{java_home} cp -a %{java_imgdir}/jdk/* %{buildroot}%{java_home} rm -rf %{buildroot}%{java_home}/demo # Make a *relative* symlink pointing to the cacerts file from ca-certificates. rm -f %{buildroot}%{java_home}/lib/security/cacerts pushd %{buildroot}%{java_home}/lib/security RELATIVE=\$(%{abs2rel} %{_sysconfdir}/pki/java %{buildroot}%{java_home}/lib/security) ln -sf \$RELATIVE/cacerts . popd %post headless if [ \$1 -eq 1 ] ; then alternatives --install %{_bindir}/java java %{java_home}/bin/java %{alternatives_priority} \\ --slave %{_jvmdir}/%{name} %{name} %{java_home} \\ --slave %{_jvmdir}/jre jre %{java_home} \\ --slave %{_bindir}/keytool keytool %{java_home}/bin/keytool \\ --slave %{_bindir}/pack200 pack200 %{java_home}/bin/pack200 \\ --slave %{_bindir}/rmid rmid %{java_home}/bin/rmid \\ --slave %{_bindir}/rmiregistry rmiregistry %{java_home}/bin/rmiregistry \\ --slave %{_bindir}/unpack200 unpack200 %{java_home}/bin/unpack200 \\ --slave %{_mandir}/man1/java.1 java.1 %{java_home}/man/man1/java.1 \\ --slave %{_mandir}/man1/keytool.1 keytool.1 %{java_home}/man/man1/keytool.1 \\ --slave %{_mandir}/man1/pack200.1 pack200.1 %{java_home}/man/man1/pack200.1 \\ --slave %{_mandir}/man1/rmid.1 rmid.1 %{java_home}/man/man1/rmid.1 \\ --slave %{_mandir}/man1/rmiregistry.1 rmiregistry.1 %{java_home}/man/man1/rmiregistry.1 \\ --slave %{_mandir}/man1/unpack200.1 unpack200.1 %{java_home}/man/man1/unpack200.1 alternatives --install %{_jvmdir}/jre-%{java_major_version} jre_%{java_major_version} %{java_home} %{alternatives_priority} \\ --slave %{_jvmdir}/jre-%{java_major_version}-openjdk jre_%{java_major_version}_openjdk %{java_home} alternatives --install %{_bindir}/javac javac %{java_home}/bin/javac %{alternatives_priority} \\ --slave %{_jvmdir}/java java_sdk %{java_home} \\ --slave %{_jvmdir}/java-%{java_major_version} java-%{java_major_version} %{java_home} \\ --slave %{_bindir}/jaotc jaotc %{java_home}/bin/jaotc \\ --slave %{_bindir}/jar jar %{java_home}/bin/jar \\ --slave %{_bindir}/jarsigner jarsigner %{java_home}/bin/jarsigner \\ --slave %{_bindir}/javadoc javadoc %{java_home}/bin/javadoc \\ --slave %{_bindir}/javap javap %{java_home}/bin/javap \\ --slave %{_bindir}/jcmd jcmd %{java_home}/bin/jcmd \\ --slave %{_bindir}/jconsole jconsole %{java_home}/bin/jconsole \\ --slave %{_bindir}/jdb jdb %{java_home}/bin/jdb \\ --slave %{_bindir}/jdeprscan jdeprscan %{java_home}/bin/jdeprscan \\ --slave %{_bindir}/jdeps jdeps %{java_home}/bin/jdeps \\ --slave %{_bindir}/jhsdb jhsdb %{java_home}/bin/jhsdb \\ --slave %{_bindir}/jimage jimage %{java_home}/bin/jimage \\ --slave %{_bindir}/jinfo jinfo %{java_home}/bin/jinfo \\ --slave %{_bindir}/jjs jjs %{java_home}/bin/jjs \\ --slave %{_bindir}/jlink jlink %{java_home}/bin/jlink \\ --slave %{_bindir}/jmap jmap %{java_home}/bin/jmap \\ --slave %{_bindir}/jmod jmod %{java_home}/bin/jmod \\ --slave %{_bindir}/jps jps %{java_home}/bin/jps \\ --slave %{_bindir}/jrunscript jrunscript %{java_home}/bin/jrunscript \\ --slave %{_bindir}/jshell jshell %{java_home}/bin/jshell \\ --slave %{_bindir}/jstack jstack %{java_home}/bin/jstack \\ --slave %{_bindir}/jstat jstat %{java_home}/bin/jstat \\ --slave %{_bindir}/jstatd jstatd %{java_home}/bin/jstatd \\ --slave %{_bindir}/rmic rmic %{java_home}/bin/rmic \\ --slave %{_bindir}/serialver serialver %{java_home}/bin/serialver \\ --slave %{_mandir}/man1/jar.1 jar.1 %{java_home}/man/man1/jar.1 \\ --slave %{_mandir}/man1/jarsigner.1 jarsigner.1 %{java_home}/man/man1/jarsigner.1 \\ --slave %{_mandir}/man1/javac.1 javac.1 %{java_home}/man/man1/javac.1 \\ --slave %{_mandir}/man1/javadoc.1 javadoc.1 %{java_home}/man/man1/javadoc.1 \\ --slave %{_mandir}/man1/javap.1 javap.1 %{java_home}/man/man1/javap.1 \\ --slave %{_mandir}/man1/jcmd.1 jcmd.1 %{java_home}/man/man1/jcmd.1 \\ --slave %{_mandir}/man1/jconsole.1 jconsole.1 %{java_home}/man/man1/jconsole.1 \\ --slave %{_mandir}/man1/jdb.1 jdb.1 %{java_home}/man/man1/jdb.1 \\ --slave %{_mandir}/man1/jdeps.1 jdeps.1 %{java_home}/man/man1/jdeps.1 \\ --slave %{_mandir}/man1/jinfo.1 jinfo.1 %{java_home}/man/man1/jinfo.1 \\ --slave %{_mandir}/man1/jjs.1 jjs.1 %{java_home}/man/man1/jjs.1 \\ --slave %{_mandir}/man1/jmap.1 jmap.1 %{java_home}/man/man1/jmap.1 \\ --slave %{_mandir}/man1/jps.1 jps.1 %{java_home}/man/man1/jps.1 \\ --slave %{_mandir}/man1/jrunscript.1 jrunscript.1 %{java_home}/man/man1/jrunscript.1 \\ --slave %{_mandir}/man1/jstack.1 jstack.1 %{java_home}/man/man1/jstack.1 \\ --slave %{_mandir}/man1/jstat.1 jstat.1 %{java_home}/man/man1/jstat.1 \\ --slave %{_mandir}/man1/jstatd.1 jstatd.1 %{java_home}/man/man1/jstatd.1 \\ --slave %{_mandir}/man1/rmic.1 rmic.1 %{java_home}/man/man1/rmic.1 \\ --slave %{_mandir}/man1/serialver.1 serialver.1 %{java_home}/man/man1/serialver.1 alternatives --install %{_jvmdir}/java-%{java_major_version} java_sdk_%{java_major_version} %{java_home} %{alternatives_priority} \ --slave %{_jvmdir}/java-%{java_major_version}-openjdk java_sdk_%{java_major_version}_openjdk %{java_home} fi %postun headless if [ \$1 -eq 0 ] ; then alternatives --remove java %{java_home}/bin/java alternatives --remove javac %{java_home}/bin/javac alternatives --remove java_sdk_%{java_major_version} %{java_home} alternatives --remove jre_%{java_major_version} %{java_home} fi %files %{java_lib}/libawt_xawt.so %{java_lib}/libjawt.so %{java_lib}/libsplashscreen.so %{java_inc}/jawt.h %{java_inc}/linux/jawt_md.h %files headless %config(noreplace) %{java_home}/conf/logging.properties %config(noreplace) %{java_home}/conf/net.properties %config(noreplace) %{java_home}/conf/sound.properties %config(noreplace) %{java_home}/conf/management/jmxremote.access %config(noreplace) %{java_home}/conf/management/management.properties %config(noreplace) %{java_home}/conf/security/java.policy %config(noreplace) %{java_home}/conf/security/java.security %config(noreplace) %{java_home}/conf/security/policy/limited/exempt_local.policy %config(noreplace) %{java_home}/conf/security/policy/limited/default_local.policy %config(noreplace) %{java_home}/conf/security/policy/limited/default_US_export.policy %config(noreplace) %{java_home}/conf/security/policy/unlimited/default_local.policy %config(noreplace) %{java_home}/conf/security/policy/unlimited/default_US_export.policy %config(noreplace) %{java_home}/lib/security/blocked.certs %config(noreplace) %{java_home}/lib/security/default.policy %config(noreplace) %{java_home}/lib/security/public_suffix_list.dat %{java_home} # Keep the libs and includes that need X11 in the main package %exclude %{java_lib}/libawt_xawt.so %exclude %{java_lib}/libjawt.so %exclude %{java_lib}/libsplashscreen.so %exclude %{java_inc}/jawt.h %exclude %{java_inc}/linux/jawt_md.h %files javadoc %doc %{java_imgdir}/docs/index.html %doc %{java_imgdir}/docs/api %doc %{java_imgdir}/docs/resources %doc %{java_imgdir}/docs/specs %license %{java_imgdir}/docs/legal %changelog * Thu Aug 18 2022 Dan Lutker - Add ability to set debug_level * Fri Jul 22 2022 Dan Lutker - Add provides java-devel * Thu Jun 30 2022 Dan Lutker - Fixup java/jre symlinks * Thu Dec 16 2021 Clive Verghese - Add requires for log4j CVE-2021-44228 static mitigation * Thu Dec 02 2021 Dan Lutker - 11.0.13+8-1 - Templatize spec - Update provides to include java-11-devel * Wed Oct 13 2021 Dan Lutker - 11.0.13+8-1 - Update to 11.0.13+8-1 * Wed Jul 14 2021 Dan Lutker - 11.0.12+9-1 - Update to 11.0.12+7-1 * Mon Apr 19 2021 Sai Harsha - 11.0.11+9-1 - Update to 11.0.11+9-1 * Wed Feb 03 2021 Trinity Quirk - 11.0.10+9-1.1 - Enable shenandoah garbage collector * Wed Jan 13 2021 Trinity Quirk - 11.0.10+9-1 - Update to 11.0.10+9-1 - Force docs builds to generate debug logs to combat occasional failures * Wed Nov 04 2020 Sai Harsha - 11.0.9+12-1 - Update to 11.0.9+12-1 * Fri Oct 16 2020 Sai Harsha - 11.0.9+11-1 - Update to 11.0.9+11-1 * Mon Oct 05 2020 Trinity Quirk - 11.0.8+10-3 - Update to 11.0.8+10-3 * Wed Sep 16 2020 Trinity Quirk - 11.0.8+10-1.1 - Add -moutline-atomics compile flags for aarch64 packages * Tue Jun 09 2020 Trinity Quirk - 11.0.8+10-1 - Update to 11.0.8+10-1 * Fri May 22 2020 Trinity Quirk - 11.0.7+10-1.1 - Split alternatives into java and javac groups * Thu Apr 09 2020 Trinity Quirk - 11.0.7+10-1 - Update to 11.0.7+10-1 * Fri Jan 10 2020 Trinity Quirk - 11.0.6+10-1 - Update to 11.0.6+10-1 * Mon Oct 14 2019 Frederick Lefebvre - 11.0.5+10-1 - Update to 11.0.5+10-1 * Mon Aug 26 2019 Trinity Quirk - 11.0.4+11-1.1 - Provide java and jre resources * Tue Jul 16 2019 Trinity Quirk - 11.0.4+11-1 - Update to 11.0.4+11-1. * Fri May 31 2019 Trinity Quirk - 11.0.3+7-1 - Update to 11.0.3+7-1. * Mon Apr 15 2019 Trinity Quirk - 11.0.2+9-3 - Initial release of Corretto 11.