# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                openjdk11-bootstrap
version             11
revision            1
set build           28
categories          java devel
# TODO: specify which darwin versions the binary actually works on
platforms           {darwin any}
supported_archs     x86_64 arm64
license             GPL-2+
maintainers         nomaintainer
description         OpenJDK 11 Boot JDK
long_description    OpenJDK 11 Boot JDK to bootstrap Openjdk11 port
homepage            https://openjdk.java.net/
if {${configure.build_arch} eq "x86_64"} {
    master_sites        https://download.java.net/java/ga/jdk${version}/
    distname            openjdk-11_osx-x64_bin

    checksums           rmd160  c914d38c78b2943c7b47ff2da4e8da89438f96cd \
                        sha256  6b969d2df6a9758d9458f5ba47939250e848dfba8b49e41c935cf210606b6d38 \
                        size    182717049
    
    worksrcdir          jdk-11.jdk
} elseif {${configure.build_arch} eq "arm64"} {
    master_sites        https://cdn.azul.com/zulu/bin/
    distname            zulu11.45.27-ca-jdk11.0.10-macosx_aarch64

    checksums           rmd160  e0e0917aa2299c6f9283b8428f29d85977ebaa81 \
                        sha256  3dcc636e64ae58b922269c2dc9f20f6f967bee90e3f6847d643c4a566f1e8d8a \
                        size    179024305
    
    worksrcdir          ${distname}/zulu-11.jdk
} else {
    master_sites
    distfiles
}

use_xcode           no
use_configure    no

build {}

set path /Library/Java/JavaVirtualMachines/${name}
destroot {
    xinstall -m 755 -d ${destroot}${path}
    copy ${worksrcpath}/Contents ${destroot}${path}
}
destroot.violate_mtree      yes