Re: PG vs macOS Mojave - Mailing list pgsql-hackers
From | Tom Lane |
---|---|
Subject | Re: PG vs macOS Mojave |
Date | |
Msg-id | 4844.1541107036@sss.pgh.pa.us Whole thread Raw |
In response to | Re: PG vs macOS Mojave (Daniel Gustafsson <daniel@yesql.se>) |
Responses |
Re: PG vs macOS Mojave
Re: PG vs macOS Mojave |
List | pgsql-hackers |
So it seems like there are two ways we could go about this. One is to go back to the scheme of adding an -isysroot switch to CPPFLAGS, where it'd have global effects. We could make this slightly less painful for scenarios like Jakob's if we set things up in Makefile.global this way: CPPFLAGS = -isysroot $(PG_SYSROOT) PG_SYSROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk and then, if you need to build on a different SDK version without reconfiguring, you can do something like "make PG_SYSROOT=/proper/path". I coded this up, as attached, and it seems to work but it's still not all that friendly for such cases. The other idea that's occurred to me is to go back to the scheme of commit 68fc227dd, where we inject the sysroot path into just the -I switches used for PL/Perl and PL/Tcl. We could improve on that commit by injecting it symbolically similar to what I did here, ie what ends up in the configure output is PG_SYSROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk perl_includespec = -I $(PG_SYSROOT)/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE Then somebody who wants to build on a different SDK version still needs to do "make PG_SYSROOT=/proper/path", but only if they're trying to build PL/Perl or related extensions. So this second way seems uglier in some sense but less likely to cause problems for most people. Either way I guess we'd need to document it rather than just hoping it's invisible. Thoughts? regards, tom lane diff --git a/configure b/configure index 43ae8c8..0686941 100755 *** a/configure --- b/configure *************** ac_includes_default="\ *** 627,632 **** --- 627,633 ---- ac_subst_vars='LTLIBOBJS vpath_build + PG_SYSROOT PG_VERSION_NUM PROVE FOP *************** _ACEOF *** 18815,18820 **** --- 18816,18830 ---- + # If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not + # literally, so that it's possible to override it at build time using + # a command like "make ... PG_SYSROOT=path". This has to be done after + # we've finished all configure checks that depend on CPPFLAGS. + if test x"$PG_SYSROOT" != x; then + CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + fi + + # Begin output steps diff --git a/configure.in b/configure.in index 519ecd5..7586deb 100644 *** a/configure.in --- b/configure.in *************** $AWK '{printf "%d%04d", $1, $2}'`"] *** 2357,2362 **** --- 2357,2371 ---- AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number]) AC_SUBST(PG_VERSION_NUM) + # If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not + # literally, so that it's possible to override it at build time using + # a command like "make ... PG_SYSROOT=path". This has to be done after + # we've finished all configure checks that depend on CPPFLAGS. + if test x"$PG_SYSROOT" != x; then + CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + fi + AC_SUBST(PG_SYSROOT) + # Begin output steps diff --git a/src/Makefile.global.in b/src/Makefile.global.in index bdf394b..218c65a 100644 *** a/src/Makefile.global.in --- b/src/Makefile.global.in *************** BITCODE_CXXFLAGS = @BITCODE_CXXFLAGS@ *** 241,246 **** --- 241,247 ---- CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ + PG_SYSROOT = @PG_SYSROOT@ override CPPFLAGS := $(ICU_CFLAGS) $(CPPFLAGS) diff --git a/src/template/darwin b/src/template/darwin index 159d8bb..c05adca 100644 *** a/src/template/darwin --- b/src/template/darwin *************** *** 3,16 **** # 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. 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 PG_SYSROOT="" fi fi --- 3,17 ---- # 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. ! # 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 ! CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS" ! else PG_SYSROOT="" fi fi
pgsql-hackers by date: