From b9e10514469b58aace3d65a453ffacddd1f628a4 Mon Sep 17 00:00:00 2001 From: Jonathan Frutos <11614150+e787@users.noreply.github.com> Date: Thu, 27 Jan 2022 02:57:19 +0100 Subject: [PATCH] Add initial MacOS ARM support (#7116) Co-authored-by: Jonathan Frutos <> --- builds/posix/prefix.darwin_aarch64 | 49 ++++++++++++++++++++++++++++++ configure.ac | 14 +++++++++ src/common/common.h | 4 +++ src/isql/InputDevices.cpp | 2 ++ src/jrd/license.h | 4 +-- 5 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 builds/posix/prefix.darwin_aarch64 diff --git a/builds/posix/prefix.darwin_aarch64 b/builds/posix/prefix.darwin_aarch64 new file mode 100644 index 0000000000..e9e9ae180f --- /dev/null +++ b/builds/posix/prefix.darwin_aarch64 @@ -0,0 +1,49 @@ +# The contents of this file are subject to the Interbase Public +# License Version 1.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy +# of the License at http://www.Inprise.com/IPL.html +# +# Software distributed under the License is distributed on an +# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +# or implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code was created by Inprise Corporation +# and its predecessors. Portions created by Inprise Corporation are +# +# Copyright (C) 2000 Inprise Corporation +# All Rights Reserved. +# Contributor(s): ______________________________________. +# Start of file prefix.darwin: $(VERSION) @PLATFORM@ +# 2 Oct 2002, Nickolay Samofatov - Major Cleanup +# +# Default build from 10.9 using Clang +# +# Build instructions +# set CFLAGS='-I (ICUDIR)/icu/source/common' (ucnv.h) +# set LDFLAGS='-L(ICUDIR)/icu/source/lib' (-licuuc) +# set CXXFLAGS='-I (ICUDIR)/icu/source/common -I ICUDIR/icu/source/i18n' +# where ICUDIR is where you installed ICU +# configure using --with-builtin-tommath +# or add the relevant -I, -L for an installed version of libtommath + +#DYLD_PRINT_ENV=1 +#export DYLD_PRINT_ENV + +#DYLD_PRINT_LIBRARIES=1 +#export DYLD_PRINT_LIBRARIES + +MACOSX_DEPLOYMENT_TARGET=12.0 +export MACOSX_DEPLOYMENT_TARGET + +PROD_FLAGS=-DDARWIN -DARM64 -pipe -O2 -MMD -fPIC -fno-common -mmacosx-version-min=12.0 +DEV_FLAGS=-ggdb -DDARWIN -DARM64 -pipe -MMD -fPIC -fno-omit-frame-pointer -fno-common -Wall -fno-optimize-sibling-calls -mmacosx-version-min=12.0 -Wno-non-virtual-dtor +CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -stdlib=libc++ + +UNDEF_PLATFORM= + +LINK_LIBS+=-liconv +#MATHLIB=$(ROOT)/extern/libtommath/.libs/libtommath.a +SO_LINK_LIBS+=-liconv + +include $(ROOT)/gen/darwin.defaults diff --git a/configure.ac b/configure.ac index e845e3cf89..ecde8c0d35 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,20 @@ dnl Test for special ar options? AR_OPT_CHECK=false case "$build" in + aarch64-*-darwin*) + MAKEFILE_PREFIX=darwin_aarch64 + MAKEFILE_POSTFIX=darwin + PLATFORM=DARWIN + INSTALL_PREFIX=darwin + AC_DEFINE(DARWIN, 1, [Define this if OS is DARWIN]) + XE_APPEND(-framework CoreFoundation,LIBS) + EDITLINE_FLG=Y + SHRLIB_EXT=dylib + CPU_TYPE=ARM64 + EXPORT_SYMBOLS_STYLE=darwin + RAW_DEVICES_FLG=N + ;; + x*64-*-darwin*) MAKEFILE_PREFIX=darwin_x86_64 MAKEFILE_POSTFIX=darwin diff --git a/src/common/common.h b/src/common/common.h index a3646879e7..f58b065dcb 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -230,6 +230,10 @@ #ifdef ARM #define FB_CPU CpuArm #endif /* ARM */ +#ifdef ARM64 +#define DARWIN64 +#define FB_CPU CpuArm64 +#endif /* ARM64 */ #ifdef __ppc__ #define powerpc #define FB_CPU CpuPowerPc diff --git a/src/isql/InputDevices.cpp b/src/isql/InputDevices.cpp index 24e8ae1e08..faae0a84e7 100644 --- a/src/isql/InputDevices.cpp +++ b/src/isql/InputDevices.cpp @@ -25,6 +25,8 @@ #if defined(DARWIN) && !defined(IOS) #if defined(i386) || defined(__x86_64__) #include +#elif defined(__aarch64__) +#include #else #include #endif diff --git a/src/jrd/license.h b/src/jrd/license.h index 1fbcff04d9..c162f1d3bc 100644 --- a/src/jrd/license.h +++ b/src/jrd/license.h @@ -125,8 +125,8 @@ #if defined(__ppc__) || defined(__ppc64__) #define FB_PLATFORM "UP" // Darwin/PowerPC #endif -#if defined(ARM) -#define FB_PLATFORM "UA" +#if defined(ARM) || defined(__aarch64__) +#define FB_PLATFORM "UA" // Darwin/ARM #endif #endif