1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Migrate(AutotoolsPackage):
"""Migrate estimates effective population sizes and past migration rates
between n population assuming a migration matrix model with asymmetric
migration rates and different subpopulation sizes"""
homepage = "https://popgen.sc.fsu.edu/"
url = "https://popgen.sc.fsu.edu/currentversions/migrate-3.6.11.src.tar.gz"
version('3.6.11', sha256='a9ba06a4e995a45b8d04037f5f2da23e1fe64a2f3565189bdd50c62c6fe01fb8')
variant('mpi', default=False,
description='Build MPI binaries')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
depends_on('zlib', type='link')
depends_on('openmpi', type=('build', 'link', 'run'), when='+mpi')
configure_directory = 'src'
def configure_args(self):
return ['--with-zlib=system']
def build(self, spec, prefix):
with working_dir('src'):
# this software is written with parts both in C and C++.
# it tries to link using gcc which causes problems, so this package
# explicitly links with g++ (CXX) instead.
# spack's FileFilter/filter_file only work per-line (see docs),
# so the package uses a custom filter by replacing substrings
# in the Makefile.
mfc = ''
with open('Makefile') as m:
mfc = mfc_old = m.read()
# replace linking step
mfc = mfc.replace('$(NAME): $(PRODUCT_DEPENDS)\n\t$(CC)',
'$(NAME): $(PRODUCT_DEPENDS)\n\t$(CXX)')
mfc = mfc.replace('$(MPINAME): $(PRODUCT_DEPENDS)\n\t$(CC)',
'$(MPINAME): $(PRODUCT_DEPENDS)\n\t$(CXX)')
# make sure the replace worked
if (mfc == mfc_old):
raise InstallError('Failed to update linker command')
# don't try to install MPI binaries that aren't there
if '+mpi' not in spec:
line = '$(INSTALL) $(IFLAGS) $(MPINAME) $(INSTALLDIR)'
mfc = mfc.replace(line, '')
# write modified makefile back
with open('Makefile', 'w') as m:
m.write(mfc)
make()
if '+mpi' in spec:
make('mpis')
def install(self, spec, prefix):
mkdirp(prefix.man)
with working_dir('src'):
make('install')
|