mirror of https://gitee.com/bigwinds/arangodb
added generateMimetypes and generateErrorfiles
This commit is contained in:
parent
d7bd642ed1
commit
1cd53c20a1
|
@ -25,14 +25,14 @@ js-*.h
|
||||||
|
|
||||||
testresult.json
|
testresult.json
|
||||||
|
|
||||||
build/
|
build*/
|
||||||
Build64/
|
Build64/
|
||||||
Build32/
|
Build32/
|
||||||
Debug64/
|
Debug64/
|
||||||
Debug32/
|
Debug32/
|
||||||
Release64/
|
Release64/
|
||||||
Release32/
|
Release32/
|
||||||
WindowsLibraries
|
WindowsLibraries/
|
||||||
|
|
||||||
core
|
core
|
||||||
TAGS
|
TAGS
|
||||||
|
@ -62,18 +62,24 @@ Documentation/Books/Makefile
|
||||||
Documentation/Books/Users/node_modules/
|
Documentation/Books/Users/node_modules/
|
||||||
Documentation/Examples/*.generated
|
Documentation/Examples/*.generated
|
||||||
Documentation/Books/ppbooks/
|
Documentation/Books/ppbooks/
|
||||||
|
|
||||||
UnitTests/HttpInterface/logs/
|
UnitTests/HttpInterface/logs/
|
||||||
UnitTests/basics_suite
|
UnitTests/basics_suite
|
||||||
UnitTests/geo_suite
|
UnitTests/geo_suite
|
||||||
|
|
||||||
arangod/Aql/grammar.c
|
arangod/Aql/grammar.c
|
||||||
arangod/Aql/grammar.cpp
|
arangod/Aql/grammar.cpp
|
||||||
arangod/Aql/grammar.h
|
arangod/Aql/grammar.h
|
||||||
arangod/Aql/grammar.hpp
|
arangod/Aql/grammar.hpp
|
||||||
arangod/Aql/grammar.output
|
arangod/Aql/grammar.output
|
||||||
arangod/Aql/tokens.cpp
|
arangod/Aql/tokens.cpp
|
||||||
|
|
||||||
bin/
|
bin/
|
||||||
|
|
||||||
etc/arangodb/*.conf
|
etc/arangodb/*.conf
|
||||||
|
|
||||||
js/common/bootstrap/errors.js
|
js/common/bootstrap/errors.js
|
||||||
|
|
||||||
lib/Basics/local-configuration.h
|
lib/Basics/local-configuration.h
|
||||||
lib/Basics/stamp-h2
|
lib/Basics/stamp-h2
|
||||||
lib/Basics/voc-errors.cpp
|
lib/Basics/voc-errors.cpp
|
||||||
|
|
|
@ -525,6 +525,76 @@ include_directories(${ICU_INCLUDE_DIR})
|
||||||
|
|
||||||
include(ArangoDBMacros)
|
include(ArangoDBMacros)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## ERRORS FILE
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
if (USE_MAINTAINER_MODE)
|
||||||
|
set(ERROR_FILES
|
||||||
|
lib/Basics/voc-errors.h
|
||||||
|
lib/Basics/voc-errors.cpp
|
||||||
|
js/common/bootstrap/errors.js
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ERROR_FILES_GEN)
|
||||||
|
set(ERRORS_DAT lib/Basics/errors.dat)
|
||||||
|
|
||||||
|
foreach (m IN LISTS ERROR_FILES)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT
|
||||||
|
${CMAKE_SOURCE_DIR}/${m}
|
||||||
|
COMMAND
|
||||||
|
./utils/generateErrorfile.sh ./${ERRORS_DAT} ./${m}
|
||||||
|
DEPENDS
|
||||||
|
${CMAKE_SOURCE_DIR}/${ERRORS_DAT}
|
||||||
|
WORKING_DIRECTORY
|
||||||
|
${CMAKE_SOURCE_DIR}
|
||||||
|
COMMENT
|
||||||
|
"Building errors files ${m}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND ERROR_FILES_GEN ${CMAKE_SOURCE_DIR}/${m})
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
add_custom_target(errorfiles ALL DEPENDS ${ERROR_FILES_GEN})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## MIMETYPES FILE
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
if (USE_MAINTAINER_MODE)
|
||||||
|
set(MIMETYPES_FILES
|
||||||
|
lib/Basics/voc-mimetypes.h
|
||||||
|
lib/Basics/voc-mimetypes.cpp
|
||||||
|
js/common/modules/@arangodb/mimetypes.js
|
||||||
|
)
|
||||||
|
|
||||||
|
set(MIMETYPES_FILES_GEN)
|
||||||
|
set(MIMETYPES_DAT lib/Basics/mimetypes.dat)
|
||||||
|
|
||||||
|
foreach (m IN LISTS MIMETYPES_FILES)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT
|
||||||
|
${CMAKE_SOURCE_DIR}/${m}
|
||||||
|
COMMAND
|
||||||
|
./utils/generateMimetypes.sh ./${MIMETYPES_DAT} ./${m}
|
||||||
|
DEPENDS
|
||||||
|
${CMAKE_SOURCE_DIR}/${MIMETYPES_DAT}
|
||||||
|
WORKING_DIRECTORY
|
||||||
|
${CMAKE_SOURCE_DIR}
|
||||||
|
COMMENT
|
||||||
|
"Building mimetypes files ${m}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND MIMETYPES_FILES_GEN ${CMAKE_SOURCE_DIR}/${m})
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
add_custom_target(mimetypes ALL DEPENDS ${MIMETYPES_FILES_GEN})
|
||||||
|
endif ()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
## SUB-PROJECTS
|
## SUB-PROJECTS
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -23,7 +23,8 @@ if (USE_MAINTAINER_MODE)
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${mdst}
|
${mdst}
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_SOURCE_DIR}/utils/manPages.sh ${msrc} ${mdst} ${ARANGODB_VERSION}
|
${CMAKE_SOURCE_DIR}/utils/manPages.sh
|
||||||
|
${msrc} ${mdst} ${ARANGODB_VERSION}
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${msrc}
|
${msrc}
|
||||||
WORKING_DIRECTORY
|
WORKING_DIRECTORY
|
||||||
|
@ -40,7 +41,8 @@ if (USE_MAINTAINER_MODE)
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${CMAKE_SOURCE_DIR}/README
|
${CMAKE_SOURCE_DIR}/README
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_SOURCE_DIR}/utils/generateREADME.sh ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/README
|
${CMAKE_SOURCE_DIR}/utils/generateREADME.sh
|
||||||
|
${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/README
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${CMAKE_SOURCE_DIR}/README.md
|
${CMAKE_SOURCE_DIR}/README.md
|
||||||
WORKING_DIRECTORY
|
WORKING_DIRECTORY
|
||||||
|
|
441
Makefile.am
441
Makefile.am
|
@ -1,441 +0,0 @@
|
||||||
# -*- mode: Makefile; -*-
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- COMMON DEFINES
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
comma := ,
|
|
||||||
empty :=
|
|
||||||
space := $(empty) $(empty)
|
|
||||||
MAJOR_MINOR := $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(VERSION))))
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- FILES
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief man pages to install
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
dist_man_MANS =
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief files to cleanup
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
CLEANUP =
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief targets for cleanup of 3rd party libraries
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
CLEANUP_3RD =
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- PATHS
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief program suffix
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
PROGRAM_SUFFIX=$(shell echo | sed '$(program_transform_name)')
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief system directory
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if ENABLE_RELATIVE
|
|
||||||
|
|
||||||
TRI_PKGDATADIR = .
|
|
||||||
TRI_LOCALSTATEDIR = .
|
|
||||||
TRI_SBINDIR = ${abs_builddir}/bin
|
|
||||||
TRI_BINDIR = ${abs_builddir}/bin
|
|
||||||
TRI_LIBEXECDIR = ${abs_builddir}/bin
|
|
||||||
TRI_SYSCONFDIR = etc/relative
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
TRI_LOCALSTATEDIR = ${localstatedir}
|
|
||||||
TRI_PKGDATADIR = ${pkgdatadir}
|
|
||||||
TRI_SBINDIR = ${sbindir}
|
|
||||||
TRI_BINDIR = ${bindir}
|
|
||||||
TRI_LIBEXECDIR = ${libexecdir}
|
|
||||||
TRI_SYSCONFDIR = ${sysconfdir}/${PACKAGE_TARNAME}
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- FLAGS
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief m4 directory
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief preprocessor flags
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-DTRI_BUILD_DATE='"$(shell date +%Y-%m-%d)"' \
|
|
||||||
-D_SYSCONFDIR_='"${TRI_SYSCONFDIR}"' \
|
|
||||||
-I@top_builddir@/3rdParty/velocypack/include \
|
|
||||||
-I@top_srcdir@/lib \
|
|
||||||
-I@top_srcdir@/3rdParty/velocypack/include \
|
|
||||||
-I@top_builddir@/lib \
|
|
||||||
-I@top_srcdir@/3rdParty/velocypack/include \
|
|
||||||
@BOOST_CPPFLAGS@ \
|
|
||||||
@LIBEV_CPPFLAGS@ \
|
|
||||||
@MATH_CPPFLAGS@ \
|
|
||||||
@ICU_CPPFLAGS@ \
|
|
||||||
@ZLIB_CPPFLAGS@ \
|
|
||||||
@V8_CPPFLAGS@ \
|
|
||||||
@OPENSSL_CPPFLAGS@
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief linker flags
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
AM_LDFLAGS = \
|
|
||||||
@LIBEV_LDFLAGS@ \
|
|
||||||
@MATH_LDFLAGS@ \
|
|
||||||
@OPENSSL_LDFLAGS@ \
|
|
||||||
@ICU_LDFLAGS@ \
|
|
||||||
@ZLIB_LDFLAGS@ \
|
|
||||||
@V8_LDFLAGS@
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief libraries
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
LIBS = \
|
|
||||||
@TCMALLOC_LIBS@ \
|
|
||||||
@RT_LIBS@ \
|
|
||||||
@LIBEV_LIBS@ \
|
|
||||||
@MATH_LIBS@ \
|
|
||||||
@OPENSSL_LIBS@ \
|
|
||||||
@ICU_LIBS@ \
|
|
||||||
@ZLIB_LIBS@
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- LIBRARIES & PROGRAMS
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief auxiliary libraries
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
noinst_LIBRARIES = \
|
|
||||||
lib/libarango.a \
|
|
||||||
lib/libarango_v8.a \
|
|
||||||
lib/libarango_client.a \
|
|
||||||
arangod/libarangod.a
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /bin programs
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
|
||||||
bin/arangob \
|
|
||||||
bin/arangodump \
|
|
||||||
bin/arangorestore \
|
|
||||||
bin/arangosh \
|
|
||||||
bin/arangoimp
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /sbin programs
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
sbin_PROGRAMS = \
|
|
||||||
bin/arangod
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief helper programs
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
noinst_bin =
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /libexec programs
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
pkglibexec_SCRIPTS =
|
|
||||||
|
|
||||||
if ENABLE_ALL_IN_ONE_ETCD
|
|
||||||
pkglibexec_SCRIPTS += bin/etcd-arango$(PROGRAM_SUFFIX)
|
|
||||||
|
|
||||||
CLEANUP += bin/etcd-arango$(PROGRAM_SUFFIX)
|
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /bin scripts
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
bin_SCRIPTS =
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief uninstalled programs
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
noinst_PROGRAMS =
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /etc data
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
arangosysconfdir=$(sysconfdir)/$(PACKAGE_TARNAME)
|
|
||||||
|
|
||||||
arangosysconf_DATA = $(shell find @builddir@/etc/arangodb -name "*$(PROGRAM_SUFFIX).conf" -print)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /share data
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
JS_FILE_LIST = $(shell @srcdir@/Installation/file-list-js.sh @srcdir@)
|
|
||||||
|
|
||||||
pkgdataJS01dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS02dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS03dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS04dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS05dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS06dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS07dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS08dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS09dir = $(datadir)/arangodb
|
|
||||||
pkgdataJS10dir = $(datadir)/arangodb
|
|
||||||
|
|
||||||
nobase_pkgdataJS01_DATA = $(wordlist 1, 1000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS02_DATA = $(wordlist 1001, 2000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS03_DATA = $(wordlist 2001, 3000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS04_DATA = $(wordlist 3001, 4000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS05_DATA = $(wordlist 4001, 5000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS06_DATA = $(wordlist 5001, 6000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS07_DATA = $(wordlist 6001, 7000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS08_DATA = $(wordlist 7001, 8000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS09_DATA = $(wordlist 8001, 9000, $(JS_FILE_LIST))
|
|
||||||
nobase_pkgdataJS10_DATA = $(wordlist 9001, 100000, $(JS_FILE_LIST))
|
|
||||||
|
|
||||||
nobase_pkgdata_DATA =
|
|
||||||
|
|
||||||
CLEANUP += @srcdir@/.file-list-js
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /var data
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
install-data-local:
|
|
||||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb
|
|
||||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/lib/arangodb-apps
|
|
||||||
test -d $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb || mkdir -p $(DESTDIR)$(TRI_LOCALSTATEDIR)/log/arangodb
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief /doc
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
dist_doc_DATA = README README.md LICENSE LICENSES-OTHER-COMPONENTS.md
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief symbolic links
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
install-exec-hook:
|
|
||||||
rm -f $(DESTDIR)$(bindir)/foxx-manager$(PROGRAM_SUFFIX)
|
|
||||||
$(LN_S) arangosh$(PROGRAM_SUFFIX) $(DESTDIR)$(bindir)/foxx-manager$(PROGRAM_SUFFIX)
|
|
||||||
|
|
||||||
rm -f $(DESTDIR)$(sbindir)/arango-dfdb$(PROGRAM_SUFFIX)
|
|
||||||
$(LN_S) arangod$(PROGRAM_SUFFIX) $(DESTDIR)$(sbindir)/arango-dfdb$(PROGRAM_SUFFIX)
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- TARGETS
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief version number
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
build.h: configure.ac
|
|
||||||
@echo '#define TRI_VERSION "@PACKAGE_VERSION@"' > build.h
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief source files
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include lib/Makefile.files
|
|
||||||
include arangod/Makefile.files
|
|
||||||
include arangosh/Makefile.files
|
|
||||||
include etc/Makefile.files
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief unit tests
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include UnitTests/Makefile.unittests
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief error code file
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if ENABLE_MAINTAINER_MODE
|
|
||||||
|
|
||||||
BUILT_SOURCES += \
|
|
||||||
@top_srcdir@/lib/Basics/voc-errors.h \
|
|
||||||
@top_srcdir@/lib/Basics/voc-errors.cpp \
|
|
||||||
@top_srcdir@/js/common/bootstrap/errors.js
|
|
||||||
|
|
||||||
@top_srcdir@/lib/Basics/voc-errors.h: lib/Basics/errors.dat
|
|
||||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat @top_srcdir@/lib/Basics/voc-errors.h
|
|
||||||
|
|
||||||
@top_srcdir@/lib/Basics/voc-errors.cpp: lib/Basics/errors.dat
|
|
||||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat @top_srcdir@/lib/Basics/voc-errors.cpp
|
|
||||||
|
|
||||||
@top_srcdir@/js/common/bootstrap/errors.js: lib/Basics/errors.dat
|
|
||||||
@top_srcdir@/config/build_errorfile.sh @top_srcdir@/config/generateErrorfile.py lib/Basics/errors.dat js/common/bootstrap/errors.js
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief mimetypes file
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if ENABLE_MAINTAINER_MODE
|
|
||||||
|
|
||||||
BUILT_SOURCES += \
|
|
||||||
@top_srcdir@/lib/Basics/voc-mimetypes.h \
|
|
||||||
@top_srcdir@/lib/Basics/voc-mimetypes.cpp \
|
|
||||||
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js
|
|
||||||
|
|
||||||
@top_srcdir@/lib/Basics/voc-mimetypes.h: lib/Basics/mimetypes.dat
|
|
||||||
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat @top_srcdir@/lib/Basics/voc-mimetypes.h
|
|
||||||
|
|
||||||
@top_srcdir@/lib/Basics/voc-mimetypes.cpp: lib/Basics/mimetypes.dat
|
|
||||||
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat @top_srcdir@/lib/Basics/voc-mimetypes.cpp
|
|
||||||
|
|
||||||
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js: lib/Basics/mimetypes.dat
|
|
||||||
@top_srcdir@/config/build_mimetypes.sh @top_srcdir@/config/generateMimetypes.py lib/Basics/mimetypes.dat js/common/modules/@arangodb/mimetypes.js
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
## cleanup
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
distclean-local:
|
|
||||||
@for i in $(CLEANUP_3RD); do $(MAKE) $$i; done
|
|
||||||
rm -f $(BUILT_SOURCES)
|
|
||||||
|
|
||||||
clean-local:
|
|
||||||
rm -rf $(CLEANUP)
|
|
||||||
rm -rf `find . -name \*.gcno`
|
|
||||||
rm -rf `find . -name \*.gcda`
|
|
||||||
|
|
||||||
superclean: distclean
|
|
||||||
rm -rf arangod/*/.deps lib/*/.deps Makefile
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief generated files
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
.PHONY: built-sources
|
|
||||||
|
|
||||||
built-sources: \
|
|
||||||
build.h \
|
|
||||||
@top_srcdir@/js/common/bootstrap/errors.js \
|
|
||||||
@top_srcdir@/js/common/modules/@arangodb/mimetypes.js
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief tags file
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
GTAGS_FILES = $(sort $(abspath $(SOURCES) $(HEADERS)))
|
|
||||||
|
|
||||||
GTAGS:
|
|
||||||
echo $(GTAGS_FILES) | tr " " "\n" | gtags -i -f -
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief cleanup source and header files
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
.PHONY: update-disclaimer
|
|
||||||
|
|
||||||
update-disclaimer:
|
|
||||||
find lib arangod arangosh "(" -name "*.c" -o -name "*.h" -o -name "*.cpp" ")" -exec utils/cleanupCFiles "{}" ";"
|
|
||||||
find lib arangod arangosh "(" -name "*.c" -o -name "*.h" -o -name "*.cpp" ")" -exec chmod "644" "{}" ";"
|
|
||||||
find js/common/bootstrap js/client/bootstrap js/server/bootstrap -name "*.js" -a ! -name errors.js -exec utils/cleanupCFiles "{}" ";"
|
|
||||||
find js/common/modules/@arangodb js/client/modules/@arangodb js/server/modules/@arangodb -name "*.js"
|
|
||||||
find js -name "*.js" -exec chmod "644" "{}" ";"
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- DEPENDENCIES
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief documentation
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include Documentation/Makefile.files
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief javascript
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include js/Makefile.files
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- GENERATED FILES
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief generate readme
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if ENABLE_MARKDOWN
|
|
||||||
if ENABLE_HTML2TEXT
|
|
||||||
|
|
||||||
BUILT_SOURCES += README
|
|
||||||
|
|
||||||
README: README.md
|
|
||||||
fgrep -v "[Build Status]" $< \
|
|
||||||
| fgrep -v "ArangoDB-Logo" \
|
|
||||||
| @MARKDOWN_EXEC@ \
|
|
||||||
| @HTML2TEXT_EXEC@ -style pretty -nobs \
|
|
||||||
| sed -e 's:>:>:g' \
|
|
||||||
| awk 'BEGIN { s = 0; } { if (length($0) == 0) {if (s != 0) print $0;} else {s = 1; print $0; }}' \
|
|
||||||
> $@.tmp
|
|
||||||
mv $@.tmp $@
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
## --SECTION-- EXTERNAL LIBRARIES
|
|
||||||
## -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief libev
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include 3rdParty/Makefile.libev
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief V8
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include 3rdParty/Makefile.v8
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief zlib
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include 3rdParty/Makefile.zlib
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
### @brief etcd
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
if ENABLE_ALL_IN_ONE_ETCD
|
|
||||||
include 3rdParty/Makefile.etcd
|
|
||||||
endif
|
|
|
@ -8,9 +8,29 @@
|
||||||
/*global exports */
|
/*global exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief auto-generated file generated from mimetypes.dat
|
/// AUTO-GENERATED FILE GENERATED FROM mimetypes.dat
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||||
|
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
exports.mimeTypes = {
|
exports.mimeTypes = {
|
||||||
"gif": [ "image/gif", false ],
|
"gif": [ "image/gif", false ],
|
||||||
"jpg": [ "image/jpg", false ],
|
"jpg": [ "image/jpg", false ],
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// AUTO-GENERATED FILE GENERATED FROM mimetypes.dat
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
|
@ -17,10 +21,9 @@
|
||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
|
|
||||||
#include "Basics/mimetypes.h"
|
#include "Basics/mimetypes.h"
|
||||||
#include "./lib/Basics/voc-mimetypes.h"
|
#include "./lib/Basics/voc-mimetypes.h"
|
||||||
|
|
||||||
|
@ -55,38 +58,15 @@ void TRI_InitializeEntriesMimetypes() {
|
||||||
TRI_RegisterMimetype("tgz", "application/x-tar", false);
|
TRI_RegisterMimetype("tgz", "application/x-tar", false);
|
||||||
TRI_RegisterMimetype("zip", "application/x-compressed-zip", false);
|
TRI_RegisterMimetype("zip", "application/x-compressed-zip", false);
|
||||||
TRI_RegisterMimetype("doc", "application/msword", false);
|
TRI_RegisterMimetype("doc", "application/msword", false);
|
||||||
TRI_RegisterMimetype(
|
TRI_RegisterMimetype("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", false);
|
||||||
"docx",
|
TRI_RegisterMimetype("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", false);
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
TRI_RegisterMimetype("potx", "application/vnd.openxmlformats-officedocument.presentationml.template", false);
|
||||||
false);
|
TRI_RegisterMimetype("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", false);
|
||||||
TRI_RegisterMimetype(
|
|
||||||
"dotx",
|
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype(
|
|
||||||
"potx",
|
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype(
|
|
||||||
"ppsx",
|
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype("ppt", "application/vnd.ms-powerpoint", false);
|
TRI_RegisterMimetype("ppt", "application/vnd.ms-powerpoint", false);
|
||||||
TRI_RegisterMimetype("pptx",
|
TRI_RegisterMimetype("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", false);
|
||||||
"application/"
|
|
||||||
"vnd.openxmlformats-officedocument.presentationml."
|
|
||||||
"presentation",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype("xls", "application/vnd.ms-excel", false);
|
TRI_RegisterMimetype("xls", "application/vnd.ms-excel", false);
|
||||||
TRI_RegisterMimetype(
|
TRI_RegisterMimetype("xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12", false);
|
||||||
"xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12", false);
|
TRI_RegisterMimetype("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", false);
|
||||||
TRI_RegisterMimetype(
|
TRI_RegisterMimetype("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template", false);
|
||||||
"xlsx",
|
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype(
|
|
||||||
"xltx",
|
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
||||||
false);
|
|
||||||
TRI_RegisterMimetype("swf", "application/x-shockwave-flash", false);
|
TRI_RegisterMimetype("swf", "application/x-shockwave-flash", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
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):
|
||||||
|
jslint = "/*jshint maxlen: 240 */\n/*global require */\n\n"
|
||||||
|
|
||||||
|
out = jslint \
|
||||||
|
+ prologue\
|
||||||
|
+ "(function () {\n"\
|
||||||
|
+ " \"use strict\";\n"\
|
||||||
|
+ " var internal = require(\"internal\");\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ " internal.errors = {\n"
|
||||||
|
|
||||||
|
# print individual errors
|
||||||
|
i = 0
|
||||||
|
for e in errors:
|
||||||
|
name = "\"" + e[0] + "\""
|
||||||
|
msg = e[2].replace("\n", " ").replace("\\", "").replace("\"", "\\\"")
|
||||||
|
out = out\
|
||||||
|
+ " " + name.ljust(30) + " : { \"code\" : " + e[1] + ", \"message\" : \"" + msg + "\" }"
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
if i < len(errors):
|
||||||
|
out = out + ",\n"
|
||||||
|
else:
|
||||||
|
out = out + "\n"
|
||||||
|
|
||||||
|
|
||||||
|
out = out\
|
||||||
|
+ " };\n"\
|
||||||
|
+ "}());\n"\
|
||||||
|
+ "\n"
|
||||||
|
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# generate C implementation file from errors
|
||||||
|
def genCFile(errors, filename):
|
||||||
|
|
||||||
|
headerfile = os.path.splitext(filename)[0] + ".h"
|
||||||
|
|
||||||
|
impl = prologue\
|
||||||
|
+ "#include \"Basics/Common.h\"\n"\
|
||||||
|
+ "#include \"" + headerfile + "\"\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "void TRI_InitializeErrorMessages () {\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"
|
||||||
|
|
||||||
|
return impl
|
||||||
|
|
||||||
|
|
||||||
|
# generate C header file from errors
|
||||||
|
def genCHeaderFile(errors):
|
||||||
|
wiki = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// Error codes and meanings\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// The following errors might be raised when running ArangoDB:\n"\
|
||||||
|
+ "///\n"
|
||||||
|
|
||||||
|
for e in errors:
|
||||||
|
wiki = wiki\
|
||||||
|
+ "/// - " + e[1] + ": @LIT{" + e[2].replace("%", "\%").replace("<", "\<").replace(">", "\>") + "}\n"\
|
||||||
|
+ wrap(e[3], 80, 0, 0, "/// ") + "\n"
|
||||||
|
|
||||||
|
wiki = wiki\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"
|
||||||
|
|
||||||
|
header = "\n"\
|
||||||
|
+ "#ifndef TRIAGENS_BASICS_VOC_ERRORS_H\n"\
|
||||||
|
+ "#define TRIAGENS_BASICS_VOC_ERRORS_H 1\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ wiki\
|
||||||
|
+ "\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\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 ArangoDB\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "void TRI_InitializeErrorMessages ();\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\
|
||||||
|
+ "#endif\n"\
|
||||||
|
+ "\n"
|
||||||
|
|
||||||
|
return header
|
||||||
|
|
||||||
|
|
||||||
|
# define some globals
|
||||||
|
prologue = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// @brief auto-generated file generated from errors.dat\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" % (source)
|
||||||
|
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 == ".cpp":
|
||||||
|
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()
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SOURCE="$1"
|
||||||
|
DEST="$2"
|
||||||
|
|
||||||
|
SCRIPT="`dirname $0`/generateErrorfile.py"
|
||||||
|
|
||||||
|
python "$SCRIPT" "$SOURCE" "$DEST.tmp"
|
||||||
|
|
||||||
|
if cmp -s $DEST ${DEST}.tmp; then
|
||||||
|
rm ${DEST}.tmp
|
||||||
|
else
|
||||||
|
mv ${DEST}.tmp $DEST
|
||||||
|
fi
|
|
@ -0,0 +1,191 @@
|
||||||
|
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 mimetypes
|
||||||
|
def genJsFile(types):
|
||||||
|
jslint = "/*jslint indent: 2,\n"\
|
||||||
|
" nomen: true,\n"\
|
||||||
|
" maxlen: 100,\n"\
|
||||||
|
" sloppy: true,\n"\
|
||||||
|
" vars: true,\n"\
|
||||||
|
" white: true,\n"\
|
||||||
|
" plusplus: true */\n"\
|
||||||
|
"/*global exports */\n\n"
|
||||||
|
|
||||||
|
out = jslint \
|
||||||
|
+ prologue\
|
||||||
|
+ "exports.mimeTypes = {\n"
|
||||||
|
|
||||||
|
extensions = { }
|
||||||
|
# print individual mimetypes
|
||||||
|
i = 0
|
||||||
|
for t in types:
|
||||||
|
extension = t[0]
|
||||||
|
mimetype = t[1]
|
||||||
|
out = out + " \"" + extension + "\": [ \"" + mimetype + "\", " + t[2] + " ]"
|
||||||
|
|
||||||
|
if not mimetype in extensions:
|
||||||
|
extensions[mimetype] = [ ]
|
||||||
|
|
||||||
|
extensions[mimetype].append(extension)
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
if i < len(types):
|
||||||
|
out = out + ", \n"
|
||||||
|
else:
|
||||||
|
out = out + "\n"
|
||||||
|
|
||||||
|
out = out + "};\n\n"
|
||||||
|
|
||||||
|
# print extensions
|
||||||
|
out = out + "exports.extensions = {\n"
|
||||||
|
i = 0
|
||||||
|
for e in extensions:
|
||||||
|
|
||||||
|
out = out + " \"" + e + "\": [ \"" + "\", \"".join(extensions[e]) + "\" ]"
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
if i < len(extensions):
|
||||||
|
out = out + ", \n"
|
||||||
|
else:
|
||||||
|
out = out + "\n"
|
||||||
|
|
||||||
|
out = out + "};\n\n"
|
||||||
|
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# generate C header file from errors
|
||||||
|
def genCHeaderFile(types):
|
||||||
|
header = "\n"\
|
||||||
|
+ "#ifndef LIB_BASICS_VOC_MIMETYPES_H\n"\
|
||||||
|
+ "#define LIB_BASICS_VOC_MIMETYPES_H 1\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// @brief initialize mimetypes\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "void TRI_InitializeEntriesMimetypes();\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "#endif\n"
|
||||||
|
|
||||||
|
return header
|
||||||
|
|
||||||
|
|
||||||
|
# generate C implementation file from mimetypes
|
||||||
|
def genCFile(types, filename):
|
||||||
|
|
||||||
|
headerfile = os.path.splitext(filename)[0] + ".h"
|
||||||
|
|
||||||
|
impl = prologue\
|
||||||
|
+ "#include \"Basics/Common.h\"\n\n"\
|
||||||
|
+ "#include \"Basics/mimetypes.h\"\n"\
|
||||||
|
+ "#include \"" + headerfile + "\"\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// @brief initialize mimetypes\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "void TRI_InitializeEntriesMimetypes() {\n"
|
||||||
|
|
||||||
|
# print individual types
|
||||||
|
for t in types:
|
||||||
|
impl = impl + " TRI_RegisterMimetype(\"" + t[0] + "\", \"" + t[1] + "\", " + t[2] + ");\n"
|
||||||
|
|
||||||
|
impl = impl\
|
||||||
|
+ "}\n"
|
||||||
|
|
||||||
|
return impl
|
||||||
|
|
||||||
|
|
||||||
|
# define some globals
|
||||||
|
prologue = "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// AUTO-GENERATED FILE GENERATED FROM mimetypes.dat\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "\n"\
|
||||||
|
+ "////////////////////////////////////////////////////////////////////////////////\n"\
|
||||||
|
+ "/// DISCLAIMER\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany\n"\
|
||||||
|
+ "/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n"\
|
||||||
|
+ "/// you may not use this file except in compliance with the License.\n"\
|
||||||
|
+ "/// You may obtain a copy of the License at\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// http://www.apache.org/licenses/LICENSE-2.0\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// Unless required by applicable law or agreed to in writing, software\n"\
|
||||||
|
+ "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n"\
|
||||||
|
+ "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"\
|
||||||
|
+ "/// See the License for the specific language governing permissions and\n"\
|
||||||
|
+ "/// limitations under the License.\n"\
|
||||||
|
+ "///\n"\
|
||||||
|
+ "/// Copyright holder is ArangoDB GmbH, Cologne, Germany\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
|
||||||
|
mimetypes = csv.reader(open(source, "rb"))
|
||||||
|
types = []
|
||||||
|
|
||||||
|
r1 = re.compile(r'^#.*')
|
||||||
|
|
||||||
|
for t in mimetypes:
|
||||||
|
if len(t) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if r1.match(t[0]):
|
||||||
|
continue
|
||||||
|
|
||||||
|
t[2] = t[2].strip()
|
||||||
|
if t[0] == "" or t[1] == "" or not (t[2] == "true" or t[2] == "false"):
|
||||||
|
print >> sys.stderr, "invalid mimetypes declaration file: %s" % (source)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
types.append(t)
|
||||||
|
|
||||||
|
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(types)
|
||||||
|
elif extension == ".h":
|
||||||
|
out = genCHeaderFile(types)
|
||||||
|
elif extension == ".cpp":
|
||||||
|
out = genCFile(types, filename)
|
||||||
|
else:
|
||||||
|
print >> sys.stderr, "usage: %s <sourcefile> <outfile>" % sys.argv[0]
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
outFile = open(outfile, "wb")
|
||||||
|
outFile.write(out);
|
||||||
|
outFile.close()
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SOURCE="$1"
|
||||||
|
DEST="$2"
|
||||||
|
|
||||||
|
SCRIPT="`dirname $0`/generateMimetypes.py"
|
||||||
|
|
||||||
|
python "$SCRIPT" "$SOURCE" "$DEST.tmp"
|
||||||
|
|
||||||
|
if cmp -s $DEST ${DEST}.tmp; then
|
||||||
|
rm ${DEST}.tmp
|
||||||
|
else
|
||||||
|
mv ${DEST}.tmp $DEST
|
||||||
|
fi
|
Loading…
Reference in New Issue