pkgsrc/devel/vera++/patches/patch-ac
jmmv 574938521c Initial import of vera++, version 1.1.1.
The build system of this package is completely fubar'd (mostly because this
has been designed to be built against the Boost source files and to never
be installed).  I have made an attempt to make the build system and the
runtime finding of configuration systems slightly more sane, but can't
promise it will work everywhere yet.  So far only tested in OS X 10.6.

Description:

Vera++ is a programmable tool for verification, analysis and
transformation of C++ source code.

Vera++ is a tool designed for programmers -- not only in the sense that
it helps with everyday development work, but also in the sense that all
its rules are implemented as scripts that can be modified or added by
the user.  Thanks to this, programmers have complete freedom and control
over what the tool does and how it works.

Vera++ is mainly an engine that parses C++ source files and presents the
result of this parsing to scripts in the form of various collections --
the scripts are actually performing the requested tasks.
2011-10-13 18:43:51 +00:00

43 lines
1.6 KiB
Text

$NetBSD: patch-ac,v 1.1.1.1 2011/10/13 18:43:51 jmmv Exp $
Vera++ comes with a set of profiles to validate the syntax of files.
However, the whole system is not designed to be installed. Change the
rules for the location of the profiles to something more natural: first
attempt user overrides and, if these fail, fallback to the system
installed files.
--- src/main.cpp.orig 2008-08-25 13:41:57.000000000 +0000
+++ src/main.cpp
@@ -5,6 +5,10 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
+extern "C" {
+#include <unistd.h>
+}
+
#include "structures/SourceFiles.h"
#include "plugins/Profiles.h"
#include "plugins/Rules.h"
@@ -65,15 +69,16 @@ int main(int argc, char * argv[])
// the directory containing the profile and rule definitions
// by default it is (in this order, first has highest precedence):
// - VERA_ROOT (if VERA_ROOT is defined)
- // - HOME/.vera (if HOME is defined)
- // - current directory
+ // - HOME/.vera (if HOME is defined and the directory exists)
+ // - the installed files for Vera in prefix/share/vera++
- RootDirectory::DirectoryName veraRoot(".");
+ RootDirectory::DirectoryName veraRoot(VERA_ROOT);
char * veraRootEnv = getenv("HOME");
if (veraRootEnv != NULL)
{
- veraRoot = veraRootEnv;
- veraRoot += "/.vera++";
+ const string homeRoot = string(veraRootEnv) + "/.vera++";
+ if (::access(homeRoot.c_str(), X_OK) != -1)
+ veraRoot = homeRoot;
}
veraRootEnv = getenv("VERA_ROOT");
if (veraRootEnv != NULL)