gcc: fix darwin dispatch/object.h header issue (#1518)
Fixes #1203. Apple ships headers in Yosemite (and possibly earlier) that are gcc-incompatible, but compile fine with clang. The fix is to copy the offending system header from /usr/include/${REST_OF_HEADER_PATH} to ${GCC_PREFIX}/include/${REST_OF_HEADER_PATH} and replace the non-gcc- compatible features with gcc-compatible equivalents. See https://github.com/hashdist/hashstack/pull/771/files for inspiration, and http://hamelot.io/programming/osx-gcc-dispatch_block_t-has-not-been-declared-invalid-typedef/ for a description of the header issue.
This commit is contained in:
parent
16f99bd0b2
commit
df79ba0dcf
@ -3,6 +3,7 @@
|
||||
from contextlib import closing
|
||||
from glob import glob
|
||||
import sys
|
||||
from os.path import isfile
|
||||
|
||||
|
||||
class Gcc(Package):
|
||||
@ -68,6 +69,19 @@ def install(self, spec, prefix):
|
||||
if spec.satisfies("@4.7.1:") and sys.platform != 'darwin':
|
||||
enabled_languages.add('go')
|
||||
|
||||
# Fix a standard header file for OS X Yosemite that
|
||||
# is GCC incompatible by replacing non-GCC compliant macros
|
||||
if 'yosemite' in spec.architecture:
|
||||
if isfile(r'/usr/include/dispatch/object.h'):
|
||||
new_dispatch_dir = join_path(prefix, 'include', 'dispatch')
|
||||
mkdirp(new_dispatch_dir)
|
||||
cp = which('cp')
|
||||
new_header = join_path(new_dispatch_dir, 'object.h')
|
||||
cp(r'/usr/include/dispatch/object.h', new_header)
|
||||
filter_file(r'typedef void \(\^dispatch_block_t\)\(void\)',
|
||||
'typedef void* dispatch_block_t',
|
||||
new_header)
|
||||
|
||||
# Generic options to compile GCC
|
||||
options = ["--prefix=%s" % prefix, "--libdir=%s/lib64" % prefix,
|
||||
"--disable-multilib",
|
||||
|
Loading…
Reference in New Issue
Block a user