Skip to content

Commit 8d0758f

Browse files
committed
Allow py-meep to link properly
1 parent 880cbb2 commit 8d0758f

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

var/spack/repos/builtin/packages/meep/package.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ def url_for_version(self, version):
6161
return "{0}/old/meep-{1}.tar.gz".format(base_url, version)
6262

6363
def install(self, spec, prefix):
64+
# Must be compiled with -fPIC for py-meep
65+
env['CFLAGS'] = '-fPIC'
66+
env['CXXFLAGS'] = '-fPIC'
67+
env['FFLAGS'] = '-fPIC'
68+
6469
config_args = ['--prefix={0}'.format(prefix)]
6570

6671
if '+blas' in spec:

var/spack/repos/builtin/packages/py-meep/package.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,34 @@ class PyMeep(Package):
3737
variant('mpi', default=True, description='Enable MPI support')
3838

3939
extends('python')
40-
depends_on('mpi', when='+mpi') # OpenMPI 1.3.3 is recommended
41-
depends_on('[email protected]') # must be compiled with -fPIC
42-
depends_on('meep+mpi', when='+mpi')
43-
depends_on('[email protected]:')
4440
depends_on('py-numpy')
4541
depends_on('py-scipy')
4642
depends_on('py-matplotlib')
4743

44+
depends_on('mpi', when='+mpi') # OpenMPI 1.3.3 is recommended
45+
depends_on('meep') # must be compiled with -fPIC
46+
depends_on('meep+mpi', when='+mpi')
47+
48+
# As of SWIG 3.0.3, Python-style comments are now treated as
49+
# pre-processor directives. Use older SWIG. But not too old,
50+
# or else it can't handle newer C++ compilers and flags.
51+
depends_on('[email protected]:3.0.2')
52+
4853
def install(self, spec, prefix):
4954
setup = 'setup-mpi.py' if '+mpi' in spec else 'setup.py'
5055

56+
include_dirs = [
57+
spec['meep'].prefix.include,
58+
spec['py-numpy'].include
59+
]
60+
61+
library_dirs = [
62+
spec['meep'].prefix.lib
63+
]
64+
5165
python(setup, 'clean', '--all')
52-
python(setup, 'build_ext')
66+
python(setup, 'build_ext',
67+
'-I{0}'.format(','.join(include_dirs)),
68+
'-L{0}'.format(','.join(library_dirs)))
5369
python(setup, 'install', '--prefix={0}'.format(prefix))
5470
python(setup, 'bdist')

var/spack/repos/builtin/packages/py-numpy/package.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2424
##############################################################################
2525
from spack import *
26+
import platform
2627

2728

2829
class PyNumpy(Package):
@@ -48,6 +49,18 @@ class PyNumpy(Package):
4849
depends_on('blas', when='+blas')
4950
depends_on('lapack', when='+lapack')
5051

52+
def setup_dependent_package(self, module, dep_spec):
53+
python_version = self.spec['python'].version.up_to(2)
54+
arch = '{0}-{1}'.format(platform.system().lower(), platform.machine())
55+
56+
self.spec.include = join_path(
57+
self.prefix.lib,
58+
'python{0}'.format(python_version),
59+
'site-packages',
60+
'numpy-{0}-py{1}-{2}.egg'.format(
61+
self.spec.version, python_version, arch),
62+
'numpy/core/include')
63+
5164
def install(self, spec, prefix):
5265
libraries = []
5366
library_dirs = []

var/spack/repos/builtin/packages/swig/package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
# License along with this program; if not, write to the Free Software
2323
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2424
##############################################################################
25-
2625
from spack import *
2726

27+
2828
class Swig(Package):
2929
"""SWIG is an interface compiler that connects programs written in
3030
C and C++ with scripting languages such as Perl, Python, Ruby,
@@ -38,6 +38,7 @@ class Swig(Package):
3838
homepage = "http://www.swig.org"
3939
url = "http://prdownloads.sourceforge.net/swig/swig-3.0.8.tar.gz"
4040

41+
version('3.0.10', 'bb4ab8047159469add7d00910e203124')
4142
version('3.0.8', 'c96a1d5ecb13d38604d7e92148c73c97')
4243
version('3.0.2', '62f9b0d010cef36a13a010dc530d0d41')
4344
version('2.0.12', 'c3fb0b2d710cc82ed0154b91e43085a4')

0 commit comments

Comments
 (0)