aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-14 10:39:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-14 10:39:14 +0200
commitac55a7a0a89fe9a1f39e33ee3445b644c68fa0c1 (patch)
tree8ef1ecfddf4b807209921f4c7a3c28fab77781b4
parent9d2ea69cfd7e71d0dfbc082ccc9a2d877f5451d5 (diff)
Further work on build2 build, support for non-static plugin on Windows
-rw-r--r--build/root.build8
-rw-r--r--buildfile2
-rw-r--r--doc/.gitignore4
-rw-r--r--doc/makefile11
-rw-r--r--odb/buildfile50
-rw-r--r--odb/generator.cxx5
-rw-r--r--odb/odb.cxx38
-rw-r--r--odb/plugin.cxx10
-rw-r--r--odb/semantics/relational/changelog.cxx2
-rw-r--r--odb/semantics/relational/column.cxx4
-rw-r--r--odb/semantics/relational/elements.hxx6
-rw-r--r--odb/semantics/relational/elements.txx2
-rw-r--r--odb/semantics/relational/foreign-key.cxx6
-rw-r--r--odb/semantics/relational/index.cxx2
-rw-r--r--odb/semantics/relational/key.cxx4
-rw-r--r--odb/semantics/relational/table.cxx2
16 files changed, 124 insertions, 32 deletions
diff --git a/build/root.build b/build/root.build
index f57ba41..c16a87f 100644
--- a/build/root.build
+++ b/build/root.build
@@ -13,6 +13,14 @@ cxx{*}: extension = cxx
cxx.poptions =+ "-I$out_root" "-I$src_root"
+# Load the cli module but only if it's available. This way a distribution
+# that includes pre-generated files can be built without installing cli.
+# This is also the reason why we need to explicitly spell out individual
+# source file prerequisites instead of using the cli.cxx{} group (it won't
+# be there unless the module is configured).
+#
+using? cli
+
# Specify the test target for cross-testing.
#
test.target = $cxx.target
diff --git a/buildfile b/buildfile
index 9af976f..21a7db8 100644
--- a/buildfile
+++ b/buildfile
@@ -2,7 +2,7 @@
# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
# license : GNU GPL v3; see accompanying LICENSE file
-./: {*/ -odb/ -build/ -m4/} doc{GPLv3 INSTALL LICENSE NEWS README version} \
+./: {*/ -build/ -m4/} doc{GPLv3 INSTALL LICENSE NEWS README version} \
file{manifest}
# Don't install the INSTALL file.
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..5accfef
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,4 @@
+odb.xhtml
+odb.1
+*.ps
+*.pdf
diff --git a/doc/makefile b/doc/makefile
index 2f158b0..a05dc96 100644
--- a/doc/makefile
+++ b/doc/makefile
@@ -77,16 +77,5 @@ $(clean):
$(call message,rm $$1,rm -f $$1,$(out_base)/odb-manual.ps)
$(call message,rm $$1,rm -f $$1,$(out_base)/odb-manual.pdf)
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(out_base)/odb.xhtml $(out_base)/odb.1: | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := odb.1 odb.xhtml odb-manual.ps odb-manual.pdf
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
$(call include,$(bld_root)/dist.make)
$(call include,$(bld_root)/meta/automake.make)
diff --git a/odb/buildfile b/odb/buildfile
new file mode 100644
index 0000000..e7e3f45
--- /dev/null
+++ b/odb/buildfile
@@ -0,0 +1,50 @@
+# file : odb/buildfile
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v3; see accompanying LICENSE file
+
+define plugin: libs
+plugin{*}: bin.lib.prefix = # No lib prefix.
+plugin{*}: install = # @@ TODO
+
+import libs = libcutl%lib{cutl}
+import libs += libstudxml%lib{studxml}
+
+plugin_dir = $config.odb.plugin_dir
+
+./: exe{odb} plugin{odb}
+
+exe{odb}: cxx{odb}
+exe{odb}: libus{odb}: bin.whole = false
+
+plugin{odb}: libus{odb}
+
+if ($cxx.target.system == 'mingw32')
+ plugin{odb}: $plugin_dir/liba{cc1plus.exe.a}
+
+libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs
+
+cxx.poptions += -DODB_BUILD2 # @@ TMP while supporting other build systems.
+
+
+# Don't install any of the plugin's headers.
+#
+{hxx ixx txx}{*}: install = false
+
+# Generated options parser.
+#
+if $cli.configured
+{
+ cli.cxx{options}: cli{options}
+
+ cli.options += --include-with-brackets --include-prefix odb \
+--guard-prefix ODB --generate-file-scanner --generate-specifier \
+--generate-modifier --generate-description --suppress-undocumented \
+--cxx-prologue '#include <odb/option-parsers.hxx>'
+
+ # Include the generated cli files into the distribution and don't remove
+ # them when cleaning in src (so that clean results in a state identical to
+ # distributed).
+ #
+ cli.cxx{*}: dist = true
+ cli.cxx{*}: clean = ($src_root != $out_root)
+}
diff --git a/odb/generator.cxx b/odb/generator.cxx
index bb8e12f..d1c88e9 100644
--- a/odb/generator.cxx
+++ b/odb/generator.cxx
@@ -16,8 +16,13 @@
#include <cutl/compiler/cxx-indenter.hxx>
#include <cutl/compiler/sloc-counter.hxx>
+#ifdef ODB_BUILD2
+#include <libstudxml/parser.hxx>
+#include <libstudxml/serializer.hxx>
+#else
#include <cutl/xml/parser.hxx>
#include <cutl/xml/serializer.hxx>
+#endif
#include <odb/version.hxx>
#include <odb/context.hxx>
diff --git a/odb/odb.cxx b/odb/odb.cxx
index bb4686f..d48e4d6 100644
--- a/odb/odb.cxx
+++ b/odb/odb.cxx
@@ -1471,12 +1471,27 @@ plugin_path (path const& drv,
string const&)
#endif
{
- // Figure out the plugin base name which is just the driver name.
- // If the driver name starts with 'lt-', then we are running through
- // the libtool script. Strip this prefix -- the shared object should
- // be in the same directory.
+#ifdef _WIN32
+ char const plugin_ext[] = ".dll";
+//@@ BUILD2: not clear how it works currently with build/autotools. Also
+// note that GCC currently uses the .so extension on Mac OS.
+//#elif defined(__APPLE__)
+// char const plugin_ext[] = ".dylib";
+#else
+ char const plugin_ext[] = ".so";
+#endif
+
+ // Figure out the plugin base name which is just the driver name (but
+ // without the .exe extension on Windows). If the driver name starts with
+ // 'lt-', then we are running through the libtool script. Strip this prefix
+ // -- the shared object should be in the same directory.
//
+#ifdef _WIN32
+ string b (drv.leaf ().base ().string ());
+#else
string b (drv.leaf ().string ());
+#endif
+
bool lt (b.size () > 3 && b[0] == 'l' && b[1] == 't' && b[2] == '-');
if (lt)
b = string (b, 3, string::npos);
@@ -1496,6 +1511,8 @@ plugin_path (path const& drv,
// the current directory for the .la file. This will make sure
// running ODB from the build directory works as expected.
//
+ // @@ BUILD2: not going to work for build2 build.
+ //
path pp (dp / path (b + ".la"));
if (stat (pp.string ().c_str (), &info) == 0)
{
@@ -1513,6 +1530,8 @@ plugin_path (path const& drv,
//
if (!lt)
{
+ //@@ BUILD2: if/when dropping old GCC should just get rid of this.
+#if 1
// First get the default GCC plugin directory.
//
path d;
@@ -1547,7 +1566,7 @@ plugin_path (path const& drv,
// See if the plugin is there.
//
- pp = d / path (b + ".so");
+ pp = d / path (b + plugin_ext);
if (stat (pp.string ().c_str (), &info) != 0)
{
cerr << drv << ": error: no ODB plugin in GCC plugin directory '" <<
@@ -1556,6 +1575,9 @@ plugin_path (path const& drv,
}
return pp;
+#else
+ return path (b);
+#endif
}
#elif defined (ODB_PLUGIN_PATH)
// If we were given a plugin path, use that unless we are running
@@ -1567,7 +1589,7 @@ plugin_path (path const& drv,
if (!rp.empty ())
dp /= path (rp);
- pp = dp / path (b + ".so");
+ pp = dp / path (b + plugin_ext);
if (stat (pp.string ().c_str (), &info) != 0)
{
@@ -1579,9 +1601,9 @@ plugin_path (path const& drv,
}
#endif
- // Try .so in the current directory.
+ // Try in the current directory.
//
- pp = dp / path (b + ".so");
+ pp = dp / path (b + plugin_ext);
if (stat (pp.string ().c_str (), &info) != 0)
{
cerr << drv << ": error: unable to locate ODB plugin" << endl;
diff --git a/odb/plugin.cxx b/odb/plugin.cxx
index c046c2f..c0fee9f 100644
--- a/odb/plugin.cxx
+++ b/odb/plugin.cxx
@@ -38,7 +38,11 @@ using cutl::fs::invalid_path;
typedef vector<path> paths;
+#if defined(_WIN32) && !defined(ODB_STATIC_PLUGIN)
+__declspec(dllexport)
+#endif
int plugin_is_GPL_compatible;
+
unique_ptr<options const> options_;
paths profile_paths_;
path file_; // File being compiled.
@@ -290,7 +294,11 @@ static char const* const odb_version = ODB_COMPILER_VERSION_STR;
typedef vector<string> strings;
-extern "C" int
+extern "C"
+#if defined(_WIN32) && !defined(ODB_STATIC_PLUGIN)
+__declspec(dllexport)
+#endif
+int
plugin_init (plugin_name_args* plugin_info, plugin_gcc_version*)
{
int r (0);
diff --git a/odb/semantics/relational/changelog.cxx b/odb/semantics/relational/changelog.cxx
index 591a2db..0db9dab 100644
--- a/odb/semantics/relational/changelog.cxx
+++ b/odb/semantics/relational/changelog.cxx
@@ -24,7 +24,7 @@ namespace semantics
using namespace xml;
p.next_expect (parser::start_element, xmlns, "changelog");
- p.content (parser::complex);
+ p.content (content::complex);
if (p.attribute<unsigned int> ("version") != 1)
throw parsing (p, "unsupported changelog format version");
diff --git a/odb/semantics/relational/column.cxx b/odb/semantics/relational/column.cxx
index 875ec6d..04ca6c9 100644
--- a/odb/semantics/relational/column.cxx
+++ b/odb/semantics/relational/column.cxx
@@ -30,7 +30,7 @@ namespace semantics
default__ (p.attribute ("default", string ())),
options_ (p.attribute ("options", string ()))
{
- p.content (xml::parser::empty);
+ p.content (xml::content::empty);
}
column& column::
@@ -84,7 +84,7 @@ namespace semantics
drop_column (xml::parser& p, uscope&, graph& g)
: unameable (p, g)
{
- p.content (xml::parser::empty);
+ p.content (xml::content::empty);
}
drop_column& drop_column::
diff --git a/odb/semantics/relational/elements.hxx b/odb/semantics/relational/elements.hxx
index 19cf6ff..b72bac0 100644
--- a/odb/semantics/relational/elements.hxx
+++ b/odb/semantics/relational/elements.hxx
@@ -15,8 +15,14 @@
#include <cutl/container/pointer-iterator.hxx>
#include <cutl/compiler/context.hxx>
+#ifdef ODB_BUILD2
+#include <libstudxml/parser.hxx>
+#include <libstudxml/serializer.hxx>
+#else
#include <cutl/xml/parser.hxx>
#include <cutl/xml/serializer.hxx>
+namespace cutl {namespace xml {typedef parser content;}}
+#endif
#include <odb/semantics/relational/name.hxx>
diff --git a/odb/semantics/relational/elements.txx b/odb/semantics/relational/elements.txx
index da8937e..f168b02 100644
--- a/odb/semantics/relational/elements.txx
+++ b/odb/semantics/relational/elements.txx
@@ -154,7 +154,7 @@ namespace semantics
g.new_edge<alters> (*this, *base);
using namespace xml;
- p.content (parser::complex);
+ p.content (content::complex);
for (parser::event_type e (p.peek ());
e == parser::start_element;
diff --git a/odb/semantics/relational/foreign-key.cxx b/odb/semantics/relational/foreign-key.cxx
index 472b18f..a75972a 100644
--- a/odb/semantics/relational/foreign-key.cxx
+++ b/odb/semantics/relational/foreign-key.cxx
@@ -67,7 +67,7 @@ namespace semantics
p.next_expect (parser::start_element, xmlns, "references");
referenced_table_ = p.attribute<qname> ("table");
- p.content (parser::complex);
+ p.content (content::complex);
for (parser::event_type e (p.peek ());
e == parser::start_element;
@@ -78,7 +78,7 @@ namespace semantics
p.next ();
referenced_columns_.push_back (p.attribute<uname> ("name"));
- p.content (parser::empty);
+ p.content (content::empty);
p.next_expect (parser::end_element);
}
@@ -156,7 +156,7 @@ namespace semantics
drop_foreign_key (xml::parser& p, uscope&, graph& g)
: unameable (p, g)
{
- p.content (xml::parser::empty);
+ p.content (xml::content::empty);
}
drop_foreign_key& drop_foreign_key::
diff --git a/odb/semantics/relational/index.cxx b/odb/semantics/relational/index.cxx
index f46459f..f479eee 100644
--- a/odb/semantics/relational/index.cxx
+++ b/odb/semantics/relational/index.cxx
@@ -83,7 +83,7 @@ namespace semantics
drop_index (xml::parser& p, uscope&, graph& g)
: unameable (p, g)
{
- p.content (xml::parser::empty);
+ p.content (xml::content::empty);
}
drop_index& drop_index::
diff --git a/odb/semantics/relational/key.cxx b/odb/semantics/relational/key.cxx
index 0f49820..bf83ef4 100644
--- a/odb/semantics/relational/key.cxx
+++ b/odb/semantics/relational/key.cxx
@@ -29,7 +29,7 @@ namespace semantics
: unameable (p, g)
{
using namespace xml;
- p.content (parser::complex);
+ p.content (content::complex);
for (parser::event_type e (p.peek ());
e == parser::start_element;
@@ -39,7 +39,7 @@ namespace semantics
break; // Not our elements.
p.next ();
- p.content (parser::empty);
+ p.content (content::empty);
uname n (p.attribute<uname> ("name"));
column* c (s.lookup<column, drop_column> (n));
diff --git a/odb/semantics/relational/table.cxx b/odb/semantics/relational/table.cxx
index 9851751..6675227 100644
--- a/odb/semantics/relational/table.cxx
+++ b/odb/semantics/relational/table.cxx
@@ -94,7 +94,7 @@ namespace semantics
drop_table (xml::parser& p, qscope&, graph& g)
: qnameable (p, g)
{
- p.content (xml::parser::empty);
+ p.content (xml::content::empty);
}
drop_table& drop_table::