mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'master' of https://github.com/triAGENS/AvocadoDB
This commit is contained in:
commit
376d0882bf
12
Makefile.am
12
Makefile.am
|
@ -91,6 +91,18 @@ if ENABLE_BISON
|
|||
include Makefile.bison
|
||||
endif
|
||||
|
||||
if ENABLE_ERRORS_DEPENDENCY
|
||||
.PHONY: errorfiles
|
||||
|
||||
errorfiles: BasicsC/errors.dat
|
||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat BasicsC/voc-errors.h
|
||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat BasicsC/voc-errors.c
|
||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat js/common/bootstrap/errors.js
|
||||
|
||||
BUILT_SOURCES += \
|
||||
errorfiles
|
||||
endif
|
||||
|
||||
if ENABLE_ALL_IN_ONE
|
||||
include Makefile.all-in-one-libev
|
||||
include Makefile.all-in-one-v8
|
||||
|
|
16
Makefile.in
16
Makefile.in
|
@ -109,8 +109,11 @@ DIST_COMMON = $(am__configure_deps) \
|
|||
################################################################################
|
||||
################################################################################
|
||||
@ENABLE_BISON_TRUE@am__append_4 = $(BISON_FILES) $(BISONXX_FILES)
|
||||
@ENABLE_ALL_IN_ONE_TRUE@am__append_5 = @LIBEV_LIBS@ @V8_LIBS@
|
||||
@ENABLE_MRUBY_TRUE@am__append_6 = @MRUBY_LIBS@
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@am__append_5 = \
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@ errorfiles
|
||||
|
||||
@ENABLE_ALL_IN_ONE_TRUE@am__append_6 = @LIBEV_LIBS@ @V8_LIBS@
|
||||
@ENABLE_MRUBY_TRUE@am__append_7 = @MRUBY_LIBS@
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
|
||||
|
@ -584,7 +587,7 @@ AM_LDFLAGS = \
|
|||
BUILT_SOURCES = build.h $(JAVASCRIPT_HEADER) $(FLEX_FILES) \
|
||||
$(FLEXXX_FILES) $(BISON_FILES) $(BISONXX_FILES) \
|
||||
Doxygen/.setup-directories .setup-directories $(am__append_5) \
|
||||
$(am__append_6)
|
||||
$(am__append_6) $(am__append_7)
|
||||
|
||||
################################################################################
|
||||
################################################################################
|
||||
|
@ -3084,6 +3087,13 @@ unittests-http-server:
|
|||
@ENABLE_BISON_TRUE@JsonParserX/%.cpp: @srcdir@/JsonParserX/%.yy
|
||||
@ENABLE_BISON_TRUE@ @top_srcdir@/config/bison-c++.sh $(BISON) $@ $<
|
||||
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@.PHONY: errorfiles
|
||||
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@errorfiles: BasicsC/errors.dat
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@ @top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat BasicsC/voc-errors.h
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@ @top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat BasicsC/voc-errors.c
|
||||
@ENABLE_ERRORS_DEPENDENCY_TRUE@ @top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py BasicsC/errors.dat js/common/bootstrap/errors.js
|
||||
|
||||
@ENABLE_ALL_IN_ONE_TRUE@@LIBEV_LIBS@: .libev-build
|
||||
|
||||
@ENABLE_ALL_IN_ONE_TRUE@.libev-build:
|
||||
|
|
|
@ -0,0 +1,199 @@
|
|||
import csv, sys, os.path, re
|
||||
|
||||
# wrap text after x characters
|
||||
def wrap(string, width=80, ind1=0, ind2=0, prefix=''):
|
||||
string = prefix + ind1 * " " + string
|
||||
newstring = ""
|
||||
string = string.replace("\n", " ")
|
||||
|
||||
while len(string) > width:
|
||||
marker = width - 1
|
||||
while not string[marker].isspace():
|
||||
marker = marker - 1
|
||||
|
||||
newline = string[0:marker] + "\n"
|
||||
newstring = newstring + newline
|
||||
string = prefix + ind2 * " " + string[marker + 1:]
|
||||
|
||||
return newstring + string
|
||||
|
||||
|
||||
# generate javascript file from errors
|
||||
def genJsFile(errors):
|
||||
out = prologue\
|
||||
+ "var internal = require(\"internal\");\n"\
|
||||
+ "\n"\
|
||||
+ "ModuleCache[\"/internal\"].exports.errors = {\n"
|
||||
|
||||
# print individual errors
|
||||
for e in errors:
|
||||
name = "\"" + e[0] + "\""
|
||||
msg = e[2].replace("\n", " ").replace("\\", "").replace("\"", "\\\"")
|
||||
out = out\
|
||||
+ " " + name.ljust(30) + " : { \"code\" : " + e[1] + ", \"message\" : \"" + msg + "\" }, \n"
|
||||
|
||||
out = out\
|
||||
+ "};\n"\
|
||||
+ "\n"
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# generate C implementation file from errors
|
||||
def genCFile(errors, filename):
|
||||
|
||||
headerfile = os.path.splitext(filename)[0] + ".h"
|
||||
|
||||
impl = prologue\
|
||||
+ "#include <BasicsC/common.h>\n"\
|
||||
+ "#include \"" + headerfile + "\"\n"\
|
||||
+ "\n"\
|
||||
+ docstart\
|
||||
+ "void TRI_InitialiseErrorMessages (void) {\n"
|
||||
|
||||
# print individual errors
|
||||
for e in errors:
|
||||
msg = e[2].replace("\n", " ").replace("\\", "").replace("\"", "\\\"")
|
||||
impl = impl\
|
||||
+ " REG_ERROR(" + e[0] + ", \"" + msg + "\");\n"
|
||||
|
||||
impl = impl\
|
||||
+ "}\n"\
|
||||
+ docend
|
||||
|
||||
return impl
|
||||
|
||||
|
||||
# generate C header file from errors
|
||||
def genCHeaderFile(errors):
|
||||
wiki = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @page AvocadoErrors Error codes and meanings\n"\
|
||||
+ "///\n"\
|
||||
+ "/// The following errors might be raised when running AvocadoDB:\n"\
|
||||
+ "///\n"
|
||||
|
||||
for e in errors:
|
||||
wiki = wiki\
|
||||
+ "/// - " + e[1] + ": @CODE{" + e[2].replace("%", "\%").replace("<", "\<").replace(">", "\>") + "}\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"
|
||||
|
||||
wiki = wiki\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
||||
header = "\n"\
|
||||
+ "#ifndef TRIAGENS_DURHAM_VOC_BASE_ERRORS_H\n"\
|
||||
+ "#define TRIAGENS_DURHAM_VOC_BASE_ERRORS_H 1\n"\
|
||||
+ "\n"\
|
||||
+ "#ifdef __cplusplus\n"\
|
||||
+ "extern \"C\" {\n"\
|
||||
+ "#endif\n"\
|
||||
+ "\n"\
|
||||
+ wiki\
|
||||
+ "\n"\
|
||||
+ docstart\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief helper macro to define an error string\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define REG_ERROR(id, label) TRI_set_errno_string(TRI_ ## id, label);\n"\
|
||||
+ "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief register all errors for AvocadoDB\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "void TRI_InitialiseErrorMessages (void);\n"\
|
||||
+ "\n"
|
||||
|
||||
# print individual errors
|
||||
for e in errors:
|
||||
header = header\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief " + e[1] + ": " + e[0] + "\n"\
|
||||
+ "///\n"\
|
||||
+ wrap(e[2], 80, 0, 0, "/// ").replace("<", "\<").replace(">", "\>") + "\n"\
|
||||
+ "///\n"\
|
||||
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"\
|
||||
+ "#define TRI_" + e[0].ljust(61) + " (" + e[1] + ")\n"\
|
||||
+ "\n"
|
||||
|
||||
header = header\
|
||||
+ docend\
|
||||
+ "#ifdef __cplusplus\n"\
|
||||
+ "}\n"\
|
||||
+ "#endif\n"\
|
||||
+ "\n"\
|
||||
+ "#endif\n"\
|
||||
+ "\n"
|
||||
|
||||
return header
|
||||
|
||||
|
||||
# define some globals
|
||||
prologue = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @brief auto-generated file generated from errors.dat\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"
|
||||
|
||||
docstart = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @addtogroup VocError\n"\
|
||||
+ "/// @{\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"
|
||||
|
||||
docend = "\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "/// @}\n"\
|
||||
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||
+ "\n"
|
||||
|
||||
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print >> sys.stderr, "usage: %s <sourcefile> <outfile>" % sys.argv[0]
|
||||
sys.exit()
|
||||
|
||||
source = sys.argv[1]
|
||||
|
||||
# read input file
|
||||
errors = csv.reader(open(source, "rb"))
|
||||
errorsList = []
|
||||
|
||||
r1 = re.compile(r'^#.*')
|
||||
|
||||
for e in errors:
|
||||
if len(e) == 0:
|
||||
continue
|
||||
|
||||
if r1.match(e[0]):
|
||||
continue
|
||||
|
||||
if e[0] == "" or e[1] == "" or e[2] == "" or e[3] == "":
|
||||
print >> sys.stderr, "invalid error declaration file: %s (line %i)" % (source, i)
|
||||
sys.exit()
|
||||
|
||||
errorsList.append(e)
|
||||
|
||||
outfile = sys.argv[2]
|
||||
extension = os.path.splitext(outfile)[1]
|
||||
filename = outfile
|
||||
|
||||
if extension == ".tmp":
|
||||
filename = os.path.splitext(outfile)[0]
|
||||
extension = os.path.splitext(filename)[1]
|
||||
|
||||
if extension == ".js":
|
||||
out = genJsFile(errorsList)
|
||||
elif extension == ".h":
|
||||
out = genCHeaderFile(errorsList)
|
||||
elif extension == ".c":
|
||||
out = genCFile(errorsList, filename)
|
||||
else:
|
||||
print >> sys.stderr, "usage: %s <sourcefile> <outfile>" % sys.argv[0]
|
||||
sys.exit()
|
||||
|
||||
outFile = open(outfile, "wb")
|
||||
outFile.write(out);
|
||||
outFile.close()
|
||||
|
|
@ -743,8 +743,10 @@ ENABLE_BOOST_TEST_FALSE
|
|||
ENABLE_BOOST_TEST_TRUE
|
||||
ENABLE_INSTALL_DBDIR_FALSE
|
||||
ENABLE_INSTALL_DBDIR_TRUE
|
||||
ENABLE_INCLUDED_BOOST_FALSE
|
||||
ENABLE_INCLUDED_BOOST_TRUE
|
||||
ENABLE_ERRORS_DEPENDENCY_FALSE
|
||||
ENABLE_ERRORS_DEPENDENCY_TRUE
|
||||
ENABLE_3RD_PARTY_BOOST_FALSE
|
||||
ENABLE_3RD_PARTY_BOOST_TRUE
|
||||
ENABLE_ALL_IN_ONE_FALSE
|
||||
ENABLE_ALL_IN_ONE_TRUE
|
||||
ENABLE_FLEX_FALSE
|
||||
|
@ -795,7 +797,8 @@ enable_option_checking
|
|||
enable_bison
|
||||
enable_flex
|
||||
enable_all_in_one
|
||||
enable_included_boost
|
||||
enable_3rd_party_boost
|
||||
enable_errors_dependency
|
||||
enable_install_dbdir
|
||||
enable_relative
|
||||
with_boost_test
|
||||
|
@ -1468,8 +1471,11 @@ Optional Features:
|
|||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-bison enable BISON
|
||||
--enable-flex enable FLEX
|
||||
--enable-all-in-one use supplied V8, LIBEV from 3rdParty directory
|
||||
--enable-included-boost use supplied BOOST from 3rdParty directory
|
||||
--enable-all-in-one use supplied V8 and LIBEV from 3rdParty directory
|
||||
--enable-3rd-party-boost
|
||||
use supplied BOOST from 3rdParty directory
|
||||
--enable-errors-dependency
|
||||
generate dependencies for error files
|
||||
--enable-install-dbdir install an empty database directory
|
||||
--enable-relative all path are relative to the binary (yes/no/devel
|
||||
[default])
|
||||
|
@ -2511,21 +2517,41 @@ fi
|
|||
|
||||
|
||||
|
||||
# Check whether --enable-included-boost was given.
|
||||
if test "${enable_included_boost+set}" = set; then :
|
||||
enableval=$enable_included_boost; tr_INCLUDED_BOOST="${enableval:-yes}"
|
||||
# Check whether --enable-3rd-party-boost was given.
|
||||
if test "${enable_3rd_party_boost+set}" = set; then :
|
||||
enableval=$enable_3rd_party_boost; tr_3RD_PARTY_BOOST="${enableval:-yes}"
|
||||
else
|
||||
tr_INCLUDED_BOOST=yes
|
||||
tr_3RD_PARTY_BOOST=yes
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "x$tr_INCLUDED_BOOST" = xyes; then
|
||||
ENABLE_INCLUDED_BOOST_TRUE=
|
||||
ENABLE_INCLUDED_BOOST_FALSE='#'
|
||||
if test "x$tr_3RD_PARTY_BOOST" = xyes; then
|
||||
ENABLE_3RD_PARTY_BOOST_TRUE=
|
||||
ENABLE_3RD_PARTY_BOOST_FALSE='#'
|
||||
else
|
||||
ENABLE_INCLUDED_BOOST_TRUE='#'
|
||||
ENABLE_INCLUDED_BOOST_FALSE=
|
||||
ENABLE_3RD_PARTY_BOOST_TRUE='#'
|
||||
ENABLE_3RD_PARTY_BOOST_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-errors-dependency was given.
|
||||
if test "${enable_errors_dependency+set}" = set; then :
|
||||
enableval=$enable_errors_dependency; tr_ERRORS_DEPENDENCY="${enableval:-yes}"
|
||||
else
|
||||
tr_ERRORS_DEPENDENCY=no
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "x$tr_ERRORS_DEPENDENCY" = xyes; then
|
||||
ENABLE_ERRORS_DEPENDENCY_TRUE=
|
||||
ENABLE_ERRORS_DEPENDENCY_FALSE='#'
|
||||
else
|
||||
ENABLE_ERRORS_DEPENDENCY_TRUE='#'
|
||||
ENABLE_ERRORS_DEPENDENCY_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
|
@ -8966,7 +8992,7 @@ FLAG_INFO="$FLAG_INFO|."
|
|||
|
||||
|
||||
|
||||
if test "x$tr_INCLUDED_BOOST" = xyes; then
|
||||
if test "x$tr_3RD_PARTY_BOOST" = xyes; then
|
||||
|
||||
|
||||
BOOST_CPPFLAGS="-I${srcdir}/3rdParty/boost_1_48_0/include"
|
||||
|
@ -8991,7 +9017,7 @@ FLAG_INFO="$FLAG_INFO|BOOST_LIBS: ${BOOST_LIBS}"
|
|||
FLAG_INFO="$FLAG_INFO|."
|
||||
|
||||
|
||||
BASIC_INFO="$BASIC_INFO|INCLUDED-BOOST: enabled"
|
||||
BASIC_INFO="$BASIC_INFO|3RD-PARTY-BOOST: enabled"
|
||||
else
|
||||
|
||||
|
||||
|
@ -9332,7 +9358,7 @@ FLAG_INFO="$FLAG_INFO|BOOST_LIBS: ${BOOST_LIBS}"
|
|||
FLAG_INFO="$FLAG_INFO|."
|
||||
|
||||
|
||||
BASIC_INFO="$BASIC_INFO|INCLUDED-BOOST: disabled"
|
||||
BASIC_INFO="$BASIC_INFO|3RD-PARTY-BOOST: disabled"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -9464,8 +9490,12 @@ if test -z "${ENABLE_ALL_IN_ONE_TRUE}" && test -z "${ENABLE_ALL_IN_ONE_FALSE}";
|
|||
as_fn_error $? "conditional \"ENABLE_ALL_IN_ONE\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ENABLE_INCLUDED_BOOST_TRUE}" && test -z "${ENABLE_INCLUDED_BOOST_FALSE}"; then
|
||||
as_fn_error $? "conditional \"ENABLE_INCLUDED_BOOST\" was never defined.
|
||||
if test -z "${ENABLE_3RD_PARTY_BOOST_TRUE}" && test -z "${ENABLE_3RD_PARTY_BOOST_FALSE}"; then
|
||||
as_fn_error $? "conditional \"ENABLE_3RD_PARTY_BOOST\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ENABLE_ERRORS_DEPENDENCY_TRUE}" && test -z "${ENABLE_ERRORS_DEPENDENCY_FALSE}"; then
|
||||
as_fn_error $? "conditional \"ENABLE_ERRORS_DEPENDENCY\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ENABLE_INSTALL_DBDIR_TRUE}" && test -z "${ENABLE_INSTALL_DBDIR_FALSE}"; then
|
||||
|
|
29
configure.ac
29
configure.ac
|
@ -43,7 +43,7 @@ AM_CONDITIONAL(ENABLE_FLEX, test "x$tr_FLEX" = xyes)
|
|||
|
||||
dnl ALL-IN-ONE
|
||||
AC_ARG_ENABLE(all-in-one,
|
||||
AS_HELP_STRING([--enable-all-in-one], [use supplied V8, LIBEV from 3rdParty directory]),
|
||||
AS_HELP_STRING([--enable-all-in-one], [use supplied V8 and LIBEV from 3rdParty directory]),
|
||||
[ALL_IN_ONE_ENABLE="${enableval:-yes}"],
|
||||
[ALL_IN_ONE_ENABLE=yes]
|
||||
)
|
||||
|
@ -53,13 +53,24 @@ AM_CONDITIONAL(ENABLE_ALL_IN_ONE, test "x$ALL_IN_ONE_ENABLE" = xyes)
|
|||
|
||||
|
||||
dnl BOOST
|
||||
AC_ARG_ENABLE(included-boost,
|
||||
AS_HELP_STRING([--enable-included-boost], [use supplied BOOST from 3rdParty directory]),
|
||||
[tr_INCLUDED_BOOST="${enableval:-yes}"],
|
||||
[tr_INCLUDED_BOOST=yes]
|
||||
AC_ARG_ENABLE(3rd-party-boost,
|
||||
AS_HELP_STRING([--enable-3rd-party-boost], [use supplied BOOST from 3rdParty directory]),
|
||||
[tr_3RD_PARTY_BOOST="${enableval:-yes}"],
|
||||
[tr_3RD_PARTY_BOOST=yes]
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_INCLUDED_BOOST, test "x$tr_INCLUDED_BOOST" = xyes)
|
||||
AM_CONDITIONAL(ENABLE_3RD_PARTY_BOOST, test "x$tr_3RD_PARTY_BOOST" = xyes)
|
||||
|
||||
|
||||
|
||||
dnl ERRORS
|
||||
AC_ARG_ENABLE(errors-dependency,
|
||||
AS_HELP_STRING([--enable-errors-dependency], [generate dependencies for error files]),
|
||||
[tr_ERRORS_DEPENDENCY="${enableval:-yes}"],
|
||||
[tr_ERRORS_DEPENDENCY=no]
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_ERRORS_DEPENDENCY, test "x$tr_ERRORS_DEPENDENCY" = xyes)
|
||||
|
||||
|
||||
|
||||
|
@ -156,12 +167,12 @@ fi
|
|||
|
||||
m4_include([m4/all-in-one.mruby])
|
||||
|
||||
if test "x$tr_INCLUDED_BOOST" = xyes; then
|
||||
if test "x$tr_3RD_PARTY_BOOST" = xyes; then
|
||||
m4_include([m4/all-in-one.boost])
|
||||
BASIC_INFO="$BASIC_INFO|INCLUDED-BOOST: enabled"
|
||||
BASIC_INFO="$BASIC_INFO|3RD-PARTY-BOOST: enabled"
|
||||
else
|
||||
m4_include([m4/external.boost])
|
||||
BASIC_INFO="$BASIC_INFO|INCLUDED-BOOST: disabled"
|
||||
BASIC_INFO="$BASIC_INFO|3RD-PARTY-BOOST: disabled"
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
|
|
Loading…
Reference in New Issue