build: (fixes #2637) macOS SDK headers in non-standard place
authorTom Henderson <tomh@tomh.org>
Tue, 13 Nov 2018 11:12:00 -0800
changeset 13771 36bc4c2393b0
parent 13770 d63f14f226fc
child 13772 c815b3a65c62
build: (fixes #2637) macOS SDK headers in non-standard place
src/config-store/wscript
--- a/src/config-store/wscript	Tue Oct 02 16:39:28 2018 -0700
+++ b/src/config-store/wscript	Tue Nov 13 11:12:00 2018 -0800
@@ -1,6 +1,8 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 import wutils
+import sys
+import subprocess
 from waflib import Options
 
 # Bug 2936 gcc version issue for GTK+ and -Wparentheses
@@ -80,6 +82,15 @@
     if bld.env['ENABLE_LIBXML2']:
         module.source.append('model/xml-config.cc')
         module.use.append('LIBXML2')
+        # Bug 2637:  use xcrun utility to find where macOS puts headers
+        if sys.platform == 'darwin':
+            find_sdk_path = '/usr/bin/xcrun --show-sdk-path'.split()
+            try:
+                p = subprocess.Popen(find_sdk_path, stdout=subprocess.PIPE)
+                xcrun_output = p.stdout.read().strip()
+                module.includes = xcrun_output + '/usr/include/libxml2'
+            except OSError:
+                pass
 
     if bld.env['ENABLE_EXAMPLES']:
         bld.recurse('examples')