Repository: spack/spack

Issue:
Qt fails to build with XCode 8 on Sierra
subj, with 
```
   Xcode not set up properly. You may need to confirm the license
   agreement by running /usr/bin/xcodebuild without arguments.
```
Perhaps while copying  Xcode to inject compiler wrappers, one should do
```
ln -s xcodebuild xcrun
```
(see http://stackoverflow.com/questions/39492617/xcode-8-error-project-error-xcode-not-set-up-properly-even-though-the-licens)

Similar issue on macPorts https://trac.macports.org/ticket/52200

@mathstuf did you see that error before?


Discussion:
No, I still only have Xcode 7 and 10.10 on the Apple machines that I typically use.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py
--- a/var/spack/repos/builtin/packages/qt/package.py
+++ b/var/spack/repos/builtin/packages/qt/package.py
@@ -23,6 +23,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
 from spack import *
+import platform
 import os
 import sys
 
@@ -186,7 +187,12 @@ def common_config_args(self):
             config_args.append('-no-phonon')
 
         if '+dbus' in self.spec:
+            dbus = self.spec['dbus'].prefix
             config_args.append('-dbus-linked')
+            config_args.append('-I%s/dbus-1.0/include' % dbus.lib)
+            config_args.append('-I%s/dbus-1.0' % dbus.include)
+            config_args.append('-L%s' % dbus.lib)
+            config_args.append('-ldbus-1')
         else:
             config_args.append('-no-dbus')
 
@@ -199,25 +205,30 @@ def common_config_args(self):
             ])
 
         if '@4' in self.spec and sys.platform == 'darwin':
+            config_args.append('-cocoa')
+
+            mac_ver = tuple(platform.mac_ver()[0].split('.')[:2])
+            sdkname = 'macosx%s' % '.'.join(mac_ver)
             sdkpath = which('xcrun')('--show-sdk-path',
-                                     # XXX(macos): 10.11 SDK fails to configure
-                                     '--sdk', 'macosx10.9',
+                                     '--sdk', sdkname,
                                      output=str)
             config_args.extend([
                 '-sdk', sdkpath.strip(),
             ])
             use_clang_platform = False
             if self.spec.compiler.name == 'clang' and \
-               str(self.spec.compiler.version).endwith('-apple'):
+               str(self.spec.compiler.version).endswith('-apple'):
                 use_clang_platform = True
             # No one uses gcc-4.2.1 anymore; this is clang.
             if self.spec.compiler.name == 'gcc' and \
                str(self.spec.compiler.version) == '4.2.1':
                 use_clang_platform = True
             if use_clang_platform:
-                config_args.extend([
-                    '-platform', 'unsupported/macx-clang',
-                ])
+                config_args.append('-platform')
+                if mac_ver >= (10, 9):
+                    config_args.append('unsupported/macx-clang-libc++')
+                else:
+                    config_args.append('unsupported/macx-clang')
 
         return config_args
 


Test patch: