mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
152 lines
6.6 KiB
Diff
152 lines
6.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Timur Sultanov <SultanovTS@yandex.ru>
|
|
Date: Wed, 16 Feb 2022 21:04:18 +0300
|
|
Subject: [PATCH] make: Add Serenity support, masquerading as BSD when
|
|
necessary
|
|
|
|
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
|
|
---
|
|
make/autoconf/flags-cflags.m4 | 3 +++
|
|
make/autoconf/flags-ldflags.m4 | 11 +++++++++++
|
|
make/autoconf/platform.m4 | 8 ++++++++
|
|
make/autoconf/toolchain.m4 | 1 +
|
|
make/common/modules/LauncherCommon.gmk | 3 +++
|
|
make/hotspot/lib/JvmMapfile.gmk | 12 ++++++++++++
|
|
make/modules/java.base/lib/CoreLibraries.gmk | 1 +
|
|
7 files changed, 39 insertions(+)
|
|
|
|
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
|
|
index ea1d62685db283c445114ca43acc6c0208ad4b5c..88679489fc09019212286e0cb75885a05103dc85 100644
|
|
--- a/make/autoconf/flags-cflags.m4
|
|
+++ b/make/autoconf/flags-cflags.m4
|
|
@@ -416,6 +416,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
|
|
CFLAGS_OS_DEF_JVM="-DAIX"
|
|
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
|
|
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
|
|
+ elif test "x$OPENJDK_TARGET_OS" = xserenity; then
|
|
+ CFLAGS_OS_DEF_JDK="-DSERENITY"
|
|
+ CFLAGS_OS_DEF_JVM="-DSERENITY"
|
|
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
|
|
CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
|
|
fi
|
|
diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
|
|
index 23bb33e878d17d2b8072189c1c6d4b17097598e7..e3deb0c3fb0cecfb39b4052f0e5abda34465abc9 100644
|
|
--- a/make/autoconf/flags-ldflags.m4
|
|
+++ b/make/autoconf/flags-ldflags.m4
|
|
@@ -110,6 +110,17 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
|
|
fi
|
|
fi
|
|
|
|
+ if test "x$OPENJDK_TARGET_OS" = xserenity; then
|
|
+ if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
+ # FIXME: -lgcc_s should not be required, toolchain spec file issue
|
|
+ OS_LDFLAGS_JVM_ONLY="$OS_LDFLAGS_JVM_ONLY -ldl -lpthread -lgcc_s"
|
|
+ OS_LDFLAGS="$OS_LDFLAGS -ldl -lpthread -lgcc_s"
|
|
+ elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
+ OS_LDFLAGS_JVM_ONLY="$OS_LDFLAGS_JVM_ONLY -ldl -lpthread"
|
|
+ OS_LDFLAGS="$OS_LDFLAGS -ldl -lpthread"
|
|
+ fi
|
|
+ fi
|
|
+
|
|
# Setup debug level-dependent LDFLAGS
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
|
diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
|
|
index 9e9e9454f0e092a1ecf6ab309c87f882f61dbe51..0c1f6114481735ba4b11a55335107bdaacbd1e9a 100644
|
|
--- a/make/autoconf/platform.m4
|
|
+++ b/make/autoconf/platform.m4
|
|
@@ -220,6 +220,10 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
|
|
VAR_OS=aix
|
|
VAR_OS_TYPE=unix
|
|
;;
|
|
+ *serenity*)
|
|
+ VAR_OS=serenity
|
|
+ VAR_OS_TYPE=unix
|
|
+ ;;
|
|
*)
|
|
AC_MSG_ERROR([unsupported operating system $1])
|
|
;;
|
|
@@ -521,6 +525,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
|
|
HOTSPOT_$1_OS=${OPENJDK_$1_OS}
|
|
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
HOTSPOT_$1_OS=bsd
|
|
+ elif test "x$OPENJDK_$1_OS" = xserenity; then
|
|
+ HOTSPOT_$1_OS=bsd
|
|
fi
|
|
AC_SUBST(HOTSPOT_$1_OS)
|
|
|
|
@@ -587,6 +593,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
|
|
OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
|
|
elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
|
OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
|
|
+ elif test "x$OPENJDK_TARGET_OS" = "xserenity"; then
|
|
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="bsd"
|
|
fi
|
|
AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
|
|
])
|
|
diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4
|
|
index 99c780532ee8780c530a018a9cc817d0fd0b747e..bfdc700ce82d8c2a760b12c15c08fbaa5b888b49 100644
|
|
--- a/make/autoconf/toolchain.m4
|
|
+++ b/make/autoconf/toolchain.m4
|
|
@@ -42,6 +42,7 @@ VALID_TOOLCHAINS_linux="gcc clang"
|
|
VALID_TOOLCHAINS_macosx="gcc clang"
|
|
VALID_TOOLCHAINS_aix="xlc"
|
|
VALID_TOOLCHAINS_windows="microsoft"
|
|
+VALID_TOOLCHAINS_serenity="gcc clang"
|
|
|
|
# Toolchain descriptions
|
|
TOOLCHAIN_DESCRIPTION_clang="clang/LLVM"
|
|
diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk
|
|
index 4a4ccdb230027e98401efc8bd9e0d765c9d59924..e4d08a53be18c2b8d0b44ce4dc38ddd80a744b0d 100644
|
|
--- a/make/common/modules/LauncherCommon.gmk
|
|
+++ b/make/common/modules/LauncherCommon.gmk
|
|
@@ -157,11 +157,14 @@ define SetupBuildLauncherBody
|
|
$$($1_LDFLAGS), \
|
|
LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
|
|
-L$(call FindLibDirForModule, java.base), \
|
|
+ LDFLAGS_serenity := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
|
|
+ -L$(call FindLibDirForModule, java.base), \
|
|
LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
|
|
-L$(call FindLibDirForModule, java.base), \
|
|
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
|
|
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
|
|
LIBS_linux := -ljli -lpthread $(LIBDL), \
|
|
+ LIBS_serenity := -ljli -lpthread $(LIBDL), \
|
|
LIBS_macosx := -ljli -framework Cocoa -framework Security \
|
|
-framework ApplicationServices, \
|
|
LIBS_aix := -ljli_static, \
|
|
diff --git a/make/hotspot/lib/JvmMapfile.gmk b/make/hotspot/lib/JvmMapfile.gmk
|
|
index 5cba93178c744feb0d1c0286634a40def232eca2..752727d0d8b445ab584a09ee5e0cd3f65f9813d4 100644
|
|
--- a/make/hotspot/lib/JvmMapfile.gmk
|
|
+++ b/make/hotspot/lib/JvmMapfile.gmk
|
|
@@ -64,6 +64,18 @@ ifeq ($(call isTargetOs, linux), true)
|
|
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
|
|
}'
|
|
|
|
+else ifeq ($(call isTargetOs, serenity), true)
|
|
+ DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o
|
|
+ ifneq ($(FILTER_SYMBOLS_PATTERN), )
|
|
+ FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
|
|
+ endif
|
|
+ FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM|^UseSharedSpaces$$
|
|
+ FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^_ZN9Arguments17SharedArchivePathE$$
|
|
+ FILTER_SYMBOLS_AWK_SCRIPT := \
|
|
+ '{ \
|
|
+ if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
|
|
+ }'
|
|
+
|
|
else ifeq ($(call isTargetOs, macosx), true)
|
|
# nm on macosx prints out "warning: nm: no name list" to stderr for
|
|
# files without symbols. Hide this, even at the expense of hiding real errors.
|
|
diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk
|
|
index e7188218df37dae9cc41fa19a84e914e0ac0932f..e29f9d5ad78d6da367579dfda7b8e9c0d09be2c9 100644
|
|
--- a/make/modules/java.base/lib/CoreLibraries.gmk
|
|
+++ b/make/modules/java.base/lib/CoreLibraries.gmk
|
|
@@ -210,6 +210,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
|
|
LIBS_unix := $(LIBZ_LIBS), \
|
|
LIBS_linux := $(LIBDL) -lpthread, \
|
|
LIBS_aix := $(LIBDL),\
|
|
+ LIBS_serenity := $(LIBDL) -lpthread, \
|
|
LIBS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
|
|
LIBS_windows := advapi32.lib comctl32.lib user32.lib, \
|
|
))
|