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

60 lines
2.1 KiB
Python
Raw Normal View History

# 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
2016-06-01 09:25:37 +08:00
class Tetgen(Package):
2016-06-01 09:25:37 +08:00
"""TetGen is a program and library that can be used to generate
tetrahedral meshes for given 3D polyhedral domains. TetGen
generates exact constrained Delaunay tetrahedralizations,
boundary conforming Delaunay meshes, and Voronoi paritions.
"""
Overhaul Spack's URL parsing (#2972) * Remove fake URLs from Spack * Ignore long lines for URLs that start with ftp: * Preliminary changes to version regexes * New redesign of version regexes * Allow letters in version-only * Fix detection of versions that end in Final * Rearrange a few regexes and add examples * Add tests for common download repositories * Add test cases for common tarball naming schemes * Finalize version regexes * spack url test -> spack url summary * Clean up comments * Rearrange suffix checks * Use query strings for name detection * Remove no longer necessary url_for_version functions * Strip off extraneous information after package name * Add one more test * Dot in square brackets does not need to be escaped * Move renaming outside of parse_name_offset * Fix versions for a couple more packages * Fix flake8 and doc tests * Correctly parse Python, Lua, and Bio++ package names * Use effective URLs for mfem * Add checksummed version to mitos * Remove url_for_version from STAR-CCM+ package * Revert changes to version numbers with underscores and dashes * Fix name detection for tbb * Correctly parse Ruby gems * Reverted mfem back to shortened URLs. * Updated instructions for better security * Remove preferred=True from newest version * Add tests for new `spack url list` flags * Add tests for strip_name_suffixes * Add unit tests for version separators * Fix bugs related to parseable name but in parseable version * Remove dead code, update docstring * Ignore 'binary' at end of version string * Remove platform from version * Flip libedit version numbers * Re-support weird NCO alpha/beta versions * Rebase and remove one new fake URL * Add / to beginning of regex to avoid picking up similarly named packages * Ignore weird tar versions * Fix bug in url parse --spider when no versions found * Less strict version matching for spack versions * Don't rename Python packages * Be a little more selective, version must begin with a digit * Re-add fake URLs * Fix up several other packages * Ignore more file endings * Add parsing support for Miniconda * Update tab completion * XFAILS are now PASSES for 2 web tests
2017-04-04 06:34:16 +08:00
homepage = "http://wias-berlin.de/software/tetgen/"
version('1.5.0', sha256='4d114861d5ef2063afd06ef38885ec46822e90e7b4ea38c864f76493451f9cf3', url='http://www.tetgen.org/1.5/src/tetgen1.5.0.tar.gz')
version('1.4.3', sha256='952711bb06b7f64fd855eb24c33f08e3faf40bdd54764de10bbe5ed5b0dce034', url='http://www.tetgen.org/files/tetgen1.4.3.tar.gz')
variant('debug', default=False, description='Builds the library in debug mode.')
variant('except', default=False, description='Replaces asserts with exceptions for better C++ compatibility.')
patch('tetgen-1.5.0-free.patch', when='@1.5.0')
def patch(self):
cflags = '-g -O0' if '+debug' in self.spec else '-g0 -O3'
mff = FileFilter('makefile')
mff.filter(r'^(C(XX)?FLAGS\s*=)(.*)$', r'\1 {0}'.format(cflags))
if '+except' in self.spec:
hff = FileFilter('tetgen.h')
hff.filter(r'(\b)(throw)(\b)(.*);', r'\1assert_throw(false);')
hff.filter(r'^(#define\s*tetgenH\s*)$', r'\1{0}'.format("""\n
#include <stdexcept>
inline void assert_throw(bool assertion)
{
if(!assertion)
throw std::runtime_error("Tetgen encountered a problem (assert failed)!");
}\n"""))
sff = FileFilter(*(glob.glob('*.cxx')))
sff.filter(r'(\b)(assert)(\b)', r'\1assert_throw\3')
def install(self, spec, prefix):
make('tetgen', 'tetlib')
mkdirp(prefix.bin)
install('tetgen', prefix.bin)
mkdirp(prefix.include)
install('tetgen.h', prefix.include)
mkdirp(prefix.lib)
install('libtet.a', prefix.lib)