config_host.mk.in | 2 configure.ac | 134 ++++++++++++++++++++--------- distro-configs/LibreOfficeiOS.conf | 3 solenv/gbuild/platform/MACOSX_ARM64_GCC.mk | 13 ++ 4 files changed, 111 insertions(+), 41 deletions(-)
New commits: commit c685184de261875980b2dda7d6c96c1a73d27703 Author: Tor Lillqvist <t...@iki.fi> AuthorDate: Tue Jun 23 21:49:26 2020 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Sun Nov 15 09:01:32 2020 +0100 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 <t...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105868 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/config_host.mk.in b/config_host.mk.in index 95971e70ba99..88ee44b16548 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -259,7 +259,7 @@ export HAVE_MACOS_LD_PLATFORMVERSION=@HAVE_MACOS_LD_PLATFORMVERSION@ export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@ 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 75f36372e32b..31d91858ca04 100644 --- a/configure.ac +++ b/configure.ac @@ -605,6 +605,8 @@ INSTROOTBASESUFFIX= INSTROOTCONTENTSUFFIX= SDKDIRNAME=sdk +HOST_PLATFORM="$host" + case "$host_os" in solaris*) @@ -680,7 +682,7 @@ cygwin*|interix*) LINKFLAGSNOUNDEFS= ;; -darwin*) # macOS or iOS +darwin*|macos*) # macOS test_randr=no test_xrender=no test_freetype=no @@ -690,26 +692,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 - build_for_ios=YES - _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=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK + _os=Darwin + INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app + INSTROOTCONTENTSUFFIX=/Contents + SDKDIRNAME=AC_PACKAGE_NAME${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 + build_for_ios=YES + _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" @@ -721,6 +742,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*) @@ -829,6 +854,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 @@ -2849,8 +2876,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 @@ -2913,13 +2948,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` @@ -3282,10 +3327,9 @@ if test "$_os" = "WINNT"; then fi fi AC_SUBST(WINDOWS_SDK_ARCH) -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 @@ -4261,7 +4305,7 @@ cygwin*) SCPDEFS="$SCPDEFS -D_MSC_VER" ;; -darwin*) +darwin*|macos*) COM=GCC USING_X11= OS=MACOSX @@ -4269,23 +4313,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 @@ -4300,6 +4336,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 9a15ad6b083f..33471127e14f 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: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits