Allow py-meep to link properly

This commit is contained in:
Adam J. Stewart 2016-07-08 14:36:54 -05:00
parent 880cbb2217
commit 8d0758fc4c
4 changed files with 41 additions and 6 deletions

View file

@ -61,6 +61,11 @@ def url_for_version(self, version):
return "{0}/old/meep-{1}.tar.gz".format(base_url, version)
def install(self, spec, prefix):
# Must be compiled with -fPIC for py-meep
env['CFLAGS'] = '-fPIC'
env['CXXFLAGS'] = '-fPIC'
env['FFLAGS'] = '-fPIC'
config_args = ['--prefix={0}'.format(prefix)]
if '+blas' in spec:

View file

@ -37,18 +37,34 @@ class PyMeep(Package):
variant('mpi', default=True, description='Enable MPI support')
extends('python')
depends_on('mpi', when='+mpi') # OpenMPI 1.3.3 is recommended
depends_on('meep@1.1.1') # must be compiled with -fPIC
depends_on('meep+mpi', when='+mpi')
depends_on('swig@1.3.39:')
depends_on('py-numpy')
depends_on('py-scipy')
depends_on('py-matplotlib')
depends_on('mpi', when='+mpi') # OpenMPI 1.3.3 is recommended
depends_on('meep') # must be compiled with -fPIC
depends_on('meep+mpi', when='+mpi')
# As of SWIG 3.0.3, Python-style comments are now treated as
# pre-processor directives. Use older SWIG. But not too old,
# or else it can't handle newer C++ compilers and flags.
depends_on('swig@1.3.39:3.0.2')
def install(self, spec, prefix):
setup = 'setup-mpi.py' if '+mpi' in spec else 'setup.py'
include_dirs = [
spec['meep'].prefix.include,
spec['py-numpy'].include
]
library_dirs = [
spec['meep'].prefix.lib
]
python(setup, 'clean', '--all')
python(setup, 'build_ext')
python(setup, 'build_ext',
'-I{0}'.format(','.join(include_dirs)),
'-L{0}'.format(','.join(library_dirs)))
python(setup, 'install', '--prefix={0}'.format(prefix))
python(setup, 'bdist')

View file

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import platform
class PyNumpy(Package):
@ -48,6 +49,18 @@ class PyNumpy(Package):
depends_on('blas', when='+blas')
depends_on('lapack', when='+lapack')
def setup_dependent_package(self, module, dep_spec):
python_version = self.spec['python'].version.up_to(2)
arch = '{0}-{1}'.format(platform.system().lower(), platform.machine())
self.spec.include = join_path(
self.prefix.lib,
'python{0}'.format(python_version),
'site-packages',
'numpy-{0}-py{1}-{2}.egg'.format(
self.spec.version, python_version, arch),
'numpy/core/include')
def install(self, spec, prefix):
libraries = []
library_dirs = []

View file

@ -22,9 +22,9 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Swig(Package):
"""SWIG is an interface compiler that connects programs written in
C and C++ with scripting languages such as Perl, Python, Ruby,
@ -38,6 +38,7 @@ class Swig(Package):
homepage = "http://www.swig.org"
url = "http://prdownloads.sourceforge.net/swig/swig-3.0.8.tar.gz"
version('3.0.10', 'bb4ab8047159469add7d00910e203124')
version('3.0.8', 'c96a1d5ecb13d38604d7e92148c73c97')
version('3.0.2', '62f9b0d010cef36a13a010dc530d0d41')
version('2.0.12', 'c3fb0b2d710cc82ed0154b91e43085a4')