summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorSergey Kosukhin <skosukhin@gmail.com>2018-09-15 02:07:13 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2018-09-14 17:07:13 -0700
commita9c434d7d73c83710410141fce4afe2e6df7efa2 (patch)
tree4a4a2e8c96fb8e7269233496f1b0622615cfc288 /var
parent0b800720b1be604400f7f8580e648e496bef2587 (diff)
downloadspack-a9c434d7d73c83710410141fce4afe2e6df7efa2.tar.gz
spack-a9c434d7d73c83710410141fce4afe2e6df7efa2.tar.bz2
spack-a9c434d7d73c83710410141fce4afe2e6df7efa2.tar.xz
spack-a9c434d7d73c83710410141fce4afe2e6df7efa2.zip
Build Python 3.7 with external libffi. (#9245)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/libffi/package.py5
-rw-r--r--var/spack/repos/builtin/packages/openssl/package.py4
-rw-r--r--var/spack/repos/builtin/packages/python/package.py38
-rw-r--r--var/spack/repos/builtin/packages/sqlite/package.py4
4 files changed, 45 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/libffi/package.py b/var/spack/repos/builtin/packages/libffi/package.py
index a0c4109269..5ff694dd74 100644
--- a/var/spack/repos/builtin/packages/libffi/package.py
+++ b/var/spack/repos/builtin/packages/libffi/package.py
@@ -37,3 +37,8 @@ class Libffi(AutotoolsPackage):
# version('3.1', 'f5898b29bbfd70502831a212d9249d10',url =
# "ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz") # Has a bug
# $(lib64) instead of ${lib64} in libffi.pc
+
+ @property
+ def headers(self):
+ # The headers are probably in self.prefix.lib but we search everywhere
+ return find_headers('ffi', self.prefix, recursive=True)
diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py
index 63fbfed533..cd8f06b9d0 100644
--- a/var/spack/repos/builtin/packages/openssl/package.py
+++ b/var/spack/repos/builtin/packages/openssl/package.py
@@ -72,6 +72,10 @@ class Openssl(Package):
parallel = False
+ @property
+ def libs(self):
+ return find_libraries(['libssl', 'libcrypto'], root=self.prefix.lib)
+
def handle_fetch_error(self, error):
tty.warn("Fetching OpenSSL failed. This may indicate that OpenSSL has "
"been updated, and the version in your instance of Spack is "
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 7a28566386..bf7a39303f 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -101,6 +101,7 @@ class Python(AutotoolsPackage):
description="Symlink 'python3' executable to 'python' "
"(not PEP 394 compliant)")
+ depends_on("pkgconfig", type="build")
depends_on("openssl")
depends_on("bzip2")
depends_on("readline")
@@ -111,6 +112,10 @@ class Python(AutotoolsPackage):
depends_on("tcl", when="+tk")
depends_on("gdbm", when='+dbm')
+ # https://docs.python.org/3/whatsnew/3.7.html#build-changes
+ depends_on("libffi", when="@3.7:")
+ depends_on("openssl@1.0.2:", when="@3.7:")
+
# Patch does not work for Python 3.1
patch('ncurses.patch', when='@:2.8,3.2:')
@@ -168,12 +173,33 @@ class Python(AutotoolsPackage):
# setup.py needs to be able to read the CPPFLAGS and LDFLAGS
# as it scans for the library and headers to build
- dep_pfxs = [dspec.prefix for dspec in spec.dependencies('link')]
- config_args = [
- '--with-threads',
- 'CPPFLAGS=-I{0}'.format(' -I'.join(dp.include for dp in dep_pfxs)),
- 'LDFLAGS=-L{0}'.format(' -L'.join(dp.lib for dp in dep_pfxs)),
- ]
+ link_deps = spec.dependencies('link')
+
+ # Header files are often included assuming they reside in a
+ # subdirectory of prefix.include, e.g. #include <openssl/ssl.h>,
+ # which is why we don't use HeaderList here. The header files of
+ # libffi reside in prefix.lib but the configure script of Python
+ # finds them using pkg-config.
+ cppflags = '-I' + ' -I'.join(dep.prefix.include
+ for dep in link_deps
+ if dep.name != 'libffi')
+
+ # Currently, the only way to get SpecBuildInterface wrappers of the
+ # dependencies (which we need to get their 'libs') is to get them
+ # using spec.__getitem__.
+ ldflags = ' '.join(spec[dep.name].libs.search_flags
+ for dep in link_deps)
+
+ config_args = ['CPPFLAGS=' + cppflags, 'LDFLAGS=' + ldflags]
+
+ # https://docs.python.org/3/whatsnew/3.7.html#build-changes
+ if spec.satisfies('@:3.6'):
+ config_args.append('--with-threads')
+
+ if '^libffi' in spec:
+ config_args.append('--with-system-ffi')
+ else:
+ config_args.append('--without-system-ffi')
if spec.satisfies('@2.7.13:2.8,3.5.3:', strict=True) \
and '+optimizations' in spec:
diff --git a/var/spack/repos/builtin/packages/sqlite/package.py b/var/spack/repos/builtin/packages/sqlite/package.py
index fea27c8661..b7010965dc 100644
--- a/var/spack/repos/builtin/packages/sqlite/package.py
+++ b/var/spack/repos/builtin/packages/sqlite/package.py
@@ -76,6 +76,10 @@ class Sqlite(AutotoolsPackage):
'extension-functions.c'},
when='+functions')
+ @property
+ def libs(self):
+ return find_libraries('libsqlite3', root=self.prefix.lib)
+
def get_arch(self):
arch = architecture.Arch()
arch.platform = architecture.platform()