Fix compile bugs for gcc on Mac OS X with macports.

- add macports to things that are cleaned out of the environment.
- linker incompatibilities cause issues with packages like OpenSSL.
- also clean up NOQA stuff in OpenSSL
This commit is contained in:
Todd Gamblin 2016-07-04 22:59:02 -07:00
parent 690937f953
commit d687e332ad
2 changed files with 32 additions and 13 deletions

View file

@ -277,6 +277,15 @@ def set_build_environment_variables(pkg, env, dirty=False):
env.unset('LD_RUN_PATH') env.unset('LD_RUN_PATH')
env.unset('DYLD_LIBRARY_PATH') env.unset('DYLD_LIBRARY_PATH')
# Remove any macports installs from the PATH. The macports ld can
# cause conflicts with the built-in linker on el capitan. Solves
# assembler issues, e.g.:
# suffix or operands invalid for `movq'"
path = get_path('PATH')
for p in path:
if '/macports/' in p:
env.remove_path('PATH', p)
# Add bin directories from dependencies to the PATH for the build. # Add bin directories from dependencies to the PATH for the build.
bin_dirs = reversed( bin_dirs = reversed(
filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes])) filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes]))

View file

@ -63,7 +63,8 @@ def url_for_version(self, version):
# case return a fake url and exit # case return a fake url and exit
openssl_url = '@system (reserved version for system openssl)' openssl_url = '@system (reserved version for system openssl)'
if not warnings_given_to_user.get(version, False): if not warnings_given_to_user.get(version, False):
tty.msg('Using openssl@system : the version @system is reserved for system openssl') # NOQA: ignore=E501 tty.msg('Using openssl@system: '
'the version @system is reserved for system openssl')
warnings_given_to_user[version] = True warnings_given_to_user[version] = True
else: else:
openssl_url = self.check_for_outdated_release( openssl_url = self.check_for_outdated_release(
@ -87,37 +88,46 @@ def check_for_outdated_release(self, version, warnings_given_to_user):
openssl_url = latest.format(version=version) openssl_url = latest.format(version=version)
urllib.urlopen(openssl_url) urllib.urlopen(openssl_url)
except IOError: except IOError:
openssl_url = older.format(version_number=version_number, version_full=version) # NOQA:ignore=E501 openssl_url = older.format(
version_number=version_number, version_full=version)
# Checks if we already warned the user for this particular # Checks if we already warned the user for this particular
# version of OpenSSL. If not we display a warning message # version of OpenSSL. If not we display a warning message
# and mark this version # and mark this version
if not warnings_given_to_user.get(version, False): if not warnings_given_to_user.get(version, False):
tty.warn('This installation depends on an old version of OpenSSL, which may have known security issues. ') # NOQA: ignore=E501 tty.warn(
tty.warn('Consider updating to the latest version of this package.') # NOQA: ignore=E501 'This installation depends on an old version of OpenSSL, '
tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage)) # NOQA: ignore=E501 'which may have known security issues. ')
tty.warn(
'Consider updating to the latest version of this package.')
tty.warn('More details at {homepage}'.format(
homepage=Openssl.homepage))
warnings_given_to_user[version] = True warnings_given_to_user[version] = True
return openssl_url return openssl_url
def install(self, spec, prefix): def install(self, spec, prefix):
# OpenSSL uses a variable APPS in its Makefile. If it happens to be set # OpenSSL uses a variable APPS in its Makefile. If it happens to be set
# in the environment, then this will override what is set in the # in the environment, then this will override what is set in the
# Makefile, leading to build errors. # Makefile, leading to build errors.
env.pop('APPS', None) env.pop('APPS', None)
if spec.satisfies("target=x86_64") or spec.satisfies("target=ppc64"):
if spec.satisfies('target=x86_64') or spec.satisfies('target=ppc64'):
# This needs to be done for all 64-bit architectures (except Linux, # This needs to be done for all 64-bit architectures (except Linux,
# where it happens automatically?) # where it happens automatically?)
env['KERNEL_BITS'] = '64' env['KERNEL_BITS'] = '64'
config = Executable("./config")
config("--prefix=%s" % prefix, options = ['zlib', 'no-krb5', 'shared']
"--openssldir=%s" % join_path(prefix, 'etc', 'openssl'),
"zlib", config = Executable('./config')
"no-krb5", config('--prefix=%s' % prefix,
"shared") '--openssldir=%s' % join_path(prefix, 'etc', 'openssl'),
*options)
# Remove non-standard compiler options if present. These options are # Remove non-standard compiler options if present. These options are
# present e.g. on Darwin. They are non-standard, i.e. most compilers # present e.g. on Darwin. They are non-standard, i.e. most compilers
# (e.g. gcc) will not accept them. # (e.g. gcc) will not accept them.
filter_file(r'-arch x86_64', '', 'Makefile') filter_file(r'-arch x86_64', '', 'Makefile')
make() make()
make("install") make('install')