|
|
@ -1,63 +1,74 @@ |
|
|
|
package("openjdk") |
|
|
|
package("openjdk") |
|
|
|
|
|
|
|
set_kind("binary") |
|
|
|
set_homepage("https://jdk.java.net") |
|
|
|
set_homepage("https://jdk.java.net") |
|
|
|
set_description("Java Development Kit builds, from Oracle") |
|
|
|
set_description("Java Development Kit builds, from Oracle") |
|
|
|
set_license("GPL-2.0") |
|
|
|
set_license("GPL-2.0") |
|
|
|
|
|
|
|
|
|
|
|
if is_host("windows", "mingw") then |
|
|
|
-- https://learn.microsoft.com/en-us/java/openjdk/download |
|
|
|
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_windows-x64_bin.zip") |
|
|
|
if is_host("windows") then |
|
|
|
add_versions("17", "c98d85c8417703b0f72ddc5757ed66f3478ea7107b0e6d2a98cadbc73a45d77b") |
|
|
|
if os.arch() == "x64" then |
|
|
|
add_versions("21", "776afe55020560f175d8099710d8ac07c4d40772c694385c3dd765117cbd0ac3") |
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-windows-x64.zip") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_versions("21.0.5", "12e42c2c572a111f38e2a9e044afc50dbdac850349a4d4bb26808ed33119a9cd") |
|
|
|
|
|
|
|
elseif os.arch() == "arm64" then |
|
|
|
|
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-windows-aarch64.zip") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_versions("21.0.5", "5eaa375659c543a5d3310d51004e3bdc290ff9e48e9bcd29187dfafeca97c2a4") |
|
|
|
|
|
|
|
end |
|
|
|
elseif is_host("linux") then |
|
|
|
elseif is_host("linux") then |
|
|
|
if is_arch("x86_64") then |
|
|
|
if os.arch() == "x86_64" then |
|
|
|
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_linux-x64_bin.tar.gz") |
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-linux-x64.tar.gz") |
|
|
|
add_versions("17", "e4fb2df9a32a876afb0a6e17f54c594c2780e18badfa2e8fc99bc2656b0a57b1") |
|
|
|
|
|
|
|
add_versions("21", "9f1f4a7f25ef6a73255657c40a6d7714f2d269cf15fb2ff1dc9c0c8b56623a6f") |
|
|
|
add_versions("21.0.5", "0d42a80dbc92f2f112e6db3b4b9bd278c0776a73b6050812e720230813487ebd") |
|
|
|
elseif is_arch("arm64") then |
|
|
|
elseif os.arch() == "arm64-v8a" then |
|
|
|
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_linux-aarch64_bin.tar.gz") |
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-linux-aarch64.tar.gz") |
|
|
|
add_versions("17", "745e7a387e059ddc2481ccd209d691ca926fc0f35d523051822f24b296d17df7") |
|
|
|
|
|
|
|
add_versions("21", "14504bcdea0d8bc3fe9f065924e9e2dc631317b023a722565c8239075f39062d") |
|
|
|
add_versions("21.0.5", "356844fe544085b00cd73935e0c7a4c534f286799728fa6d6e996d1cb8b1a682") |
|
|
|
end |
|
|
|
end |
|
|
|
elseif is_host("macosx") then |
|
|
|
elseif is_host("macosx") then |
|
|
|
if is_arch("x86_64") then |
|
|
|
if os.arch() == "x86_64" then |
|
|
|
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_macos-x64_bin.tar.gz") |
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-macos-x64.tar.gz") |
|
|
|
add_versions("17", "7b68b833f392aa543ba538f94c60fd477581fef96a9c1ae059fa4158e9ce75ff") |
|
|
|
|
|
|
|
add_versions("21", "197a923b1f7ea2b224fafdfb9c3ef5fc8eb197d9817d7631d96da02b619f5975") |
|
|
|
add_versions("21.0.5", "3e2317348141b28203fac39eaa60c14a1b3f1fdb9cfdbcb793eaa4dd5828da6e") |
|
|
|
elseif is_arch("arm64") then |
|
|
|
elseif os.arch() == "arm64" then |
|
|
|
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_macos-aarch64_bin.tar.gz") |
|
|
|
add_urls("https://aka.ms/download-jdk/microsoft-jdk-$(version)-macos-aarch64.tar.gz") |
|
|
|
add_versions("17", "d5bec93922815e9337040678ddf3f40e50b63c2b588cf63574fa1f2010206042") |
|
|
|
|
|
|
|
add_versions("21", "4b94951f03efe44cb6656e43f1098db3ce254a00412f9d22dff18a8328a7efdd") |
|
|
|
add_versions("21.0.5", "78aa915475b426c03059cc51e9c12596a5138457bd7ebb9b90daad119551662d") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly = true}) |
|
|
|
add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly = true}) |
|
|
|
|
|
|
|
add_configs("runtimes", {description = "Set compiler runtimes.", default = "MD", readonly = true}) |
|
|
|
|
|
|
|
add_configs("debug", {description = "Enable debug symbols.", default = false, type = "boolean", readonly = true}) |
|
|
|
|
|
|
|
|
|
|
|
if is_plat("linux") then |
|
|
|
if is_plat("linux") then |
|
|
|
add_deps("alsa-lib", {configs = {shared = true, versioned = false}}) |
|
|
|
|
|
|
|
add_deps("freetype", "libxtst", "libxi", "libxrender") |
|
|
|
|
|
|
|
add_extsources("pacman::jdk-openjdk", "apt::default-jdk") |
|
|
|
add_extsources("pacman::jdk-openjdk", "apt::default-jdk") |
|
|
|
elseif is_plat("macosx") then |
|
|
|
elseif is_plat("macosx") then |
|
|
|
add_extsources("brew::openjdk") |
|
|
|
add_extsources("brew::openjdk") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
on_fetch("windows", "mingw", function (package, opt) |
|
|
|
if is_plat("linux") then |
|
|
|
if opt.system then |
|
|
|
add_deps("alsa-lib", {configs = {shared = true, versioned = false}}) |
|
|
|
local sdkdir = os.getenv("JAVA_HOME") |
|
|
|
add_deps("freetype", "libxtst", "libxi", "libxrender") |
|
|
|
if os.isdir(sdkdir) then |
|
|
|
end |
|
|
|
local result = {} |
|
|
|
|
|
|
|
result.includedirs = {path.join(sdkdir, "include"), path.join(sdkdir, "include", "win32")} |
|
|
|
set_policy("package.precompiled", false) |
|
|
|
result.linkdirs = path.join(sdkdir, "lib") |
|
|
|
|
|
|
|
result.links = {"jvm", "jawt"} |
|
|
|
on_fetch("fetch") |
|
|
|
package:addenv("PATH", path.join(sdkdir, "bin"), path.join(sdkdir, "bin", "server")) |
|
|
|
|
|
|
|
return result |
|
|
|
if on_check then |
|
|
|
|
|
|
|
on_check(function (package) |
|
|
|
|
|
|
|
if not package:is_arch64() then |
|
|
|
|
|
|
|
raise("package(openjdk) unsupported 32-bit arch") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
on_install("windows|x64", "linux|x86_64", "macosx|x86_64", "macosx|arm64", "mingw|x86_64", function (package) |
|
|
|
on_install("windows|!x86", "linux", "macosx", function (package) |
|
|
|
local plat |
|
|
|
local plat |
|
|
|
if package:is_plat("windows", "mingw") then |
|
|
|
if package:is_plat("windows", "mingw") then |
|
|
|
plat = "win32" |
|
|
|
plat = "win32" |
|
|
|
package:addenv("PATH", "bin/server") |
|
|
|
package:add("bindirs", "bin/server") |
|
|
|
else |
|
|
|
else |
|
|
|
package:add("linkdirs", "lib", "lib/server") |
|
|
|
package:add("linkdirs", "lib", "lib/server") |
|
|
|
if package:is_plat("linux") then |
|
|
|
if package:is_plat("linux") then |
|
|
@ -75,10 +86,14 @@ package("openjdk") |
|
|
|
os.cp("conf", package:installdir()) |
|
|
|
os.cp("conf", package:installdir()) |
|
|
|
|
|
|
|
|
|
|
|
package:add("includedirs", "include", path.join("include", plat)) |
|
|
|
package:add("includedirs", "include", path.join("include", plat)) |
|
|
|
package:addenv("PATH", "bin") |
|
|
|
package:add("bindirs", "bin") |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
on_test(function (package) |
|
|
|
on_test(function (package) |
|
|
|
os.vrun("java -version") |
|
|
|
if not package:is_cross() then |
|
|
|
assert(package:has_cfuncs("JNI_CreateJavaVM", {includes = "jni.h"})) |
|
|
|
os.vrun("java -version") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if package:is_library() then |
|
|
|
|
|
|
|
assert(package:has_cfuncs("JNI_CreateJavaVM", {includes = "jni.h"})) |
|
|
|
|
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|