From a0f8a70679975f336c54fffd4c22c85c1660c80d Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Mon, 8 Apr 2019 00:06:55 +0100
Subject: Using Clang on Mac OS systems for pkg-config

Yahya Sefidbakht reported the following error when building Pkg-config on
his Mac OS system (using GCC, not Clang). It is apparently because his
version of GCC doesn't support some speical feature on Mac that is
necessary to build Glib as part of Pkg-config.

With this commit, on Mac systems, for pkg-config we are explicity asking to
build with Clang (through the `CC' flag).
---
 reproduce/src/make/dependencies-basic.mk | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'reproduce/src')

diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index c15ef01..ac662a4 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -713,8 +713,16 @@ $(ibidir)/m4: $(tdir)/m4-$(m4-version).tar.gz \
 
 $(ibidir)/pkg-config: $(tdir)/pkg-config-$(pkgconfig-version).tar.gz \
                       $(ibidir)/bash
-	$(call gbuild, $<, pkg-config-$(pkgconfig-version), static, \
-                       --with-internal-glib --with-pc-path=$(ildir)/pkgconfig) \
+        # Some Mac OS systems may have a version of the GNU C Compiler
+        # (GCC) installed that doesn't support some necessary features of
+        # building Glib (as part of pkg-config). So to be safe, for Mac
+        # systems, we'll make sure it will use LLVM's Clang.
+	if [ x$(on_mac_os) = xyes ]; then export compiler="CC=clang"; \
+	else                              export compiler="";         \
+	fi;                                                           \
+	$(call gbuild, $<, pkg-config-$(pkgconfig-version), static,   \
+	               $$compiler --with-internal-glib                \
+	               --with-pc-path=$(ildir)/pkgconfig)             \
 	&& echo "pkg-config $(pkgconfig-version)" > $@
 
 $(ibidir)/sed: $(tdir)/sed-$(sed-version).tar.xz \
-- 
cgit v1.2.1