[buildout]
extends =
  ../coreutils/buildout.cfg
  ../patchelf/buildout.cfg
  ../alsa/buildout.cfg
  ../libpng/buildout.cfg
  ../freetype/buildout.cfg
  ../fontconfig/buildout.cfg
  ../xorg/buildout.cfg
  ../zlib/buildout.cfg
parts =
  java

[java]
<= java-re

[java-re]
<= java-re-7

[java-sun-common]
recipe = slapos.recipe.build:download-unpacked
url = https://javadl.sun.com/webapps/download/AutoDL?BundleId=${:bundle-id}

[java-re-7]
<= java-sun-common
# http://java.com/en/download/manual_java7.jsp

[java-re-7:linux and platform.machine() == 'i686']
bundle-id = 97798
md5sum = 90a6b9e2a32d06c18a3f16b485f0d1ea

[java-re-7:linux and platform.machine() == 'x86_64']
bundle-id = 97800
md5sum = 7605134662f6c87131eca5745895fe84

[java-re-8]
<= java-sun-common
# https://www.java.com/en/download/manual.jsp
# Update 161

[java-re-8:linux and platform.machine() == 'i686']
bundle-id = 230530_2f38c3b165be4555a1fa6e98c45e0808
md5sum = 90a6b9e2a32d06c18a3f16b485f0d1ea

[java-re-8:linux and platform.machine() == 'x86_64']
bundle-id = 230532_2f38c3b165be4555a1fa6e98c45e0808
md5sum = 4385bc121b085862be623f4a31e7e0b4

[java-re-8-output]
# Shared binary location to ease migration
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = ${coreutils-output:test} -x ${:keytool}
keytool = ${java-re-8:location}/bin/keytool


[java-re-temurin-11]
recipe = slapos.recipe.build
update =
  from zc.buildout import UserError
  raise UserError("unsupported platform")

[java-re-temurin-11:linux and platform.machine() == 'x86_64']
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.13%2B8/OpenJDK11U-jre_x64_linux_hotspot_11.0.13_8.tar.gz
md5sum = 1b06100bcd0923d3f3279c2f09773af0
configure-command = :
make-binary = :
post-install =
  mv * %(location)s
  for file in %(location)s/bin/* %(location)s/lib/*.so %(location)s/lib/*/*.so ; do
    echo appending rpath to $file
    ${patchelf:location}/bin/patchelf --set-rpath %(rpath)s $file
  done
rpath = ${alsa:location}/lib:${freetype:location}/lib:${fontconfig:location}/lib:${libpng:location}/lib:${libXrender:location}/lib:${libXtst:location}/lib:${libX11:location}/lib:${libXau:location}/lib:${libXext:location}/lib:${libXdmcp:location}/lib:${libXi:location}/lib:${libxcb:location}/lib:${zlib:location}/lib:@@LOCATION@@/lib:@@LOCATION@@/lib/server:@@LOCATION@@/lib/jli
