Add new package: sparse (#18264)

* Add new package: sparse

* flake8 fixes
This commit is contained in:
Weston Ortiz 2020-08-26 20:02:16 -06:00 committed by GitHub
parent 273a158f1b
commit 1a17921fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,44 @@
# Copyright 2013-2020 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 *
import glob
class Sparse(MakefilePackage):
"""An open source sparse linear equation solver."""
homepage = "http://sparse.sourceforge.net/"
url = "http://downloads.sourceforge.net/project/sparse/sparse/sparse1.4b/sparse1.4b.tar.gz"
maintainers = ['wortiz']
version('1.4b', sha256='63e6646244fd8f4d89f7f70fbf4cfd46b7688d21b22840a0ce57d294a7496d28')
variant('pic', default=True,
description='Build with position independent code')
def edit(self, spec, prefix):
with working_dir('./src'):
makefile = FileFilter('Makefile')
if '+pic' in self.spec:
makefile.filter('CFLAGS = .*',
'CFLAGS = -O2 {0}'.format(
self.compiler.cc_pic_flag))
else:
makefile.filter('CFLAGS = .*', 'CFLAGS = -O2')
makefile.filter('CC = .*', 'CC = {0}'.format(spack_cc))
makefile.filter('LIBRARY = .*', 'LIBRARY = ../lib/libsparse.a')
def build(self, spec, prefix):
with working_dir('./src'):
make()
def install(self, spec, prefix):
headers = glob.glob('src/*.h')
install_tree('lib', prefix.lib)
install_tree('bin', prefix.bin)
mkdir(prefix.include)
for h in headers:
install(h, prefix.include)