From f4beadc6e28b812237e01e6f8f2c4afcf57bb4d5 Mon Sep 17 00:00:00 2001 From: Douglas Mencken Date: Mon, 7 Jul 2014 14:18:12 -0400 Subject: avoid -arch for bundled OpenSSL, Python3, and nss/nspr on OSX@PowerPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this fixes gcc: error: unrecognized command line option '-arch' The '-arch' option is part of Apple's extensions to GCC, and it is uncompatible with "vanilla" GCC from FSF. Also, we're not building "universal binaries". Change-Id: I44e7c72bbb1dd4be5ac9cdbc4f210aaccea513b4 Reviewed-on: https://gerrit.libreoffice.org/10117 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- external/nss/ExternalProject_nss.mk | 5 +-- external/nss/nss_macosx.patch | 47 +++++++++++++++++++--------- external/openssl/UnpackedTarball_openssl.mk | 1 + external/openssl/opensslosxppc.patch | 15 +++++++++ external/python3/ExternalProject_python3.mk | 3 +- external/python3/python-3.3.0-darwin.patch.1 | 2 +- 6 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 external/openssl/opensslosxppc.patch diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk index b7e07f7bb56f..cfda1acd593d 100644 --- a/external/nss/ExternalProject_nss.mk +++ b/external/nss/ExternalProject_nss.mk @@ -59,8 +59,9 @@ else # OS!=WNT $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python) $(call gb_ExternalProject_run,build,\ $(if $(filter FREEBSD LINUX MACOSX,$(OS)),$(if $(filter X86_64,$(CPUNAME)),USE_64=1)) \ - $(if $(filter MACOSX,$(OS)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH) \ - $(if $(filter 1050,$(MAC_OS_X_VERSION_MIN_REQUIRED)),,NSS_USE_SYSTEM_SQLITE=1)) \ + $(if $(filter MACOSX,$(OS)),\ + $(if $(filter-out POWERPC,$(CPUNAME)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH)) \ + $(if $(filter-out 1050,$(MAC_OS_X_VERSION_MIN_REQUIRED)),NSS_USE_SYSTEM_SQLITE=1)) \ $(if $(filter SOLARIS,$(OS)),NS_USE_GCC=1) \ $(if $(CROSS_COMPILING),\ $(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),CPU_ARCH=ppc) \ diff --git a/external/nss/nss_macosx.patch b/external/nss/nss_macosx.patch index 853cd34d4f6b..348d42be6d92 100644 --- a/external/nss/nss_macosx.patch +++ b/external/nss/nss_macosx.patch @@ -1,6 +1,6 @@ ---- a/a/nss/Makefile 2008-12-03 00:24:39.000000000 +0100 -+++ b/b/nss/Makefile 2009-11-27 13:36:22.662753328 +0100 -@@ -104,6 +104,9 @@ +--- a/a/nss/Makefile ++++ b/b/nss/Makefile +@@ -69,6 +69,9 @@ ifeq ($(OS_TARGET),WIN95) NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95 endif @@ -10,9 +10,33 @@ ifdef USE_DEBUG_RTL NSPR_CONFIGURE_OPTS += --enable-debug-rtl endif +--- a/a/nspr/configure.in ++++ b/b/nspr/configure.in +@@ -1374,7 +1374,9 @@ + ;; + esac + if test "`echo $CC | grep -c '\-arch '`" = "0"; then +- CC="$CC -arch $CPU_ARCH" ++ if test "$CPU_ARCH" != "ppc"; then ++ CC="$CC -arch $CPU_ARCH" ++ fi + fi + AC_CHECK_HEADER(crt_externs.h) + DSO_CFLAGS=-fPIC --- a/a/nspr/configure +++ b/b/nspr/configure -@@ -3888,7 +3889,7 @@ +@@ -3864,7 +3864,9 @@ + ;; + esac + if test "`echo $CC | grep -c '\-arch '`" = "0"; then +- CC="$CC -arch $CPU_ARCH" ++ if test "$CPU_ARCH" != "ppc"; then ++ CC="$CC -arch $CPU_ARCH" ++ fi + fi + ac_safe=`echo "crt_externs.h" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for crt_externs.h""... $ac_c" 1>&6 +@@ -3900,7 +3902,7 @@ fi DSO_CFLAGS=-fPIC @@ -23,7 +47,7 @@ STRIP="$STRIP -x -S" --- a/a/nss/coreconf/Darwin.mk +++ b/b/nss/coreconf/Darwin.mk -@@ -39,8 +39,12 @@ +@@ -7,8 +7,12 @@ DEFAULT_COMPILER = gcc @@ -38,7 +62,7 @@ RANLIB = ranlib ifndef CPU_ARCH -@@ -57,19 +57,25 @@ +@@ -19,11 +23,15 @@ ifeq (,$(filter-out i%86,$(CPU_ARCH))) ifdef USE_64 @@ -54,19 +78,14 @@ override CPU_ARCH = x86 endif else - ifeq (arm,$(CPU_ARCH)) +@@ -31,17 +39,20 @@ # Nothing set for arm currently. else OS_REL_CFLAGS = -Dppc -+ifeq (,$(findstring -arch ,$(CC))) - CC += -arch ppc -+endif +-CC += -arch ppc endif endif -@@ -64,12 +64,16 @@ - endif - ifneq (,$(MACOS_SDK_DIR)) + CLANG_VERSION_FULL := $(shell $(CC) -v 2>&1 | grep "clang version" | sed -e "s/^.*clang version[ ]*//" | awk '{ print $$1 }') GCC_VERSION_FULL := $(shell $(CC) -dumpversion) @@ -82,7 +101,7 @@ # GCC <= 3 DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0)) -@@ -150,7 +150,7 @@ +@@ -104,7 +115,7 @@ # May override this with different compatibility and current version numbers. DARWIN_DYLIB_VERSIONS = -compatibility_version 1 -current_version 1 # May override this with -bundle to create a loadable module. diff --git a/external/openssl/UnpackedTarball_openssl.mk b/external/openssl/UnpackedTarball_openssl.mk index cf875f7ab6ad..8c3f419bace3 100644 --- a/external/openssl/UnpackedTarball_openssl.mk +++ b/external/openssl/UnpackedTarball_openssl.mk @@ -28,6 +28,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,openssl,\ $(if $(filter MSC,$(COM)),external/openssl/openssl-1.0.1g-msvc2012-winxp.patch.1) \ $(if $(filter SOLARIS,$(OS)),external/openssl/opensslsol.patch) \ $(if $(filter IOS,$(OS)),external/openssl/opensslios.patch) \ + $(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),external/openssl/opensslosxppc.patch) \ )) # vim: set noet sw=4 ts=4: diff --git a/external/openssl/opensslosxppc.patch b/external/openssl/opensslosxppc.patch new file mode 100644 index 000000000000..5f513aee8fad --- /dev/null +++ b/external/openssl/opensslosxppc.patch @@ -0,0 +1,15 @@ +-*- Mode: diff -*- + +--- a/openssl/Configure ++++ b/openssl/Configure +@@ -577,8 +577,8 @@ + + ##### MacOS X (a.k.a. Rhapsody or Darwin) setup + "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", +-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin-ppc-cc","cc:-m32 -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin64-ppc-cc","cc:-m64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", + "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", + "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", + "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk index 3eda350fbd2b..0d958bccb7e9 100644 --- a/external/python3/ExternalProject_python3.mk +++ b/external/python3/ExternalProject_python3.mk @@ -70,7 +70,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) : OPT="$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS)")) \ $(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \ $(if $(filter MACOSX,$(OS)), \ - $(if $(filter INTEL POWERPC,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit) --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \ + $(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) --with-universal-archs=32-bit) \ + --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \ --enable-shared \ ) \ CC="$(strip $(CC) \ diff --git a/external/python3/python-3.3.0-darwin.patch.1 b/external/python3/python-3.3.0-darwin.patch.1 index a32b7f588b01..ec4f45f8db74 100644 --- a/external/python3/python-3.3.0-darwin.patch.1 +++ b/external/python3/python-3.3.0-darwin.patch.1 @@ -17,7 +17,7 @@ diff -ru python3.old_/configure python3/configure + UNIVERSAL_ARCH_FLAGS="-arch i386" + ;; + ppc) -+ UNIVERSAL_ARCH_FLAGS="-arch ppc" ++ UNIVERSAL_ARCH_FLAGS="" + ;; + *) + as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5 -- cgit