summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2020-06-23 21:49:26 +0300
committerTor Lillqvist <tml@collabora.com>2020-06-29 08:48:28 +0200
commitbaab4f890c8ac99d1b8dab5790fbb7ab949100ab (patch)
tree744324518a35f59b75570b2e7fa966f9be45e599
parentc098b50953d2428a7cebdfb32f9bfc1939cb8d65 (diff)
Initial WIP steps for building for macOS on Apple Silicon
Don't use $host_os="darwin" for both macOS and iOS depending on $host_cpu. Soon macOS will run on either x86_64 or arm64. Instead, use "darwin" (or "macos") for macOS and "ios" for iOS. Some other early changes for arm64-apple-macos, too. Change-Id: Id89987d854ceba2cd87c6222db2081ccdec0c73e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96976 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--config_host.mk.in2
-rw-r--r--configure.ac134
-rw-r--r--distro-configs/LibreOfficeiOS.conf3
-rw-r--r--solenv/gbuild/platform/MACOSX_ARM64_GCC.mk13
4 files changed, 111 insertions, 41 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 3f7bbb06ce60..5b50b6f8ebe2 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -286,7 +286,7 @@ export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@
export HAVE_WDEPRECATED_COPY_DTOR=@HAVE_WDEPRECATED_COPY_DTOR@
export HELP_ONLINE=@HELP_ONLINE@
export HELP_OMINDEX_PAGE=@HELP_OMINDEX_PAGE@
-export HOST_PLATFORM=@host@
+export HOST_PLATFORM=@HOST_PLATFORM@
export HSQLDB_JAR=@HSQLDB_JAR@
export HSQLDB_USE_JDBC_4_1=@HSQLDB_USE_JDBC_4_1@
export HUNSPELL_CFLAGS=$(gb_SPACE)@HUNSPELL_CFLAGS@
diff --git a/configure.ac b/configure.ac
index b03222285ccb..00041399ebaf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,6 +597,8 @@ INSTROOTBASESUFFIX=
INSTROOTCONTENTSUFFIX=
SDKDIRNAME=sdk
+HOST_PLATFORM="$host"
+
case "$host_os" in
solaris*)
@@ -675,7 +677,7 @@ cygwin*|interix*)
LINKFLAGSNOUNDEFS=
;;
-darwin*) # macOS or iOS
+darwin*|macos*) # macOS
test_randr=no
test_xrender=no
test_freetype=no
@@ -685,26 +687,45 @@ darwin*) # macOS or iOS
mac_sanitize_path
AC_MSG_NOTICE([sanitized the PATH to $PATH])
fi
- if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
- enable_gpgmepp=no
- _os=iOS
- test_cups=no
- enable_mpl_subset=yes
- enable_lotuswordpro=no
- enable_coinmp=no
- enable_lpsolve=no
- enable_postgresql_sdbc=no
- enable_extension_integration=no
- enable_report_builder=no
- with_ppds=no
- if test "$enable_ios_simulator" = "yes"; then
- host=x86_64-apple-darwin
- fi
- else
- _os=Darwin
- INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
- INSTROOTCONTENTSUFFIX=/Contents
- SDKDIRNAME=${PRODUCTNAME}${PRODUCTVERSION}_SDK
+ _os=Darwin
+ INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
+ INSTROOTCONTENTSUFFIX=/Contents
+ SDKDIRNAME=${PRODUCTNAME}${PRODUCTVERSION}_SDK
+ # See comment above the case "$host_os"
+ LINKFLAGSSHL="-dynamiclib -single_module"
+
+ # -fPIC is default
+ PICSWITCH=""
+
+ DLLPOST=".dylib"
+
+ # -undefined error is the default
+ LINKFLAGSNOUNDEFS=""
+;;
+
+ios*) # iOS
+ test_randr=no
+ test_xrender=no
+ test_freetype=no
+ test_fontconfig=no
+ test_dbus=no
+ if test -n "$LODE_HOME" ; then
+ mac_sanitize_path
+ AC_MSG_NOTICE([sanitized the PATH to $PATH])
+ fi
+ enable_gpgmepp=no
+ _os=iOS
+ test_cups=no
+ enable_mpl_subset=yes
+ enable_lotuswordpro=no
+ enable_coinmp=no
+ enable_lpsolve=no
+ enable_postgresql_sdbc=no
+ enable_extension_integration=no
+ enable_report_builder=no
+ with_ppds=no
+ if test "$enable_ios_simulator" = "yes"; then
+ host=x86_64-apple-darwin
fi
# See comment above the case "$host_os"
LINKFLAGSSHL="-dynamiclib -single_module"
@@ -716,6 +737,10 @@ darwin*) # macOS or iOS
# -undefined error is the default
LINKFLAGSNOUNDEFS=""
+
+ # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios" part,
+ # so use arm64-apple-darwin as before for now.
+ HOST_PLATFORM=arm64-apple-darwin
;;
freebsd*)
@@ -827,6 +852,8 @@ haiku*)
;;
esac
+AC_SUBST(HOST_PLATFORM)
+
if test "$_os" = "Android" ; then
# Verify that the NDK and SDK options are proper
if test -z "$with_android_ndk"; then
@@ -2860,8 +2887,16 @@ if test $_os = Darwin; then
;;
esac
+ if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
+ AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
+ fi
+
if test "$with_macosx_version_min_required" = "" ; then
- with_macosx_version_min_required="10.10";
+ if test "$host_cpu" = x86_64; then
+ with_macosx_version_min_required="10.10";
+ else
+ with_macosx_version_min_required="11.0";
+ fi
fi
if test "$with_macosx_version_max_allowed" = "" ; then
@@ -2923,13 +2958,23 @@ if test $_os = Darwin; then
AC_MSG_CHECKING([what C compiler to use])
CC="`xcrun -find clang`"
CC_BASE=`first_arg_basename "$CC"`
- CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+ if test "$host_cpu" = x86_64; then
+ CC+=" -target x86_64-apple-macos"
+ else
+ CC+=" -target arm64-apple-macos"
+ fi
+ CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
AC_MSG_RESULT([$CC])
AC_MSG_CHECKING([what C++ compiler to use])
CXX="`xcrun -find clang++`"
CXX_BASE=`first_arg_basename "$CXX"`
- CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+ if test "$host_cpu" = x86_64; then
+ CXX+=" -target x86_64-apple-macos"
+ else
+ CXX+=" -target arm64-apple-macos"
+ fi
+ CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
AC_MSG_RESULT([$CXX])
INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
@@ -3280,10 +3325,9 @@ if test "$_os" = "WINNT"; then
BITNESS_OVERRIDE=64
fi
fi
-if test "$_os" = "iOS"; then
+if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
cross_compiling="yes"
fi
-
if test "$cross_compiling" = "yes"; then
export CROSS_COMPILING=TRUE
else
@@ -4289,7 +4333,7 @@ cygwin*)
SCPDEFS="$SCPDEFS -D_MSC_VER"
;;
-darwin*)
+darwin*|macos*)
COM=GCC
USING_X11=
OS=MACOSX
@@ -4297,23 +4341,15 @@ darwin*)
P_SEP=:
case "$host_cpu" in
- arm)
- AC_MSG_ERROR([Can't build 32-bit code for iOS])
- ;;
arm64)
- OS=iOS
- RTL_OS=iOS
if test "$enable_ios_simulator" = "yes"; then
- AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
+ OS=iOS
else
CPUNAME=ARM64
- RTL_ARCH=ARM_EABI
- PLATFORMID=ios_arm64
+ RTL_ARCH=AARCH
+ PLATFORMID=macosx_arm64
fi
;;
- i*86)
- AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
- ;;
x86_64)
if test "$enable_ios_simulator" = "yes"; then
OS=iOS
@@ -4328,6 +4364,28 @@ darwin*)
esac
;;
+ios*)
+ COM=GCC
+ USING_X11=
+ OS=iOS
+ RTL_OS=iOS
+ P_SEP=:
+
+ case "$host_cpu" in
+ arm64)
+ if test "$enable_ios_simulator" = "yes"; then
+ AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
+ ;;
+ esac
+ CPUNAME=ARM64
+ RTL_ARCH=ARM_EABI
+ PLATFORMID=ios_arm64
+ ;;
+
dragonfly*)
COM=GCC
USING_X11=TRUE
diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf
index 12f48f3073b7..2fc9b2ddf1d8 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -28,5 +28,4 @@
--without-tls
# iOS device
---host=arm64-apple-darwin
-
+--host=arm64-apple-ios
diff --git a/solenv/gbuild/platform/MACOSX_ARM64_GCC.mk b/solenv/gbuild/platform/MACOSX_ARM64_GCC.mk
new file mode 100644
index 000000000000..d8845ccbb3f9
--- /dev/null
+++ b/solenv/gbuild/platform/MACOSX_ARM64_GCC.mk
@@ -0,0 +1,13 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+include $(GBUILDDIR)/platform/macosx.mk
+
+# vim: set noet sw=4 ts=4: