feat: add package openjdk #25

Merged
sisungo merged 1 commits from sisungo/ports:openjdk into main 2026-11-01 10:46:16 +00:00
2 changed files with 237 additions and 0 deletions

No files matched your search

@@ -0,0 +1,147 @@
--- a/src/hotspot/os/posix/forbiddenFunctions_posix.hpp 2026-10-30 05:15:11.792623724 +0000
+++ b/src/hotspot/os/posix/forbiddenFunctions_posix.hpp 2026-10-30 05:16:01.186833948 +0000
@@ -37,25 +37,25 @@
#endif
// POSIX puts _exit in <unistd.h>.
-FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
+//FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
// If needed, add os::strndup and use that instead.
-FORBID_C_FUNCTION(char* strndup(const char*, size_t), noexcept, "don't use");
+//FORBID_C_FUNCTION(char* strndup(const char*, size_t), noexcept, "don't use");
// realpath with a null second argument mallocs a string for the result.
// With a non-null second argument, there is a risk of buffer overrun.
-PRAGMA_DIAG_PUSH
-FORBIDDEN_FUNCTION_IGNORE_CLANG_FORTIFY_WARNING
-FORBID_C_FUNCTION(char* realpath(const char*, char*), noexcept, "use os::realpath");
-PRAGMA_DIAG_POP
+//PRAGMA_DIAG_PUSH
+//FORBIDDEN_FUNCTION_IGNORE_CLANG_FORTIFY_WARNING
+//FORBID_C_FUNCTION(char* realpath(const char*, char*), noexcept, "use os::realpath");
+//PRAGMA_DIAG_POP
// Returns a malloc'ed string.
-FORBID_C_FUNCTION(char* get_current_dir_name(), noexcept, "use os::get_current_directory");
+//FORBID_C_FUNCTION(char* get_current_dir_name(), noexcept, "use os::get_current_directory");
// Problematic API that should never be used.
-FORBID_C_FUNCTION(char* getwd(char*), noexcept, "use os::get_current_directory");
+//FORBID_C_FUNCTION(char* getwd(char*), noexcept, "use os::get_current_directory");
// BSD utility that is subtly different from realloc.
-FORBID_C_FUNCTION(void* reallocf(void*, size_t), /* not noexcept */, "use os::realloc");
+//FORBID_C_FUNCTION(void* reallocf(void*, size_t), /* not noexcept */, "use os::realloc");
#endif // OS_POSIX_FORBIDDENFUNCTIONS_POSIX_HPP
--- a/src/hotspot/share/cppstdlib/cstdlib.hpp 2026-08-19 14:06:10.000000000 +0000
+++ b/src/hotspot/share/cppstdlib/cstdlib.hpp 2026-10-30 05:19:23.272251678 +0000
@@ -76,30 +76,30 @@
#endif // AIX altivec allocator support
// Prefer os:: variants of these.
-FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
-FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
+//FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
+//FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
// Windows puts _exit in <stdlib.h>. POSIX puts it in <unistd.h>.
// We can't forbid it here when using clang if it's not in <stdlib.h> - see
// the clang definition for FORBIDDEN_FUNCTION_NORETURN_ATTRIBUTE.
#ifdef _WINDOWS
-FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
+//FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
#endif // _WINDOWS
// These functions return raw C-heap pointers or, in case of free(), take raw
// C-heap pointers. We generally want allocation to be done through NMT, using
// os::malloc and friends.
-FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t), noexcept, "use os::malloc");
-FORBID_IMPORTED_C_FUNCTION(void free(void*), noexcept, "use os::free");
-FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t, size_t), noexcept, "use os::malloc and zero out manually");
-FORBID_IMPORTED_C_FUNCTION(void* realloc(void*, size_t), noexcept, "use os::realloc");
+//FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t), noexcept, "use os::malloc");
+//FORBID_IMPORTED_C_FUNCTION(void free(void*), noexcept, "use os::free");
+//FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t, size_t), noexcept, "use os::malloc and zero out manually");
+//FORBID_IMPORTED_C_FUNCTION(void* realloc(void*, size_t), noexcept, "use os::realloc");
// These are not provided (and are unimplementable?) by Windows.
// https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019
// They also aren't useful for a POSIX implementation of NMT.
#ifndef _WINDOWS
-FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
-FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
+//FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
+//FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
#endif // !_WINDOWS
#endif // SHARE_CPPSTDLIB_CSTDLIB_HPP
--- a/src/hotspot/share/utilities/forbiddenFunctions.hpp 2026-08-19 14:06:10.000000000 +0000
+++ b/src/hotspot/share/utilities/forbiddenFunctions.hpp 2026-10-30 05:21:27.402739421 +0000
@@ -43,28 +43,28 @@
// or have security concerns, either with preferred alternatives, or to be
// avoided entirely.
-FORBID_IMPORTED_C_FUNCTION(char* strerror(int), noexcept, "use os::strerror");
-FORBID_IMPORTED_C_FUNCTION(char* strtok(char*, const char*), noexcept, "use strtok_r");
+//FORBID_IMPORTED_C_FUNCTION(char* strerror(int), noexcept, "use os::strerror");
+//FORBID_IMPORTED_C_FUNCTION(char* strtok(char*, const char*), noexcept, "use strtok_r");
// AIX declarations for sprintf and snprintf are not noexcept, which is
// inconsistent with most other system header declarations, including being
// inconsistent with vsprintf and fsnprintf.
-FORBID_C_FUNCTION(int sprintf(char*, const char*, ...), NOT_AIX(noexcept), "use os::snprintf");
-FORBID_C_FUNCTION(int snprintf(char*, size_t, const char*, ...), NOT_AIX(noexcept), "use os::snprintf");
+//FORBID_C_FUNCTION(int sprintf(char*, const char*, ...), NOT_AIX(noexcept), "use os::snprintf");
+//FORBID_C_FUNCTION(int snprintf(char*, size_t, const char*, ...), NOT_AIX(noexcept), "use os::snprintf");
PRAGMA_DIAG_PUSH
FORBIDDEN_FUNCTION_IGNORE_CLANG_FORTIFY_WARNING
-FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), noexcept, "use os::vsnprintf");
-FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), noexcept, "use os::vsnprintf");
+//FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), noexcept, "use os::vsnprintf");
+//FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), noexcept, "use os::vsnprintf");
PRAGMA_DIAG_POP
// All of the following functions return raw C-heap pointers. We generally
// want allocation to be done through NMT.
-FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup");
-FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use");
+//FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup");
+//FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use");
// Disallow non-wrapped raw library function.
-MACOS_AARCH64_ONLY(FORBID_C_FUNCTION(void pthread_jit_write_protect_np(int enabled), noexcept, \
- "use os::current_thread_enable_wx");)
+//MACOS_AARCH64_ONLY(FORBID_C_FUNCTION(void pthread_jit_write_protect_np(int enabled), noexcept, \
+// "use os::current_thread_enable_wx");)
#endif // SHARE_UTILITIES_FORBIDDENFUNCTIONS_HPP
--- a/src/jdk.jpackage/share/native/common/SysInfo.h 2026-08-19 14:06:10.000000000 +0000
+++ b/src/jdk.jpackage/share/native/common/SysInfo.h 2026-11-01 05:19:38.503721391 +0000
@@ -28,6 +28,7 @@
#define SYSINFO_H
#include "tstrings.h"
+#include <new>
//
--- a/src/jdk.jpackage/linux/native/libapplauncher/Package.cpp 2026-08-19 14:06:10.000000000 +0000
+++ b/src/jdk.jpackage/linux/native/libapplauncher/Package.cpp 2026-11-01 05:21:02.547026922 +0000
@@ -28,6 +28,8 @@
#include "AppLauncher.h"
#include "ErrorHandling.h"
+#include <new>
+
Package::Package(): type(Unknown) {
}
+90
View File
@@ -0,0 +1,90 @@
import subprocess
import glob
import os
from lib import cpp, packie
from lib.make import *
version("27.0.0")
description("JDK implementation of the OpenJDK project.")
maintainer("sisungo <[email protected]>")
source_managed("github://openjdk/jdk#v27ga")
builddep("shortcut/c++")
builddep("shortcut/autotools")
builddep("pkgconf @target")
builddep("libjpeg-turbo-dev @target")
builddep("liblcms-dev @target")
builddep("libpng-dev @target")
builddep("libharfbuzz-dev @target")
builddep("libfreetype-dev @target")
builddep("libffi-dev @target")
builddep("alsa-lib-dev @target")
builddep("cups-dev @target")
builddep("linux-dev @target")
builddep("bash")
builddep("file")
builddep("zip")
builddep("openjdk @target")
def build():
os.environ["CC"] = "clang"
os.environ["CXX"] = "clang++"
cpp.configure([
"--enable-headless-only",
"--enable-jvm-feature-cds",
"--enable-jvm-feature-compiler1",
"--enable-jvm-feature-compiler2",
"--enable-jvm-feature-epsilongc",
"--enable-jvm-feature-g1gc",
"--enable-jvm-feature-jfr",
"--enable-jvm-feature-jni-check",
"--enable-jvm-feature-jvmti",
#"--enable-jvm-feature-link-time-opt",
"--enable-jvm-feature-management",
"--enable-jvm-feature-parallelgc",
"--enable-jvm-feature-serialgc",
"--enable-jvm-feature-services",
"--enable-jvm-feature-shenandoahgc",
"--enable-jvm-feature-vm-structs",
"--enable-jvm-feature-zgc",
"--with-build-user=root",
"--with-vendor-name=SemiOS",
"--with-vendor-url=https://os.semilabs.org",
"--with-vendor-bug-url=https://gitea.semilabs.org/semios/ports/issues/new",
"--with-vendor-vm-bug-url=https://gitea.semilabs.org/semios/ports/issues/new",
"--with-toolchain-type=clang",
"--with-stdc++lib=dynamic",
f"--with-freetype-include={packie.prefix_of('libfreetype-dev')}/include",
f"--with-freetype-lib={packie.prefix_of('libfreetype')}/lib",
"--with-lcms=system",
"--with-libpng=system",
"--with-harfbuzz=system",
"--with-libjpeg=system",
"--with-copyright-year=2026",
"--disable-warnings-as-errors",
])
subprocess.run(
["make", "images", "SOURCE_DATE_ISO_8601=2026-11-01T00:00:00Z"],
check=True,
)
os.chdir(glob.glob("./build/*-release/images/jdk")[0])
on_build(build)
def pack(composer):
composer.add("bin")
composer.add("conf")
composer.add("demo")
composer.add("include")
composer.add("jmods")
composer.add("legal")
composer.add("lib")
composer.add("release")
package("openjdk")
dep("semi-libc @same-arch")
on_pack(pack)