office-gobmx/external/nss/nss_macosx.patch
Douglas Mencken f4beadc6e2 avoid -arch for bundled OpenSSL, Python3, and nss/nspr on OSX@PowerPC
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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-07-11 14:42:57 +00:00

112 lines
3.7 KiB
Diff

--- a/a/nss/Makefile
+++ b/b/nss/Makefile
@@ -69,6 +69,9 @@
ifeq ($(OS_TARGET),WIN95)
NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95
endif
+ifdef MACOS_SDK_DIR
+NSPR_CONFIGURE_OPTS += --with-macos-sdk=$(MACOS_SDK_DIR)
+endif
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
@@ -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
- DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
+ DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @__________________________________________________OOO/$@ -headerpad_max_install_names'
_OPTIMIZE_FLAGS=-O2
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
STRIP="$STRIP -x -S"
--- a/a/nss/coreconf/Darwin.mk
+++ b/b/nss/coreconf/Darwin.mk
@@ -7,8 +7,12 @@
DEFAULT_COMPILER = gcc
-CC = gcc
-CCC = g++
+# CC is taken from environment automatically.
+#CC = cc
+# Use CCC from environment.
+#CCC = c++
+CCC = $(CXX)
+
RANLIB = ranlib
ifndef CPU_ARCH
@@ -19,11 +23,15 @@
ifeq (,$(filter-out i%86,$(CPU_ARCH)))
ifdef USE_64
+ifeq (,$(findstring -arch ,$(CC)))
CC += -arch x86_64
+endif
override CPU_ARCH = x86_64
else
OS_REL_CFLAGS = -Di386
+ifeq (,$(findstring -arch ,$(CC)))
CC += -arch i386
+endif
override CPU_ARCH = x86
endif
else
@@ -31,17 +39,20 @@
# Nothing set for arm currently.
else
OS_REL_CFLAGS = -Dppc
-CC += -arch ppc
endif
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)
GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$1 }')
GCC_VERSION_MINOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$2 }')
GCC_VERSION = $(GCC_VERSION_MAJOR).$(GCC_VERSION_MINOR)
+ ifneq (,$(CLANG_VERSION_FULL))
+ DARWIN_SDK_CFLAGS = -isysroot $(MACOS_SDK_DIR)
+ DARWIN_SDK_SHLIBFLAGS = -isysroot $(MACOS_SDK_DIR)
- ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR)))
+ else ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR)))
# GCC <= 3
DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks
ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0))
@@ -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.
-DSO_LDOPTS = -dynamiclib $(DARWIN_DYLIB_VERSIONS) -install_name @executable_path/$(notdir $@) -headerpad_max_install_names
+DSO_LDOPTS = -dynamiclib $(DARWIN_DYLIB_VERSIONS) -install_name @__________________________________________________OOO/$(notdir $@) -headerpad_max_install_names
MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS)
DLL_SUFFIX = dylib