From b547e6a27311d8777db734659bacd9dd75e6bcc2 Mon Sep 17 00:00:00 2001 From: healther Date: Wed, 16 Aug 2017 20:14:54 +0200 Subject: Add package rtags (#5111) * Add package rtags * fixed license * transform to cmakepackage and add dependencies * add dependencies and patch for rtags * flake8 fix * clean up dependencies --- .../add_string_iterator_erase_compile_check.patch | 67 ++++++++++++++++++++++ var/spack/repos/builtin/packages/rtags/package.py | 49 ++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 var/spack/repos/builtin/packages/rtags/add_string_iterator_erase_compile_check.patch create mode 100644 var/spack/repos/builtin/packages/rtags/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/rtags/add_string_iterator_erase_compile_check.patch b/var/spack/repos/builtin/packages/rtags/add_string_iterator_erase_compile_check.patch new file mode 100644 index 0000000000..98ec67df5f --- /dev/null +++ b/var/spack/repos/builtin/packages/rtags/add_string_iterator_erase_compile_check.patch @@ -0,0 +1,67 @@ +From e0cb0bfba240669e27d77ea4ac17a90fde1a03fd Mon Sep 17 00:00:00 2001 +From: Anders Bakken +Date: Thu, 27 Jul 2017 20:55:19 -0700 +Subject: [PATCH] Add a compile test for proper c++11 support for std::string + and work around deficient stls. + +--- + rct.cmake | 10 ++++++++++ + rct/String.h | 10 ++++++++++ + rct/rct-config.h.in | 1 + + 3 files changed, 21 insertions(+) + +diff --git a/src/rct/rct.cmake b/src/rct/rct.cmake +index da102d2..30da945 100644 +--- a/src/rct/rct.cmake ++++ b/src/rct/rct.cmake +@@ -287,6 +287,16 @@ check_cxx_source_runs(" + return 0; + }" HAVE_UNORDERDED_MAP_WORKING_MOVE_CONSTRUCTOR) + ++check_cxx_source_runs(" ++ #include ++ ++ int main(int, char **) ++ { ++ std::string str = \"foobar testing\"; ++ std::string::iterator it = str.erase(str.begin(), str.end()); ++ return 0; ++ }" HAVE_STRING_ITERATOR_ERASE) ++ + unset(CMAKE_REQUIRED_FLAGS) + unset(CMAKE_REQUIRED_LIBRARIES) + +diff --git a/src/rct/rct/String.h b/src/rct/rct/String.h +index f8b9dbc..31b2012 100644 +--- a/src/rct/rct/String.h ++++ b/src/rct/rct/String.h +@@ -454,7 +454,17 @@ class String + + iterator erase(const_iterator begin, const_iterator end) + { ++#ifdef HAVE_STRING_ITERATOR_ERASE + return mString.erase(begin, end); ++#else ++ if (begin >= end) { ++ return mString.end(); ++ } ++ ++ const size_t offset = begin - mString.begin(); ++ mString.erase(offset, end - begin); ++ return mString.begin() + offset; ++#endif + } + + String& erase(size_t index = 0, size_t count = npos) +diff --git a/src/rct/rct/rct-config.h.in b/src/rct/rct/rct-config.h.in +index 9c67e2f..87c5b7c 100644 +--- a/src/rct/rct/rct-config.h.in ++++ b/src/rct/rct/rct-config.h.in +@@ -20,6 +20,7 @@ + #cmakedefine HAVE_SHMDEST + #cmakedefine HAVE_SCRIPTENGINE + #cmakedefine HAVE_UNORDERDED_MAP_WORKING_MOVE_CONSTRUCTOR ++#cmakedefine HAVE_HAVE_STRING_ITERATOR_ERASE + #if !defined(HAVE_EPOLL) && !defined(HAVE_KQUEUE) + #cmakedefine HAVE_SELECT + #endif diff --git a/var/spack/repos/builtin/packages/rtags/package.py b/var/spack/repos/builtin/packages/rtags/package.py new file mode 100644 index 0000000000..e212ea108c --- /dev/null +++ b/var/spack/repos/builtin/packages/rtags/package.py @@ -0,0 +1,49 @@ +############################################################################## +# Copyright (c) 2013-2016, 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/llnl/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 Rtags(CMakePackage): + """RTags is a client/server application that indexes C/C++ code""" + + homepage = "https://github.com/Andersbakken/rtags/" + url = "https://andersbakken.github.io/rtags-releases/rtags-2.12.tar.gz" + + version('2.12', '84988aaff27915a79d4b4b57299f9a51') + + depends_on("llvm@3.3: +clang") + depends_on("zlib") + depends_on("openssl") + depends_on("lua@5.3:") + depends_on("bash-completion") + depends_on("pkg-config", type='build') + + patch("add_string_iterator_erase_compile_check.patch", when='@2.12') + + def cmake_args(self): + args = ['-DCMAKE_EXPORT_COMPILE_COMMANDS=1', + '-DRTAGS_NO_ELISP_FILES=1', + ] + return args -- cgit v1.2.3-70-g09d2