2019-01-01 14:04:23 +08:00
|
|
|
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2016-05-12 12:22:25 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2016-05-07 05:13:09 +08:00
|
|
|
from spack import *
|
|
|
|
|
2016-08-10 16:50:00 +08:00
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
class Antlr(AutotoolsPackage):
|
2016-08-24 23:32:29 +08:00
|
|
|
"""ANTLR (ANother Tool for Language Recognition) is a powerful parser
|
|
|
|
generator for reading, processing, executing, or translating structured
|
|
|
|
text or binary files. It's widely used to build languages, tools, and
|
|
|
|
frameworks. From a grammar, ANTLR generates a parser that can build and
|
|
|
|
walk parse trees."""
|
2016-08-10 16:50:00 +08:00
|
|
|
|
2017-07-02 21:05:09 +08:00
|
|
|
homepage = "http://www.antlr2.org/"
|
|
|
|
url = "http://www.antlr2.org/download/antlr-2.7.7.tar.gz"
|
2016-05-07 05:13:09 +08:00
|
|
|
|
2019-10-11 13:44:41 +08:00
|
|
|
version('2.7.7', sha256='853aeb021aef7586bda29e74a6b03006bcb565a755c86b66032d8ec31b67dbb9')
|
2017-07-02 21:05:09 +08:00
|
|
|
|
|
|
|
# Fixes build with recent versions of GCC
|
|
|
|
patch('gcc.patch')
|
2016-05-07 05:13:09 +08:00
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
variant('cxx', default=True, description='Enable ANTLR for C++')
|
|
|
|
variant('java', default=False, description='Enable ANTLR for Java')
|
2016-05-07 05:13:09 +08:00
|
|
|
variant('python', default=False, description='Enable ANTLR for Python')
|
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
extends('python', when='+python')
|
2017-08-06 03:53:09 +08:00
|
|
|
depends_on('java', type=('build', 'run'), when='+java')
|
2016-05-07 05:13:09 +08:00
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
def configure_args(self):
|
|
|
|
spec = self.spec
|
2016-05-07 05:13:09 +08:00
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
return [
|
2018-05-19 01:39:30 +08:00
|
|
|
'--disable-csharp',
|
2017-01-08 10:07:00 +08:00
|
|
|
'--{0}-cxx'.format('enable' if '+cxx' in spec else 'disable'),
|
|
|
|
'--{0}-java'.format('enable' if '+java' in spec else 'disable'),
|
|
|
|
'--{0}-python'.format('enable' if '+python' in spec else 'disable')
|
|
|
|
]
|