From 20d0e3b37593d1157134e106067e191b496ebbcc Mon Sep 17 00:00:00 2001
From: "E. G. Patrick Bos" <egpbos@gmail.com>
Date: Mon, 13 Nov 2017 14:32:44 +0100
Subject: [PATCH] Fix building on macOS Sierra (10.12)

The -stdlib=libc++ flag is no longer supported on Sierra (it is now the
default option). I added a version check that adds the option for macOS
versions below Sierra (10.12) and removed the option otherwise.
---
 setup.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 3a66674d..7005bb73 100644
--- a/setup.py
+++ b/setup.py
@@ -52,8 +52,11 @@ def get_config_schema():
                 ]
 
         default_libs = []
+        from pkg_resources import parse_version
+        if parse_version(osx_ver) < parse_version('10.12'):  # before Sierra
+            default_cxxflags = default_cxxflags + ['-stdlib=libc++']
         default_cxxflags = default_cxxflags + [
-                '-stdlib=libc++', '-mmacosx-version-min=10.7',
+                '-mmacosx-version-min=10.7',
                 '-arch', 'i386', '-arch', 'x86_64'
                 ]
 
-- 
GitLab