{% set name = "openjdk" %}
{% set version = "17.0.3" %}
{% set zulu_build = "17.34.19-ca" %}
{% set zulu_build_arm64 = "17.34.19-ca" %}
{% set openjdk_revision = "7" %}

package:
  name: {{ name|lower }}
  version: {{ version }}


source:
  - url: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-{{ version }}+{{ openjdk_revision }}/OpenJDK17U-jdk_ppc64le_linux_hotspot_{{ version }}_{{ openjdk_revision }}.tar.gz   # [build_platform == "linux-ppc64le"]
    sha256: a04587018c9719dca21073f19d56b335c4985f41afe7d99b24852c1a94b917e5  # [build_platform == "linux-ppc64le"]

  - url: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-{{ version }}+{{ openjdk_revision }}/OpenJDK17U-jdk_aarch64_linux_hotspot_{{ version }}_{{ openjdk_revision }}.tar.gz   # [build_platform == "linux-aarch64"]
    sha256: 2e3c19c1707205c6b90cc04b416e8d83078ed98417d5a69dce3cf7dc0d7cfbca  # [build_platform == "linux-aarch64"]

  - url: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-{{ version }}+{{ openjdk_revision }}/OpenJDK17U-jdk_x64_linux_hotspot_{{ version }}_{{ openjdk_revision }}.tar.gz   # [build_platform == "linux-64"]
    sha256: 81f5bed21077f9fbb04909b50391620c78b9a3c376593c0992934719c0de6b73  # [build_platform == "linux-64"]

  - url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-macosx_x64.zip  # [osx and x86_64]
    sha256: bcb6d5be984ce3ea7ff60d1ea49a264c622512d96671bb3a94893fca5048aab2  # [osx and x86_64]
   
  - url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build_arm64 }}-jdk{{ version }}-macosx_aarch64.zip  # [osx and arm64]
    sha256: 2694bfd4cb489823eb005e3f920f086b468fa5719632688894a055adb4007251  # [osx and arm64]

  - url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-win_x64.zip  # [win64]
    sha256: db4e1d0b5ed9dfe22e87aebc0314f15e7941e2d4b6122f64f557146004800ffe  # [win64]

  - url: https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.zip  # [linux]
    sha256: 7576310b219e04159d35ff61dd4a4ec4cdba4f35c00e002a136f00e96a908b0a  # [linux]
    folder: fonts  # [linux]

  - url: https://github.com/openjdk/jdk{{ version.split(".")[0] }}u/archive/refs/tags/jdk-{{ version }}+{{ openjdk_revision }}.tar.gz   # [linux]
    sha256: 22575340d080a396442658356583d9c7dc0c44cefa52842fbfcf23eef23c39a0  # [linux]
    folder: src        # [linux]

build:
  number: 5

requirements:
  build:
    # We also need a compiler on osx to produce correct signatures
    - {{ compiler('cxx') }}   # [not win]
    - pkg-config        # [linux]
    - autoconf          # [linux]
    - unzip             # [linux]
    - zip               # [linux]
    - make !=4.3.*      # [linux]
    - zlib              # [linux and (build_platform != target_platform)]
    - freetype          # [linux and (build_platform != target_platform)]
    - harfbuzz          # [linux and (build_platform != target_platform)]
    - libpng            # [linux and (build_platform != target_platform)]
    - giflib            # [linux and (build_platform != target_platform)]
    - harfbuzz          # [linux and (build_platform != target_platform)]
    - jpeg              # [linux and (build_platform != target_platform)]
    - libcups           # [linux and (build_platform != target_platform)]
    - alsa-lib          # [linux and (build_platform != target_platform)]
    - fontconfig        # [linux and (build_platform != target_platform)]
    - xorg-libx11       # [linux and (build_platform != target_platform)]
    - xorg-libxext      # [linux and (build_platform != target_platform)]
    - xorg-libxt        # [linux and (build_platform != target_platform)]
    - xorg-libxtst      # [linux and (build_platform != target_platform)]
    - xorg-libxrender   # [linux and (build_platform != target_platform)]
    - xorg-libxrandr    # [linux and (build_platform != target_platform)]
    - xorg-libxi        # [linux and (build_platform != target_platform)]
    - lcms2             # [linux and (build_platform != target_platform)]
    - symlink-exe-build  # [win]
    - m2-bash            # [win]
  host:
    - zlib              # [linux or osx]
    - freetype          # [linux]
    - harfbuzz          # [linux]
    - libpng            # [linux]
    - giflib            # [linux]
    - harfbuzz          # [linux]
    - jpeg              # [linux]
    - libcups           # [linux]
    - alsa-lib          # [linux]
    - fontconfig        # [linux]
    - xorg-libx11       # [linux]
    - xorg-libxext      # [linux]
    - xorg-libxt        # [linux]
    - xorg-libxtst      # [linux]
    - xorg-libxrender   # [linux]
    - xorg-libxrandr    # [linux]
    - xorg-libxi        # [linux]
    - lcms2             # [linux]
    - vs2015_runtime    # [win]
  run:
    - xorg-libx11       # [linux]
    - xorg-libxext      # [linux]
    - xorg-libxtst      # [linux]
    - xorg-libxrender   # [linux]
    - xorg-libxi        # [linux]
    - {{ pin_compatible("alsa-lib", max_pin="x.x.x") }}     # [linux]
    - vs2015_runtime    # [win]

test:
  requires:
    - {{ compiler('c') }}  # [not win]
  files:
    - test-jni  # [not win]
    - test-jni.sh  # [not win]
    - test-nio
  commands:
    - java -version
    - '${JAVA_HOME}/bin/java -version'  # [not win]
    - '%JAVA_HOME%\bin\java -version'   # [win]
    - ./test-jni.sh  # [not win and not ppc64le]

about:
  home: https://www.azul.com/products/zulu/  # [not linux]
  home: https://openjdk.java.net             # [linux]
  license: GPL-2.0-or-later WITH Classpath-exception-2.0
  license_family: GPL
  license_file:
    - LICENSE
    - fonts/LICENSE   # [linux]
  summary: The Zulu OpenJDK build.           # [not linux]
  summary: An open-source implementation of the JDK   # [linux]
  description: Zulu OpenJDK is an open source build of the Java JDK.   # [not linux]

extra:
  recipe-maintainers:
    - johanneskoester
    - sodre
    - mingwandroid
    - CJ-Wright
    - xhochy
    - izahn
