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)
class Bowtie2(Package):
class Bowtie2(MakefilePackage):
"""Bowtie 2 is an ultrafast and memory-efficient tool for aligning
sequencing reads to long reference sequences"""
@ -25,49 +25,45 @@ class Bowtie2(Package):
depends_on('perl', type='run')
depends_on('python', type='run')
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.3.1.patch', when='@2.3.1', 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
conflicts('%gcc@6:', when='@:2.3.1')
conflicts('@:2.3.5.0', when='target=aarch64:')
conflicts('@2.4.1', when='target=aarch64:')
def patch(self):
if self.spec.target.family == 'aarch64':
copy_tree('simde', 'third_party/simde')
if self.spec.satisfies('%gcc@:4.8.9'):
filter_file('-fopenmp-simd', '', 'Makefile')
def edit(self, spec, prefix):
kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
@run_before('install')
def filter_sbang(self):
"""Run before install so that the standard Spack sbang install hook
can fix up the path to the perl|python binary.
"""
match = '^#!/usr/bin/env perl'
perl = spec['perl'].command
substitute = "#!{perl}".format(perl=perl)
files = ['bowtie2', ]
filter_file(match, substitute, *files, **kwargs)
with working_dir(self.stage.source_path):
kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
match = '^#!/usr/bin/env python'
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'
perl = self.spec['perl'].command
substitute = "#!{perl}".format(perl=perl)
files = ['bowtie2', ]
filter_file(match, substitute, *files, **kwargs)
match = '-Ithird_party/simde'
simdepath = spec['simde'].prefix.include
substitute = "-I{simdepath}".format(simdepath=simdepath)
files = ['Makefile']
filter_file(match, substitute, *files, **kwargs)
match = '^#!/usr/bin/env python'
python = self.spec['python'].command
substitute = "#!{python}".format(python=python)
files = ['bowtie2-build', 'bowtie2-inspect']
filter_file(match, substitute, *files, **kwargs)
def install(self, spec, prefix):
make_arg = []
if self.spec.target.family == 'aarch64':
@property
def build_targets(self):
make_arg = ['PREFIX={0}'.format(self.prefix)]
if self.spec.satisfies('target=aarch64:'):
make_arg.append('POPCNT_CAPABILITY=0')
make(*make_arg)
mkdirp(prefix.bin)
install('bowtie2*', prefix.bin)
return make_arg
@property
def install_targets(self):
return ['PREFIX={0}'.format(self.prefix), 'install']