bowtie2: change to MakefilePackage and add simde dependency. (#20166)

This commit is contained in:
Toyohisa Kameyama 2020-11-30 22:19:47 +09:00 committed by GitHub
parent 8c8e9b71a7
commit 87adda1bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Bowtie2(Package): class Bowtie2(MakefilePackage):
"""Bowtie 2 is an ultrafast and memory-efficient tool for aligning """Bowtie 2 is an ultrafast and memory-efficient tool for aligning
sequencing reads to long reference sequences""" sequencing reads to long reference sequences"""
@ -25,49 +25,45 @@ class Bowtie2(Package):
depends_on('perl', type='run') depends_on('perl', type='run')
depends_on('python', type='run') depends_on('python', type='run')
depends_on('zlib', when='@2.3.1:') depends_on('zlib', when='@2.3.1:')
depends_on('simde', type='link')
patch('bowtie2-2.2.5.patch', when='@2.2.5', level=0) patch('bowtie2-2.2.5.patch', when='@2.2.5', level=0)
patch('bowtie2-2.3.1.patch', when='@2.3.1', level=0) patch('bowtie2-2.3.1.patch', when='@2.3.1', level=0)
patch('bowtie2-2.3.0.patch', when='@2.3.0', level=0) patch('bowtie2-2.3.0.patch', when='@2.3.0', level=0)
resource(name='simde', git="https://github.com/nemequ/simde",
destination='.', when='target=aarch64:')
# seems to have trouble with 6's -std=gnu++14 # seems to have trouble with 6's -std=gnu++14
conflicts('%gcc@6:', when='@:2.3.1') conflicts('%gcc@6:', when='@:2.3.1')
conflicts('@:2.3.5.0', when='target=aarch64:') conflicts('@:2.3.5.0', when='target=aarch64:')
conflicts('@2.4.1', when='target=aarch64:') conflicts('@2.4.1', when='target=aarch64:')
def patch(self): def edit(self, spec, prefix):
if self.spec.target.family == 'aarch64': kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
copy_tree('simde', 'third_party/simde')
if self.spec.satisfies('%gcc@:4.8.9'):
filter_file('-fopenmp-simd', '', 'Makefile')
@run_before('install') match = '^#!/usr/bin/env perl'
def filter_sbang(self): perl = spec['perl'].command
"""Run before install so that the standard Spack sbang install hook substitute = "#!{perl}".format(perl=perl)
can fix up the path to the perl|python binary. files = ['bowtie2', ]
""" filter_file(match, substitute, *files, **kwargs)
with working_dir(self.stage.source_path): match = '^#!/usr/bin/env python'
kwargs = {'ignore_absent': True, 'backup': False, 'string': False} python = spec['python'].command
substitute = "#!{python}".format(python=python)
files = ['bowtie2-build', 'bowtie2-inspect']
filter_file(match, substitute, *files, **kwargs)
match = '^#!/usr/bin/env perl' match = '-Ithird_party/simde'
perl = self.spec['perl'].command simdepath = spec['simde'].prefix.include
substitute = "#!{perl}".format(perl=perl) substitute = "-I{simdepath}".format(simdepath=simdepath)
files = ['bowtie2', ] files = ['Makefile']
filter_file(match, substitute, *files, **kwargs) filter_file(match, substitute, *files, **kwargs)
match = '^#!/usr/bin/env python' @property
python = self.spec['python'].command def build_targets(self):
substitute = "#!{python}".format(python=python) make_arg = ['PREFIX={0}'.format(self.prefix)]
files = ['bowtie2-build', 'bowtie2-inspect'] if self.spec.satisfies('target=aarch64:'):
filter_file(match, substitute, *files, **kwargs)
def install(self, spec, prefix):
make_arg = []
if self.spec.target.family == 'aarch64':
make_arg.append('POPCNT_CAPABILITY=0') make_arg.append('POPCNT_CAPABILITY=0')
make(*make_arg) return make_arg
mkdirp(prefix.bin)
install('bowtie2*', prefix.bin) @property
def install_targets(self):
return ['PREFIX={0}'.format(self.prefix), 'install']