From cae8be3505acee2f58dea4ff60978aee2f8787ed Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Fri, 8 Nov 2019 19:28:30 +0000
Subject: Matplotlib problem on macOS system with GNU GCC fixed

Until now when building Matplotlib on macOS systems, we were using the
default C compiler. However, while Yahya Sefidbakht (previously) and
Mahdieh Nabavi (now) were trying to build the template, on their macOS
using the GNU Compiler Collection (GCC), we found that Matplotlib needs
special macOS headers that GCC doesn't recognize.

With this commit, when Matplotlib is being built on macOS systems, it uses
`clang' and this fixed the problem (so far checked on Mahdieh's machine).
---
 reproduce/software/make/basic.mk      | 4 ++--
 reproduce/software/make/high-level.mk | 2 +-
 reproduce/software/make/python.mk     | 6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk
index bf42808..42246e1 100644
--- a/reproduce/software/make/basic.mk
+++ b/reproduce/software/make/basic.mk
@@ -58,8 +58,8 @@ export PKG_CONFIG_PATH := $(ildir)/pkgconfig
 export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig
 export CPPFLAGS := -I$(idir)/include $(CPPFLAGS)
 export LDFLAGS := $(rpath_command) -L$(ildir) $(LDFLAGS)
-export LD_LIBRARY_PATH := $(shell echo $(ildir):$(LD_LIBRARY_PATH) \
-                                  | sed -e's/::/:/g')
+export LD_LIBRARY_PATH := $(shell echo $(LD_LIBRARY_PATH) \
+                                  | sed -e's/::/:/g' -e's/^://' -e's/:$$//')
 
 # RPATH is automatically written in macOS, so `DYLD_LIBRARY_PATH' is
 # ultimately redundant. But on some systems, even having a single value
diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk
index a75c199..6d4b503 100644
--- a/reproduce/software/make/high-level.mk
+++ b/reproduce/software/make/high-level.mk
@@ -871,7 +871,7 @@ $(ibidir)/cmake: $(ibidir)/curl \
 $(ibidir)/flex: $(ibidir)/bison \
                 | $(tdir)/flex-$(flex-version).tar.gz
 	$(call gbuild, flex-$(flex-version), static, ,V=1) \
-	&& echo "Flex $(swig-version)" > $@
+	&& echo "Flex $(flex-version)" > $@
 
 $(ibidir)/gdb: | $(ibidir)/python \
                  $(tdir)/gdb-$(gdb-version).tar.gz
diff --git a/reproduce/software/make/python.mk b/reproduce/software/make/python.mk
index dfa65b5..47d78d5 100644
--- a/reproduce/software/make/python.mk
+++ b/reproduce/software/make/python.mk
@@ -554,6 +554,12 @@ $(ipydir)/matplotlib: $(ipydir)/numpy \
                       $(ibidir)/imagemagick \
                       $(ipydir)/python-dateutil \
                       | $(tdir)/matplotlib-$(matplotlib-version).tar.gz
+        # On Mac systems, the build complains about `clang' specific
+        # features, so we can't use our own GCC build here.
+	if [ x$(on_mac_os) = xyes ]; then \
+	  export CC=clang; \
+	  export CXX=clang++; \
+	fi; \
 	$(call pybuild, tar xf, matplotlib-$(matplotlib-version)) \
 	&& cp $(dtexdir)/matplotlib.tex $(ictdir)/ \
 	&& echo "Matplotlib $(matplotlib-version) \citep{matplotlib2007}" > $@
-- 
cgit v1.2.1