buildsystem update
This commit is contained in:
		
							
								
								
									
										50
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,53 @@
 | 
			
		||||
2015-11-16 12:37  marc
 | 
			
		||||
 | 
			
		||||
	* doc/doxyfile.in: SVG must not be interactive for embedding in
 | 
			
		||||
	  redmine
 | 
			
		||||
 | 
			
		||||
2015-11-09 12:52  marc
 | 
			
		||||
 | 
			
		||||
	* ax_init_standard_project.m4, bootstrap.sh, debian/control.in,
 | 
			
		||||
	  resolve-debbuilddeps.sh: fixed build dependencies
 | 
			
		||||
 | 
			
		||||
2015-11-07 10:47  marc
 | 
			
		||||
 | 
			
		||||
	* bootstrap.sh: there is no qt4-default
 | 
			
		||||
 | 
			
		||||
2015-11-07 09:23  marc
 | 
			
		||||
 | 
			
		||||
	* bootstrap.sh, debian/control.in: there is no qt4-default
 | 
			
		||||
 | 
			
		||||
2015-11-06 23:58  marc
 | 
			
		||||
 | 
			
		||||
	* debian/control.in: fixed dependencies
 | 
			
		||||
 | 
			
		||||
2015-11-05 09:47  marc
 | 
			
		||||
 | 
			
		||||
	* ax_init_standard_project.m4, bootstrap.sh, build-in-docker.sh,
 | 
			
		||||
	  resolve-debbuilddeps.sh: updated build system
 | 
			
		||||
 | 
			
		||||
2015-11-05 09:07  marc
 | 
			
		||||
 | 
			
		||||
	* doc/doxyfile.in: doxygen should not build search engine, it's
 | 
			
		||||
	  awful in embedded redmine
 | 
			
		||||
 | 
			
		||||
2015-11-04 06:27  marc
 | 
			
		||||
 | 
			
		||||
	* debian/control.in: update dependencies
 | 
			
		||||
 | 
			
		||||
2015-11-03 23:05  marc
 | 
			
		||||
 | 
			
		||||
	* debian/control.in: set section
 | 
			
		||||
 | 
			
		||||
2015-11-03 22:05  marc
 | 
			
		||||
 | 
			
		||||
	* AUTHORS: AUTHOR updated to new homepage
 | 
			
		||||
 | 
			
		||||
2015-11-03 14:33  marc
 | 
			
		||||
 | 
			
		||||
	* ChangeLog, ax_check_qt.m4, ax_init_standard_project.m4,
 | 
			
		||||
	  bootstrap.sh, resolve-debbuilddeps.sh: prepared for build in a
 | 
			
		||||
	  docker instance on jenkins
 | 
			
		||||
 | 
			
		||||
2015-10-09 15:02  marc
 | 
			
		||||
 | 
			
		||||
	* src/certman.hxx: typo
 | 
			
		||||
 
 | 
			
		||||
@@ -90,16 +90,19 @@ AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [
 | 
			
		||||
  fi
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
# Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS
 | 
			
		||||
# Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS and a
 | 
			
		||||
# notz only a @name@ replacement, but also a @name_ENCODED@ one to be
 | 
			
		||||
# used in code.
 | 
			
		||||
#  - parameters:
 | 
			
		||||
#     $1 = variable name
 | 
			
		||||
AC_DEFUN([AX_SUBST], [
 | 
			
		||||
  [$1]_ENCODED=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
 | 
			
		||||
  [$1]_ENCODED=${[$1]_ENCODED//\"/\\\"}
 | 
			
		||||
  [$1]_ENCODED=${[$1]_ENCODED//\'/\'\"\'\"\'}
 | 
			
		||||
  [$1]_ENCODED=${[$1]_ENCODED//#/\\#}
 | 
			
		||||
  AM_CPPFLAGS+=" '-D$1=\"${[$1]_ENCODED}\"'"
 | 
			
		||||
  AC_SUBST([$1])
 | 
			
		||||
  tmp_var=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
 | 
			
		||||
  tmp_var=${tmp_var//\"/\\\"}
 | 
			
		||||
  tmp_var=${tmp_var//\'/\'\"\'\"\'}
 | 
			
		||||
  tmp_var=${tmp_var//#/\\#}
 | 
			
		||||
  AM_CPPFLAGS+=" '-D$1=\"${tmp_var}\"'"
 | 
			
		||||
  AC_SUBST([$1]_ENCODED)
 | 
			
		||||
  AC_SUBST(AM_CPPFLAGS)
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
@@ -167,14 +170,18 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
 | 
			
		||||
  AX_SUBST(BUILD_NUMBER)
 | 
			
		||||
  BUILD_DATE=$(LANG= date +"%a, %d %b %Y %H:%M:%S %z")
 | 
			
		||||
  AX_SUBST(BUILD_DATE)
 | 
			
		||||
  if test -f "${PROJECT_NAME}-logo.png"; then
 | 
			
		||||
     PROJECT_LOGO="${PROJECT_NAME}-logo.png"
 | 
			
		||||
  if test -f "${PACKAGE_NAME}.desktop.in"; then
 | 
			
		||||
     PACKAGE_DESKTOP="${PACKAGE_NAME}.desktop"
 | 
			
		||||
  fi
 | 
			
		||||
  AX_SUBST(PROJECT_LOGO)
 | 
			
		||||
  if test -f "${PROJECT_NAME}-icon.png"; then
 | 
			
		||||
     PROJECT_ICON="${PROJECT_NAME}-icon.png"
 | 
			
		||||
  AX_SUBST(PACKAGE_DESKTOP)
 | 
			
		||||
  if test -f "${PACKAGE_NAME}-logo.png"; then
 | 
			
		||||
     PACKAGE_LOGO="${PACKAGE_NAME}-logo.png"
 | 
			
		||||
  fi
 | 
			
		||||
  AX_SUBST(PROJECT_ICON)
 | 
			
		||||
  AX_SUBST(PACKAGE_LOGO)
 | 
			
		||||
  if test -f "${PACKAGE_NAME}-icon.png"; then
 | 
			
		||||
     PACKAGE_ICON="${PACKAGE_NAME}-icon.png"
 | 
			
		||||
  fi
 | 
			
		||||
  AX_SUBST(PACKAGE_ICON)
 | 
			
		||||
 | 
			
		||||
  AC_ARG_ENABLE(pedantic,
 | 
			
		||||
    [AS_HELP_STRING([--enable-pedantic],
 | 
			
		||||
@@ -204,6 +211,10 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
 | 
			
		||||
    AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG"
 | 
			
		||||
  fi
 | 
			
		||||
  
 | 
			
		||||
  if test -f ${PACKAGE_NAME}.desktop.in; then
 | 
			
		||||
    AC_CONFIG_FILES([${PACKAGE_NAME}.desktop])
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  AC_CONFIG_FILES([makefile])
 | 
			
		||||
  AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in])
 | 
			
		||||
  AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-standard-project-targets], [makefile.in])
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								bootstrap.sh
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								bootstrap.sh
									
									
									
									
									
								
							@@ -110,12 +110,15 @@ GENERATED FILES
 | 
			
		||||
    * resolve-rpmbuilddeps.sh - script to install RPM package dependencies
 | 
			
		||||
    * build-in-docker.sh - script to build the project encapsulated in a docker container
 | 
			
		||||
    * build-resource-file.sh - build resource.qrc file from a resource directory
 | 
			
		||||
    * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen
 | 
			
		||||
    * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle
 | 
			
		||||
    * test/runtests.sh - template file to run test scripts, i.e. docker based
 | 
			
		||||
    * AUTHORS - replace your name in AUTHORS before first run
 | 
			
		||||
    * NEWS - empty file add your project's news
 | 
			
		||||
    * README - add project description (first line is header, followed by an empty line)
 | 
			
		||||
    * configure.ac - global configuration file template
 | 
			
		||||
    * makefile.am - global makefile template
 | 
			
		||||
    * ${DEFAULT_PROJECT_NAME}.desktop.in - linux desktop file
 | 
			
		||||
    * src/makefile.am - if you enabled AX_USE_CXX
 | 
			
		||||
    * src/version.hxx - if you enabled AX_USE_CXX
 | 
			
		||||
    * src/version.cxx - if you enabled AX_USE_CXX
 | 
			
		||||
@@ -196,7 +199,7 @@ FILES
 | 
			
		||||
                  <ou can access the readme by calling
 | 
			
		||||
                  ${DEFAULT_PROJECT_NAME}::description().
 | 
			
		||||
  * ChangeLog:    Your changelog is automatically maintained from
 | 
			
		||||
                  subversion history, using svn2cl | subversion-tools. You don't need to
 | 
			
		||||
                  subversion history, using svn2cl. You don't need to
 | 
			
		||||
                  care about.
 | 
			
		||||
  * configure.ac: This file becomes very short and simple. You provide
 | 
			
		||||
                  the project name, the major and minor version. The
 | 
			
		||||
@@ -320,7 +323,7 @@ checkdir() {
 | 
			
		||||
 | 
			
		||||
checkfile() {
 | 
			
		||||
    exists=0
 | 
			
		||||
    if test -f "$1"; then
 | 
			
		||||
    if test -f "$1" -o -f "$1".in; then
 | 
			
		||||
        exists=1
 | 
			
		||||
    fi
 | 
			
		||||
    test $exists -eq 1
 | 
			
		||||
@@ -424,6 +427,7 @@ copy resolve-debbuilddeps.sh
 | 
			
		||||
copy resolve-rpmbuilddeps.sh
 | 
			
		||||
copy build-in-docker.sh
 | 
			
		||||
copy build-resource-file.sh
 | 
			
		||||
copy sql-to-dot.sed
 | 
			
		||||
copy mac-create-app-bundle.sh
 | 
			
		||||
AUTHOR=$(gpg -K  | sed -n 's,uid *,,p' | sort | head -1)
 | 
			
		||||
if test -z "${AUTHOR}"; then
 | 
			
		||||
@@ -703,10 +707,10 @@ namespace NAMESPACE {
 | 
			
		||||
    return README;
 | 
			
		||||
  }
 | 
			
		||||
  std::string logo() {
 | 
			
		||||
    return PROJECT_LOGO;
 | 
			
		||||
    return PACKAGE_LOGO;
 | 
			
		||||
  }
 | 
			
		||||
  std::string icon() {
 | 
			
		||||
    return PROJECT_ICON;
 | 
			
		||||
    return PACKAGE_ICON;
 | 
			
		||||
  }
 | 
			
		||||
  const std::string WHAT("#(@) " PACKAGE_STRING);
 | 
			
		||||
  const std::string IDENT("\$Id: " PACKAGE_STRING);
 | 
			
		||||
@@ -718,6 +722,7 @@ ${HEADER}dist_bin_SCRIPTS =
 | 
			
		||||
MAINTAINERCLEANFILES = makefile.in
 | 
			
		||||
EOF
 | 
			
		||||
echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_DOXYGEN doc/makefile.am
 | 
			
		||||
to --condition AX_BUILD_TEST test/runtests.sh < ${0%/*}/test/runtests.sh
 | 
			
		||||
to --condition 'AX_BUILD_TEST|AX_USE_CPPUNIT' test/makefile.am <<EOF
 | 
			
		||||
${HEADER}$(if testtag AX_USE_CXX; then
 | 
			
		||||
cat <<EOF2
 | 
			
		||||
@@ -761,7 +766,7 @@ if testtag AX_USE_DOXYGEN; then
 | 
			
		||||
        doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
 | 
			
		||||
        doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
 | 
			
		||||
        doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
 | 
			
		||||
        doxyreplace PROJECT_LOGO "@PROJECT_LOGO@"
 | 
			
		||||
        doxyreplace PROJECT_LOGO "@top_srcdir@/@PACKACE_LOGO@"
 | 
			
		||||
        doxyreplace INLINE_INHERITED_MEMB YES
 | 
			
		||||
        doxyreplace MULTILINE_CPP_IS_BRIEF YES
 | 
			
		||||
        doxyreplace TAB_SIZE 2
 | 
			
		||||
@@ -771,6 +776,7 @@ if testtag AX_USE_DOXYGEN; then
 | 
			
		||||
        doxyadd ALIASES '"classmutex=\\par Reentrant:\\nAccess is locked with class static mutex @c "'
 | 
			
		||||
        doxyadd ALIASES '"instancemutex=\\par Reentrant:\\nAccess is locked with per instance mutex @c "'
 | 
			
		||||
        doxyadd ALIASES '"mutex=\\par Reentrant:\\nAccess is locked with mutex @c "'
 | 
			
		||||
        doxyadd ALIASES '"api=\\xrefitem api \\"API Call\\" \\"\\""'
 | 
			
		||||
        doxyreplace ENABLE_PREPROCESSING YES
 | 
			
		||||
        doxyreplace MACRO_EXPANSION YES
 | 
			
		||||
        doxyadd PREDEFINED '"NAMESPACE=@PACKAGE_NAME@"'
 | 
			
		||||
@@ -797,14 +803,14 @@ if testtag AX_USE_DOXYGEN; then
 | 
			
		||||
        if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then
 | 
			
		||||
            doxyadd INPUT "@top_srcdir@/test"
 | 
			
		||||
        fi
 | 
			
		||||
        doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt'
 | 
			
		||||
        doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt *.sql'
 | 
			
		||||
        doxyreplace RECURSIVE YES
 | 
			
		||||
        doxyreplace EXCLUDE_PATTERNS "moc_* uic_* qrc_*"
 | 
			
		||||
        if testtag AX_BUILD_EXAMPLES; then
 | 
			
		||||
            doxyreplace EXAMPLE_PATH @top_srcdir@/examples
 | 
			
		||||
        fi
 | 
			
		||||
        doxyreplace EXAMPLE_RECURSIVE YES
 | 
			
		||||
        doxyreplace FILTER_PATTERNS '*.wt=doxygen-webtester.sed *.sql=@top_srcdir@/sql2dot.sed'
 | 
			
		||||
        doxyreplace FILTER_PATTERNS '*.wt=doxygen-webtester.sed *.sql=@top_srcdir@/sql-to-dot.sed'
 | 
			
		||||
        doxyreplace SOURCE_BROWSER YES
 | 
			
		||||
        doxyreplace INLINE_SOURCES YES
 | 
			
		||||
        doxyreplace GENERATE_TESTLIST YES
 | 
			
		||||
@@ -822,7 +828,7 @@ if testtag AX_USE_DOXYGEN; then
 | 
			
		||||
        doxyreplace CLASS_GRAPH YES
 | 
			
		||||
        doxyreplace TEMPLATE_RELATIONS YES
 | 
			
		||||
        doxyreplace DOT_IMAGE_FORMAT svg
 | 
			
		||||
        doxyreplace INTERACTIVE_SVG YES
 | 
			
		||||
        doxyreplace INTERACTIVE_SVG NO
 | 
			
		||||
        doxyreplace DOT_TRANSPARENT YES
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
@@ -882,6 +888,17 @@ ${HEADER}%:
 | 
			
		||||
EOF
 | 
			
		||||
    echo 7 | to debian/compat
 | 
			
		||||
fi
 | 
			
		||||
to ${PACKAGE_NAME}.desktop.in <<EOF
 | 
			
		||||
[Desktop Entry]
 | 
			
		||||
Type=Application
 | 
			
		||||
Name=${PACKAGE_NAME}
 | 
			
		||||
GenericName=${PACKAGE_NAME}
 | 
			
		||||
Comment=@DESCRIPTION@
 | 
			
		||||
Icon=@prefix@/share/@PACKAGE_NAME@/@PACKAGE_ICON@
 | 
			
		||||
Exec=${PACKAGE_NAME} %u
 | 
			
		||||
Terminal=false
 | 
			
		||||
Categories=Qt;Utility;
 | 
			
		||||
EOF
 | 
			
		||||
to --condition AX_USE_RPM_PACKAGING ${PACKAGE_NAME}.spec.in <<EOF
 | 
			
		||||
Summary: @DESCRIPTION@
 | 
			
		||||
Name: @PACKAGE_NAME@
 | 
			
		||||
@@ -955,6 +972,7 @@ $(if testtag AX_USE_LIBTOOL; then
 | 
			
		||||
echo '/usr/%_lib/@PACKAGE_NAME@.so.*'
 | 
			
		||||
else
 | 
			
		||||
echo '/usr/bin/*'
 | 
			
		||||
echo '/usr/share/applications/*'
 | 
			
		||||
fi)
 | 
			
		||||
%doc
 | 
			
		||||
$(if testtag AX_USE_LIBTOOL; then
 | 
			
		||||
@@ -1025,7 +1043,10 @@ done
 | 
			
		||||
to makefile.am<<EOF
 | 
			
		||||
${HEADER}SUBDIRS =${SUBDIRS}
 | 
			
		||||
 | 
			
		||||
doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
 | 
			
		||||
desktopdir = \${datadir}/applications
 | 
			
		||||
desktop_DATA = @PACKAGE_DESKTOP@
 | 
			
		||||
dist_pkgdata_DATA = @PACKAGE_ICON@
 | 
			
		||||
dist_doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
 | 
			
		||||
 | 
			
		||||
MAINTAINERCLEANFILES = makefile.in
 | 
			
		||||
EOF
 | 
			
		||||
@@ -1050,7 +1071,7 @@ if test -f makefile; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#### Bootstrap Before Configure ####
 | 
			
		||||
run --no-check svn2cl | subversion-tools
 | 
			
		||||
run --no-check svn2cl
 | 
			
		||||
run aclocal
 | 
			
		||||
if testtag AX_USE_LIBTOOL; then run libtoolize --force; fi
 | 
			
		||||
run automake -a
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,11 @@ docker exec ${DOCKER_ID} apt-add-repository universe
 | 
			
		||||
docker exec ${DOCKER_ID} apt-add-repository https://dev.marc.waeckerlin.org/repository
 | 
			
		||||
wget -O- https://dev.marc.waeckerlin.org/repository/PublicKey \
 | 
			
		||||
   | docker exec -i ${DOCKER_ID} apt-key add -
 | 
			
		||||
if test -n "$*"; then
 | 
			
		||||
    for p in $*; do
 | 
			
		||||
        docker exec ${DOCKER_ID} apt-add-repository $p
 | 
			
		||||
    done
 | 
			
		||||
fi
 | 
			
		||||
docker exec ${DOCKER_ID} apt-get update
 | 
			
		||||
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh
 | 
			
		||||
docker exec -u $(id -u) ${DOCKER_ID} svn upgrade || true
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								certman.desktop.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								certman.desktop.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
[Desktop Entry]
 | 
			
		||||
Type=Application
 | 
			
		||||
Name=certman
 | 
			
		||||
GenericName=certman
 | 
			
		||||
Comment=@DESCRIPTION@
 | 
			
		||||
Icon=@prefix@/share/@PACKAGE_NAME@/@PACKAGE_ICON@
 | 
			
		||||
Exec=certman %u
 | 
			
		||||
Terminal=false
 | 
			
		||||
Categories=Qt;Utility;
 | 
			
		||||
							
								
								
									
										81
									
								
								sql-to-dot.sed
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										81
									
								
								sql-to-dot.sed
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
#! /bin/sed -nf
 | 
			
		||||
1i\
 | 
			
		||||
/** @page database Database Schema\
 | 
			
		||||
\
 | 
			
		||||
@dot\
 | 
			
		||||
digraph schema {
 | 
			
		||||
 | 
			
		||||
# get everithing on one single line
 | 
			
		||||
H;$!d;$x
 | 
			
		||||
 | 
			
		||||
# remove all single-line comment lines
 | 
			
		||||
s/\n--[^\n]*//g
 | 
			
		||||
 | 
			
		||||
# reduce spaces
 | 
			
		||||
s,\t\| \+, ,g
 | 
			
		||||
 | 
			
		||||
# remove multiline comments
 | 
			
		||||
:f;s,\(.*\)/\*.*\*/[ \n]*;*,\1,g;tf
 | 
			
		||||
 | 
			
		||||
# remove empty lines
 | 
			
		||||
s,\n\+,\n,g
 | 
			
		||||
 | 
			
		||||
# remove unknown commands
 | 
			
		||||
s,\(;\|\n\) *\(DELIMITER\|USE\|DROP\|CREATE[ \n]\+DATABASE\)[ \n]\+[^;]*;\+,,ig
 | 
			
		||||
 | 
			
		||||
# convert special characters within quotes
 | 
			
		||||
:a;s/^\(\([^"]*"[^",]*"\)*[^"]*"[^"]*\),\([^"]*".*\)/\1\##COMMA##\3/g;ta
 | 
			
		||||
:c;s/^\(\([^']*'[^',]*'\)*[^']*'[^']*\),\([^']*'.*\)/\1\##COMMA##\3/g;tc
 | 
			
		||||
 | 
			
		||||
# backup everything to the buffer
 | 
			
		||||
# then analyze only on one create table
 | 
			
		||||
:i
 | 
			
		||||
h
 | 
			
		||||
s,.*\(create[ \n]\+table[^;]*;\).*,\1,ig
 | 
			
		||||
 | 
			
		||||
# start html table node
 | 
			
		||||
s|CREATE[ \n]\+TABLE[ \n]\+\(if[ \n]\+not[ \n]\+exists[ \n]\+\)\?`\?\(\w\+\)`\?|    \2\n        [shape=none, margin=0, label=<\n            <table bgcolor="#dddddd">\n                <tr><td bgcolor="#ddddff" colspan="4"><b>\2</b></td></tr>|ig
 | 
			
		||||
 | 
			
		||||
# remove key definitions
 | 
			
		||||
s/[),][\n ]*\(PRIMARY[ \n]\+\)\?KEY[ \n]\+[^(]*([^)]*)//gi
 | 
			
		||||
 | 
			
		||||
# move foreign keys as relation to the end
 | 
			
		||||
:b;s/\(\w\+\)\([^;]*\)FOREIGN[\n ]\+KEY[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*REFERENCES[ \n]*`\?\([a-z]\+\)`\?[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*\([^,)]*\)\([,)].*\)/\1\2\7\n \1:\3 -> \4:\5 [label="\6"]##SEMICOLON##/ig;tb
 | 
			
		||||
 | 
			
		||||
# create table rows
 | 
			
		||||
s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)[ \n]\+COMMENT[ \n]*["']\([^"']*\)["'][ \n]*|\n                <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td><td align="left">\5</td></tr>|gi
 | 
			
		||||
s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n                <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td></tr>|g
 | 
			
		||||
 | 
			
		||||
# add line breaks for long lines
 | 
			
		||||
s|\(<td[^>]*>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g
 | 
			
		||||
#:d;s|\(<br/>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g;td
 | 
			
		||||
 | 
			
		||||
# add table comment below
 | 
			
		||||
:k;tk
 | 
			
		||||
s|[ \n]*)[^)]*COMMENT[ \n]*=[ \n]*["']\?\([^"']*\)["']\?[^;]*|\n                <tr><td bgcolor="#ddddff" colspan="4">\1</td></tr>|ig;th
 | 
			
		||||
s|)[^);]*;|\n;|ig
 | 
			
		||||
:h
 | 
			
		||||
 | 
			
		||||
# cleanup comment below, add line breaksfor long lines
 | 
			
		||||
s|\(<td[^>]*>[^<]\{60,80\}\)[ \n]\+\([^<]\{30,\}</td>\)|\1<br/>\2|g
 | 
			
		||||
#:e;s|\(<br/>[^<]\{60,80\}\)[ \n]\+\([^<]\{30,\}</td>\)|\1<br/>\2|g;te
 | 
			
		||||
 | 
			
		||||
# close table
 | 
			
		||||
s|;|\n            </table>\n        >];|ig
 | 
			
		||||
 | 
			
		||||
# convert ##COMMA## to ,
 | 
			
		||||
s|##COMMA##|,|g
 | 
			
		||||
# convert ##SEMICOLON## to ;
 | 
			
		||||
s,##SEMICOLON##,;,g
 | 
			
		||||
 | 
			
		||||
# print one table
 | 
			
		||||
p
 | 
			
		||||
# get buffer back and remove the table that has just been analyzed
 | 
			
		||||
x
 | 
			
		||||
s,\(.*\)create[ \n]\+table[^;]*;\(.*\),\1\2,ig
 | 
			
		||||
ti
 | 
			
		||||
 | 
			
		||||
$a\
 | 
			
		||||
}\
 | 
			
		||||
@enddot\
 | 
			
		||||
*/
 | 
			
		||||
		Reference in New Issue
	
	Block a user