From 1b5e8b408eb9014d0779515705a601debd22ba56 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 2 Nov 2018 18:54:00 -0400 Subject: Yet further rethinking of build changes for macOS Mojave. The solution arrived at in commit e74dd00f5 presumes that the compiler has a suitable default -isysroot setting ... but further experience shows that in many combinations of macOS version, XCode version, Xcode command line tools version, and phase of the moon, Apple's compiler will *not* supply a default -isysroot value. We could potentially go back to the approach used in commit 68fc227dd, but I don't have a lot of faith in the reliability or life expectancy of that either. Let's just revert to the approach already shipped in 11.0, namely specifying an -isysroot switch globally. As a partial response to the concerns raised by Jakob Egger, adjust the contents of Makefile.global to look like CPPFLAGS = -isysroot $(PG_SYSROOT) ... PG_SYSROOT = /path/to/sysroot This allows overriding the sysroot path at build time in a relatively painless way. Add documentation to installation.sgml about how to use the PG_SYSROOT option. I also took the opportunity to document how to work around macOS's "System Integrity Protection" feature. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us --- src/Makefile.global.in | 1 + src/template/darwin | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 363b643f722..be22885f400 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -226,6 +226,7 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +PG_SYSROOT = @PG_SYSROOT@ ifdef PGXS override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS) diff --git a/src/template/darwin b/src/template/darwin index 159d8bb1275..c05adca0bfb 100644 --- a/src/template/darwin +++ b/src/template/darwin @@ -3,14 +3,15 @@ # Note: Darwin is the original code name for macOS, also known as OS X. # We still use "darwin" as the port name, partly because config.guess does. -# Some configure tests require explicit knowledge of where the Xcode "sysroot" -# is. We try to avoid having this leak into configure's results, though. +# Select where system include files should be sought. if test x"$PG_SYSROOT" = x"" ; then PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null` fi # Old xcodebuild versions may produce garbage, so validate the result. if test x"$PG_SYSROOT" != x"" ; then - if test \! -d "$PG_SYSROOT" ; then + if test -d "$PG_SYSROOT" ; then + CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS" + else PG_SYSROOT="" fi fi -- cgit v1.2.3