oclint: new package (#7076)

This commit is contained in:
Geoffrey Oxberry 2018-02-05 21:35:17 -08:00 committed by Massimiliano Culpo
parent e25406c26b
commit 49e58992db
2 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,16 @@
--- oclint-scripts/bundle 2017-09-29 10:27:37.000000000 -0700
+++ oclint-scripts/bundle 2018-01-26 03:49:31.000000000 -0800
@@ -92,7 +92,7 @@
def install_cpp_headers():
if environment.is_darwin():
- install_dir = path.build.clang_install_dir
+ install_dir = (path.build.clang_install_dir if not args.llvm_root else args.llvm_root)
clang_cpp_headers_dir = os.path.join(install_dir, 'include', 'c++')
oclint_cpp_headers_dir = os.path.join(bundle_include_dir, 'c++')
path.mkdir_p(bundle_include_dir)
@@ -141,4 +141,3 @@
if args.archive:
archive(args.release)
-

View File

@ -0,0 +1,83 @@
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Oclint(Package):
"""OClint: a static analysis tool for C, C++, and Objective-C code
OCLint is a static code analysis tool for improving quality and
reducing defects by inspecting C, C++ and Objective-C code and
looking for potential problems"""
homepage = "http://oclint.org/"
url = "https://github.com/oclint/oclint/archive/v0.13.tar.gz"
version('0.13', '1d0e605eb7815ac15e6a2a82327d2dd8')
depends_on('python', type=('build'))
depends_on('py-argparse', type=('build'))
depends_on('git', type=('build'))
depends_on('subversion', type=('build'))
depends_on('cmake', type=('build'))
depends_on('ninja', type=('build'))
depends_on('llvm@5.0.0:')
# Needed to fix a bug in oclint-scripts/bundle script, which
# attempts to install c++ headers in the wrong location
# contributed upstream as
# https://github.com/oclint/oclint/pull/492
patch('bundle.patch', level=0)
def install(self, spec, prefix):
# Build from source via directions from
# http://docs.oclint.org/en/stable/intro/build.html,
cd('oclint-scripts')
# ...but instead of using oclint-scripts/make, execute the
# commands in oclint-scripts/makeWithSystemLLVM so that
# oclint links to spack-installed LLVM
build_script = Executable(join_path('.', 'build'))
bundle_script = Executable(join_path('.', 'bundle'))
# Add the '-no-analytics' argument to the build script because
# 1) it doesn't detect properly a spack install of OpenSSL,
# and throws an error due to missing OpenSSL headers
# 2) the bespoke build system is a pain to patch as it is
# 3) many sites don't allow software that communicates analytics data
build_script('-release',
'-clean',
'-llvm-root={0}'.format(spec['llvm'].prefix),
'-use-system-compiler',
'-no-analytics',
'all')
bundle_script('-release', '-llvm-root={0}'.format(spec['llvm'].prefix))
# Copy install tree into the correct locations using the
# directory layout described in
cd(join_path('..', 'build'))
install_tree(join_path('oclint-release', 'include'), prefix.include)
install_tree(join_path('oclint-release', 'lib'), prefix.lib)
install_tree(join_path('oclint-release', 'bin'), prefix.bin)