From 7d6ca5599d69f8a3c1d236b036e34c50d00b4400 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Thu, 30 Aug 2018 02:12:03 +0100 Subject: [PATCH] postgresql@9.6: fix Mojave build --- Formula/postgresql@9.6.rb | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/Formula/postgresql@9.6.rb b/Formula/postgresql@9.6.rb index 43b6d77a1a..a1fa04d351 100644 --- a/Formula/postgresql@9.6.rb +++ b/Formula/postgresql@9.6.rb @@ -82,11 +82,42 @@ class PostgresqlAT96 < Formula args << "--enable-dtrace" if build.with? "dtrace" args << "--with-uuid=e2fs" + # As of Xcode/CLT 10.x the Perl headers were moved from /System + # to inside the SDK, so we need to use `-iwithsysroot` instead + # of `-I` to point to the correct location. + # https://www.postgresql.org/message-id/153558865647.1483.573481613491501077%40wrigleys.postgresql.org + if DevelopmentTools.clang_build_version >= 1000 + inreplace "configure", + "-I$perl_archlibexp/CORE", + "-iwithsysroot $perl_archlibexp/CORE" + inreplace "contrib/hstore_plperl/Makefile", + "-I$(perl_archlibexp)/CORE", + "-iwithsysroot $(perl_archlibexp)/CORE" + inreplace "src/pl/plperl/GNUmakefile", + "-I$(perl_archlibexp)/CORE", + "-iwithsysroot $(perl_archlibexp)/CORE" + end + system "./configure", *args system "make" - system "make", "install-world", "datadir=#{pkgshare}", - "libdir=#{lib}", - "pkglibdir=#{lib}" + + dirs = %W[datadir=#{pkgshare} libdir=#{lib} pkglibdir=#{lib}] + + # Temporarily disable building/installing the documentation. + # Postgresql seems to "know" the build system has been altered and + # tries to regenerate the documentation when using `install-world`. + # This results in the build failing: + # `ERROR: `osx' is missing on your system.` + # Attempting to fix that by adding a dependency on `open-sp` doesn't + # work and the build errors out on generating the documentation, so + # for now let's simply omit it so we can package Postgresql for Mojave. + if DevelopmentTools.clang_build_version >= 1000 + system "make", "all" + system "make", "-C", "contrib", "install", "all", *dirs + system "make", "install", "all", *dirs + else + system "make", "install-world", *dirs + end end def post_install