992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
1 |
#!/usr/bin/python
|
2 |
||
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
3 |
# Copyright (C) 2009 Sun Microsystems
|
4 |
#
|
|
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; version 2 of the License.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
17 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
18 |
pandora_plugin_file = 'config/pandora-plugin.ini' |
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
19 |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
20 |
# Find plugins in the tree and add them to the build system
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
21 |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
22 |
import ConfigParser, os, sys |
1241.10.1
by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build. |
23 |
import datetime, time |
1377.3.6
by Monty Taylor
Set the default plugin version for plugins not specifying a version to be |
24 |
import subprocess |
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
25 |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
26 |
plugin_am_file=None |
27 |
plugin_ac_file=None |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
28 |
plugin_doc_index=None |
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
29 |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
30 |
class ChangeProtectedFile(object): |
31 |
||
32 |
def __init__(self, fname): |
|
1192.3.11
by Monty Taylor
Fixed a few distcheck issues. |
33 |
self.bogus_file= False |
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
34 |
self.real_fname= fname |
35 |
self.new_fname= "%s.new" % fname |
|
1192.3.11
by Monty Taylor
Fixed a few distcheck issues. |
36 |
try: |
37 |
self.new_file= open(self.new_fname,'w+') |
|
38 |
except IOError: |
|
39 |
self.bogus_file= True |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
40 |
|
41 |
def write(self, text): |
|
1192.3.11
by Monty Taylor
Fixed a few distcheck issues. |
42 |
if not self.bogus_file: |
43 |
self.new_file.write(text) |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
44 |
|
45 |
# We've written all of this out into .new files, now we only copy them
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
46 |
# over the old ones if they are different, so that we don't cause
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
47 |
# unnecessary recompiles
|
48 |
def close(self): |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
49 |
"""Return True if the file had changed."""
|
1192.3.11
by Monty Taylor
Fixed a few distcheck issues. |
50 |
if self.bogus_file: |
51 |
return
|
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
52 |
self.new_file.seek(0) |
53 |
new_content = self.new_file.read() |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
54 |
self.new_file.close() |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
55 |
try: |
56 |
old_file = file(self.real_fname, 'r') |
|
57 |
old_content = old_file.read() |
|
58 |
old_file.close() |
|
59 |
except IOError: |
|
60 |
old_content = None |
|
61 |
if new_content != old_content: |
|
62 |
if old_content != None: |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
63 |
os.unlink(self.real_fname) |
64 |
os.rename(self.new_fname, self.real_fname) |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
65 |
return True |
66 |
else: |
|
67 |
try: |
|
68 |
os.unlink(self.new_fname) |
|
69 |
except: |
|
70 |
pass
|
|
71 |
||
72 |
||
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
73 |
def write_external_configure(plugin, plugin_file): |
74 |
"""Write the initial bits of the configure.ac file"""
|
|
75 |
if not os.path.exists('m4'): |
|
76 |
os.mkdir('m4') |
|
77 |
plugin_file.write(""" |
|
78 |
AC_PREREQ(2.59)dnl Minimum Autoconf version required.
|
|
79 |
AC_INIT([%(name)s],[%(version)s],[%(url)s]) |
|
80 |
AC_CONFIG_SRCDIR([%(main_source)s]) |
|
81 |
AC_CONFIG_AUX_DIR(config)
|
|
82 |
||
1241.9.5
by Monty Taylor
Fixed the plugin script to not bork plugin visibility. |
83 |
PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, require-cxx, force-gcc42,skip-visibility)
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
84 |
|
85 |
PANDORA_REQUIRE_LIBPROTOBUF
|
|
86 |
PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0])
|
|
87 |
PANDORA_REQUIRE_PROTOC
|
|
88 |
||
89 |
AC_LANG_PUSH(C++)
|
|
90 |
PANDORA_REQUIRE_PTHREAD
|
|
91 |
PANDORA_REQUIRE_LIBDL
|
|
92 |
AC_LANG_POP
|
|
93 |
||
94 |
PANDORA_USE_BETTER_MALLOC
|
|
95 |
||
96 |
PANDORA_DRIZZLE_BUILD
|
|
97 |
""" % plugin) |
|
98 |
||
99 |
write_plugin_ac(plugin, plugin_file) |
|
100 |
||
101 |
plugin_file.write(""" |
|
102 |
AC_CONFIG_FILES(Makefile)
|
|
103 |
||
104 |
AC_OUTPUT
|
|
105 |
||
106 |
echo "---"
|
|
107 |
echo "Configuration summary for $PACKAGE_NAME version $VERSION $PANDORA_RELEASE_COMMENT"
|
|
108 |
echo ""
|
|
109 |
echo " * Installation prefix: $prefix"
|
|
110 |
echo " * System type: $host_vendor-$host_os"
|
|
111 |
echo " * Host CPU: $host_cpu"
|
|
112 |
echo " * C Compiler: $CC_VERSION"
|
|
113 |
echo " * C++ Compiler: $CXX_VERSION"
|
|
114 |
echo " * Debug enabled: $with_debug"
|
|
115 |
echo " * Warnings as failure: $ac_cv_warnings_as_errors"
|
|
116 |
echo " * C++ cstdint location: $ac_cv_cxx_cstdint"
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
117 |
echo " * C++ hash_map location: $ac_cv_cxx_hash_map"
|
118 |
echo " * C++ hash namespace: $ac_cv_cxx_hash_namespace"
|
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
119 |
echo " * C++ shared_ptr namespace: $ac_cv_shared_ptr_namespace"
|
120 |
echo ""
|
|
121 |
echo "---"
|
|
122 |
||
123 |
""" % plugin) |
|
124 |
||
125 |
def write_external_makefile(plugin, plugin_file): |
|
126 |
||
127 |
plugin_file.write(""" |
|
128 |
ACLOCAL_AMFLAGS = -I m4 --force
|
|
129 |
VERSION=$(PANDORA_RELEASE_VERSION)
|
|
130 |
||
1273.23.1
by Monty Taylor
Merged in latest pandora-build changes. Install plugins in pkglibdir now |
131 |
pkgplugindir=%(pkgplugindir)s |
1241.9.3
by Monty Taylor
Fixed the out-of-tree plugin file generation. |
132 |
EXTRA_DIST = plugin.ini
|
1192.3.53
by Robert Collins
Build fixes from Robert. |
133 |
|
134 |
""" % plugin) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
135 |
if plugin['headers'] != "": |
136 |
plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin) |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
137 |
if plugin['install_headers'] != "": |
138 |
plugin_file.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
139 |
if plugin['testsuite']: |
140 |
if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "": |
|
1241.9.3
by Monty Taylor
Fixed the out-of-tree plugin file generation. |
141 |
plugin_file.write("EXTRA_DIST += %(testsuitedir)s\n" % plugin) |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
142 |
plugin_file.write(""" |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
143 |
pkgplugin_LTLIBRARIES=%(libname)s.la |
144 |
%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) |
|
145 |
%(libname)s_la_LIBADD=%(libs)s |
|
146 |
%(libname)s_la_DEPENDENCIES=%(libs)s |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
147 |
%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s %(cppflags)s |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
148 |
%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s |
149 |
%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s |
|
150 |
%(libname)s_la_SOURCES=%(sources)s |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
151 |
check_PROGRAMS += %(tests)s |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
152 |
""" % plugin) |
153 |
plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am') |
|
154 |
if os.path.exists(plugin_am_file): |
|
155 |
plugin_file.write('include %s\n' % plugin_am_file) |
|
156 |
||
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
157 |
def write_external_plugin(): |
158 |
"""Return True if the plugin had changed."""
|
|
159 |
plugin = read_plugin_ini('.') |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
160 |
expand_plugin_ini(plugin) |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
161 |
plugin_file = ChangeProtectedFile('configure.ac') |
162 |
write_external_configure(plugin, plugin_file) |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
163 |
result = plugin_file.close() |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
164 |
plugin_file = ChangeProtectedFile('Makefile.am') |
165 |
write_external_makefile(plugin, plugin_file) |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
166 |
# Write some stub configure.ac and Makefile.am files that include the above
|
167 |
result = plugin_file.close() or result |
|
168 |
return result |
|
169 |
||
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
170 |
def write_plugin(plugin, plugin_ini_list): |
171 |
# Since this function is recursive, make sure we're not already in it.
|
|
172 |
if plugin.has_key('writing_status'): |
|
173 |
if plugin['writing_status'] == 'done': |
|
174 |
return
|
|
175 |
else: |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
176 |
print "Dependency loop detected with %s" % plugin['name'] |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
177 |
exit(1) |
178 |
||
179 |
plugin['writing_status'] = 'dependencies' |
|
180 |
||
181 |
# Write all dependencies first to get around annoying automake bug
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
182 |
for dependency in plugin['dependency_list']: |
183 |
found = False |
|
184 |
for find_plugin in plugin_ini_list: |
|
185 |
if find_plugin['module_name'] == dependency: |
|
186 |
found = True |
|
187 |
write_plugin(find_plugin, plugin_ini_list) |
|
188 |
break
|
|
189 |
if found is False: |
|
190 |
print "Could not find dependency %s: %s" % (plugin['name'], dependency) |
|
191 |
exit(1) |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
192 |
|
1192.3.25
by Monty Taylor
It seems to work. |
193 |
write_plugin_ac(plugin, plugin_ac_file) |
194 |
write_plugin_am(plugin, plugin_am_file) |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
195 |
write_plugin_docs(plugin, plugin_doc_index) |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
196 |
plugin['writing_status'] = 'done' |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
197 |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
198 |
def write_plugin_docs(plugin, doc_index): |
199 |
if plugin['docs'] is not None and os.path.isdir("docs/plugins"): |
|
200 |
if not os.path.exists(os.path.join("docs/plugins",plugin["name"])): |
|
201 |
os.symlink(os.path.abspath(plugin["docs"]), os.path.join("docs/plugins",plugin["name"])) |
|
202 |
doc_index.write(""" |
|
1794.2.7
by Monty Taylor
Fixed a couple of options around make dist to make sure all the .rst files |
203 |
%(name)s/index""" % plugin) |
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
204 |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
205 |
def write_plugin_ac(plugin, plugin_ac): |
206 |
#
|
|
207 |
# Write plugin config instructions into plugin.ac file.
|
|
208 |
#
|
|
992.1.23
by Monty Taylor
New system now runs in parallel to old system. |
209 |
plugin_ac_file=os.path.join(plugin['rel_path'],'plugin.ac') |
210 |
plugin_m4_dir=os.path.join(plugin['rel_path'],'m4') |
|
211 |
plugin_m4_files=[] |
|
212 |
if os.path.exists(plugin_m4_dir) and os.path.isdir(plugin_m4_dir): |
|
213 |
for m4_file in os.listdir(plugin_m4_dir): |
|
214 |
if os.path.splitext(m4_file)[-1] == '.m4': |
|
215 |
plugin_m4_files.append(os.path.join(plugin['rel_path'], m4_file)) |
|
1192.3.25
by Monty Taylor
It seems to work. |
216 |
plugin_ac.write(""" |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
217 |
dnl Config for %(title)s |
992.1.23
by Monty Taylor
New system now runs in parallel to old system. |
218 |
""" % plugin) |
219 |
for m4_file in plugin_m4_files: |
|
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
220 |
plugin_ac.write('m4_sinclude([%s])\n' % m4_file) |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
221 |
plugin['plugin_dep_libs']=" ".join(["\${top_builddir}/%s" % f for f in plugin['libs'].split()]) |
222 |
||
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
223 |
plugin_ac.write(""" |
1022.2.4
by Monty Taylor
Fixed turning off plugins. |
224 |
AC_ARG_WITH([%(name_with_dashes)s-plugin],[ |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
225 |
dnl indented wierd to make the help output correct
|
1273.12.6
by Monty Taylor
Added support for disabling plugins |
226 |
AS_HELP_STRING([--with-%(name_with_dashes)s-plugin],[Build %(title)s. @<:@default=%(enabled)s@:>@]) |
1022.2.4
by Monty Taylor
Fixed turning off plugins. |
227 |
AS_HELP_STRING([--without-%(name_with_dashes)s-plugin],[Disable building %(title)s]) |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
228 |
],[
|
229 |
with_%(name)s_plugin="$withval" |
|
1273.23.6
by Monty Taylor
Need to be able to actually disable plugins in the build. |
230 |
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[ |
231 |
requested_%(name)s_plugin="yes" |
|
232 |
],[
|
|
233 |
requested_%(name)s_plugin="no" |
|
234 |
])
|
|
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
235 |
],[
|
1273.12.6
by Monty Taylor
Added support for disabling plugins |
236 |
with_%(name)s_plugin="%(enabled)s" |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
237 |
requested_%(name)s_plugin="no" |
238 |
])
|
|
239 |
AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[ |
|
240 |
dnl indented wierd to make the help output correct
|
|
1810.4.1
by Andrew Hutchings
Fix plugin --enable/disable messages |
241 |
AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Enable loading %(title)s by default. @<:@default=%(default_yesno)s@:>@]) |
242 |
AS_HELP_STRING([--disable-%(name_with_dashes)s-plugin],[Disable loading %(title)s by default.]) |
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
243 |
],
|
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
244 |
[enable_%(name)s_plugin="$enableval"], |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
245 |
[enable_%(name)s_plugin=%(default_yesno)s]) |
246 |
||
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
247 |
""" % plugin) |
248 |
if os.path.exists(plugin_ac_file): |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
249 |
plugin_ac.write('m4_sinclude([%s])\n' % plugin_ac_file) |
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
250 |
# The plugin author has specified some check to make to determine
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
251 |
# if the plugin can be built. If the plugin is turned on and this
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
252 |
# check fails, then configure should error out. If the plugin is not
|
253 |
# turned on, then the normal conditional build stuff should just let
|
|
254 |
# it silently not build
|
|
255 |
if plugin['has_build_conditional']: |
|
256 |
plugin_ac.write(""" |
|
997.2.5
by Monty Taylor
Merged up with trunk properly. |
257 |
AS_IF([test %(build_conditional)s], |
1166.1.1
by Monty Taylor
Fixed an accidental logic error that caused any plugin which was availble to be built to be automatically enabled/builtin. |
258 |
[], dnl build_conditional can only negate
|
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
259 |
[
|
260 |
AS_IF([test "x${requested_%(name)s_plugin}" = "xyes"], |
|
261 |
[AC_MSG_ERROR([Plugin %(name)s was explicitly requested, yet failed build dependency checks. Aborting!])]) |
|
262 |
with_%(name)s_plugin=no |
|
263 |
])
|
|
1192.3.53
by Robert Collins
Build fixes from Robert. |
264 |
|
265 |
""" % plugin) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
266 |
if not plugin['unconditional']: |
267 |
plugin_ac.write(""" |
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
268 |
AM_CONDITIONAL([%(build_conditional_tag)s], |
269 |
[test %(build_conditional)s]) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
270 |
""" % plugin) |
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
271 |
|
272 |
plugin_ac.write(""" |
|
992.1.21
by Monty Taylor
First pass at replacing plugin.m4. |
273 |
AS_IF([test "x$with_%(name)s_plugin" = "xyes"], |
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
274 |
[
|
1192.3.53
by Robert Collins
Build fixes from Robert. |
275 |
""" % plugin) |
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
276 |
if plugin['testsuite']: |
277 |
plugin_ac.write(""" |
|
278 |
pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}" |
|
279 |
""" % plugin) |
|
280 |
if plugin['static']: |
|
281 |
plugin_ac.write(""" |
|
282 |
AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[ |
|
1885.2.3
by Monty Taylor
Finalized the static/load_by_default split, supporting now an array of |
283 |
pandora_builtin_load_list="%(module_name)s,${pandora_builtin_load_list}" |
284 |
pandora_builtin_load_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_load_symbols_list}" |
|
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
285 |
PANDORA_PLUGIN_DEP_LIBS="${PANDORA_PLUGIN_DEP_LIBS} %(plugin_dep_libs)s" |
286 |
])
|
|
1885.2.3
by Monty Taylor
Finalized the static/load_by_default split, supporting now an array of |
287 |
pandora_builtin_list="%(module_name)s,${pandora_builtin_list}" |
288 |
pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}" |
|
1885.1.1
by Monty Taylor
Minor modification of earlier patch - I don't need to keep static tied to |
289 |
pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la" |
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
290 |
""" % plugin) |
1099.1.16
by Monty Taylor
Added support for conditionally building plugin's test suite if the plugin is built. |
291 |
|
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
292 |
else: |
1259.7.5
by Monty Taylor
Removed the apparent ability to disable builtin plugins. We don't actually support it |
293 |
plugin_ac.write(""" |
294 |
AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[ |
|
295 |
pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}" |
|
296 |
])
|
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
297 |
""" % plugin) |
1497.3.18
by Monty Taylor
Enables the disabling of a static plugin at compile time. Incidentally, |
298 |
plugin_ac.write(" ])\n") |
1093.9.13
by Monty Taylor
pandora-build v0.42 - Started splitting out plugin system into pandora-build |
299 |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
300 |
def fix_file_paths(plugin, files): |
301 |
# TODO: determine path to plugin dir relative to top_srcdir... append it to
|
|
302 |
# source files if they don't already have it
|
|
303 |
new_files="" |
|
304 |
if plugin['plugin_dir'] != ".": |
|
305 |
for file in files.split(): |
|
306 |
if not file.startswith(plugin['rel_path']): |
|
307 |
file= os.path.join(plugin['rel_path'], file) |
|
308 |
new_files= "%s %s" % (new_files, file) |
|
309 |
else: |
|
310 |
new_files= " ".join(plugin['sources'].split()) |
|
311 |
if new_files != "": |
|
312 |
return new_files |
|
313 |
return files |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
314 |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
315 |
def expand_plugin_ini(plugin): |
1273.23.15
by Monty Taylor
Put in error check for out of tree plugin builds. |
316 |
if plugin['name'] == "**OUT-OF-TREE**": |
317 |
print "Out of tree plugins require the name field to be specified in plugin.ini" |
|
318 |
sys.exit(1) |
|
319 |
||
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
320 |
if plugin['plugin_dir'] == ".": |
321 |
plugin['rel_path']= plugin['plugin_dir'] |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
322 |
plugin['unconditional']=True |
323 |
else: |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
324 |
plugin['rel_path']= plugin['plugin_dir'][len(config['top_srcdir'])+len(os.path.sep):] |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
325 |
plugin['unconditional']=False |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
326 |
|
327 |
plugin['sources']= fix_file_paths(plugin, plugin['sources']) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
328 |
plugin['main_source']= plugin['sources'].split()[0] |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
329 |
plugin['headers']= fix_file_paths(plugin, plugin['headers']) |
330 |
plugin['install_headers']= fix_file_paths(plugin, plugin['install_headers']) |
|
331 |
plugin['tests']= fix_file_paths(plugin, plugin['tests']) |
|
332 |
||
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
333 |
# Make a yes/no version for autoconf help messages
|
1879.2.1
by Monty Taylor
Stop static from implying load_by_default. They are two different things. |
334 |
if plugin['load_by_default']: |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
335 |
plugin['default_yesno']="yes" |
336 |
else: |
|
337 |
plugin['default_yesno']="no" |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
338 |
|
1716.1.1
by Monty Taylor
Added files to the tarball that should be there. Removed some that shouldn't |
339 |
if plugin.has_key('extra_dist'): |
340 |
plugin['extra_dist']=" ".join([os.path.join(plugin['rel_path'],f) for f in plugin['extra_dist'].split()]) |
|
341 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
342 |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
343 |
plugin['build_conditional_tag']= "BUILD_%s_PLUGIN" % plugin['name'].upper() |
344 |
plugin['name_with_dashes']= plugin['name'].replace('_','-') |
|
345 |
if plugin.has_key('build_conditional'): |
|
346 |
plugin['has_build_conditional']=True |
|
1273.12.6
by Monty Taylor
Added support for disabling plugins |
347 |
plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes" -a %(build_conditional)s' % plugin |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
348 |
else: |
349 |
plugin['has_build_conditional']=False |
|
350 |
plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
351 |
|
1273.23.9
by Monty Taylor
Merged in noinst fix for plugins. |
352 |
if plugin['install']: |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
353 |
plugin['library_type']= 'pkgplugin' |
1273.23.9
by Monty Taylor
Merged in noinst fix for plugins. |
354 |
else: |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
355 |
plugin['library_type']= 'noinst' |
1273.23.9
by Monty Taylor
Merged in noinst fix for plugins. |
356 |
|
1192.3.20
by Monty Taylor
Added the testsuite location finding code to support in-plugin-dir test suites. |
357 |
def find_testsuite(plugin_dir): |
358 |
for testdir in ['drizzle-tests','tests']: |
|
359 |
if os.path.isdir(os.path.join(plugin_dir,testdir)): |
|
360 |
return testdir |
|
361 |
if os.path.isdir(os.path.join('tests','suite',os.path.basename(plugin_dir))): |
|
362 |
return "" |
|
363 |
return None |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
364 |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
365 |
def find_docs(plugin_dir): |
366 |
if os.path.isfile(os.path.join(plugin_dir, "docs", "index.rst")): |
|
367 |
return os.path.join(plugin_dir, "docs") |
|
368 |
||
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
369 |
def read_plugin_ini(plugin_dir): |
1273.23.15
by Monty Taylor
Put in error check for out of tree plugin builds. |
370 |
if plugin_dir == ".": |
371 |
plugin_name="**OUT-OF-TREE**" |
|
372 |
else: |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
373 |
short_name=os.path.basename(plugin_dir) |
374 |
plugin_name = plugin_dir[plugin_dir.index(config['root_plugin_dir']) + len(config['root_plugin_dir']) + 1:] |
|
375 |
module_name = plugin_name.replace("/", config['module_name_separator']).replace("\\", config['module_name_separator']) |
|
376 |
plugin_name = plugin_name.replace("/", config['plugin_name_separator']).replace("\\", config['plugin_name_separator']) |
|
377 |
||
378 |
||
379 |
plugin_file= os.path.join(plugin_dir,config['plugin_ini_fname']) |
|
380 |
plugin_defaults= dict(sources="%s.cc" % short_name, |
|
1241.10.1
by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build. |
381 |
headers="", |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
382 |
install_headers="", |
1241.10.1
by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build. |
383 |
cflags="", |
384 |
cppflags="", |
|
385 |
cxxflags="", |
|
386 |
libs="", |
|
387 |
ldflags="", |
|
388 |
author="", |
|
389 |
title="", |
|
390 |
description="", |
|
391 |
license="PLUGIN_LICENSE_GPL", |
|
1273.23.15
by Monty Taylor
Put in error check for out of tree plugin builds. |
392 |
name=plugin_name, |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
393 |
module_name=module_name, |
394 |
load_by_default=config['default_load_by_default'], |
|
1273.12.6
by Monty Taylor
Added support for disabling plugins |
395 |
disabled="False", |
1273.23.9
by Monty Taylor
Merged in noinst fix for plugins. |
396 |
static="False", |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
397 |
dependencies="", |
398 |
dependency_aliases="", |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
399 |
tests="", |
400 |
install=config['default_install']) |
|
1241.10.1
by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build. |
401 |
parser=ConfigParser.ConfigParser(defaults= plugin_defaults) |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
402 |
parser.read(plugin_file) |
403 |
plugin=dict(parser.items('plugin')) |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
404 |
plugin['plugin_dir'] = plugin_dir |
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
405 |
if plugin_dir == '.': |
406 |
if not plugin.has_key('url'): |
|
407 |
print "External Plugins are required to specifiy a url" |
|
408 |
plugin['url']= 'http://launchpad.net/%(name)s' % plugin |
|
409 |
sys.exit(1) |
|
410 |
if plugin_dir == '.' and not plugin.has_key('version'): |
|
411 |
print "External Plugins are required to specifiy a version" |
|
412 |
sys.exit(1) |
|
1241.10.1
by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build. |
413 |
if not plugin.has_key('version'): |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
414 |
plugin['version'] = config['default_plugin_version'] |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
415 |
if plugin.has_key('load_by_default'): |
416 |
plugin['load_by_default']=parser.getboolean('plugin','load_by_default') |
|
1273.12.6
by Monty Taylor
Added support for disabling plugins |
417 |
if plugin.has_key('disabled'): |
418 |
plugin['disabled']=parser.getboolean('plugin','disabled') |
|
419 |
if plugin['disabled']: |
|
420 |
plugin['enabled']="no" |
|
421 |
else: |
|
422 |
plugin['enabled']="yes" |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
423 |
if plugin.has_key('static'): |
1861.3.3
by Monty Taylor
Add support platform conditional static plugins. |
424 |
try: |
425 |
plugin['static']= parser.getboolean('plugin','static') |
|
426 |
except: |
|
427 |
if plugin['static'][:5] == os.sys.platform[:5]: |
|
428 |
plugin['static']= True |
|
429 |
else: |
|
430 |
plugin['static']= False |
|
1273.23.9
by Monty Taylor
Merged in noinst fix for plugins. |
431 |
if plugin.has_key('install'): |
432 |
plugin['install']= parser.getboolean('plugin','install') |
|
1192.3.20
by Monty Taylor
Added the testsuite location finding code to support in-plugin-dir test suites. |
433 |
if plugin.has_key('testsuite'): |
434 |
if plugin['testsuite'] == 'disable': |
|
435 |
plugin['testsuite']= False |
|
1716.1.1
by Monty Taylor
Added files to the tarball that should be there. Removed some that shouldn't |
436 |
plugin['dist_testsuite']= find_testsuite(plugin_dir) |
1192.3.20
by Monty Taylor
Added the testsuite location finding code to support in-plugin-dir test suites. |
437 |
else: |
438 |
plugin_testsuite= find_testsuite(plugin_dir) |
|
439 |
plugin['testsuitedir']=plugin_testsuite |
|
440 |
if plugin_testsuite is not None: |
|
441 |
plugin['testsuite']=True |
|
442 |
else: |
|
443 |
plugin['testsuite']=False |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
444 |
plugin['docs']= find_docs(plugin_dir) |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
445 |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
446 |
plugin['cflags']+= ' ' + config['extra_cflags'] |
447 |
plugin['cppflags']+= ' ' + config['extra_cppflags'] |
|
448 |
plugin['cxxflags']+= ' ' + config['extra_cxxflags'] |
|
1273.23.1
by Monty Taylor
Merged in latest pandora-build changes. Install plugins in pkglibdir now |
449 |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
450 |
plugin['libname']= "lib%s%s%s" % (config['plugin_prefix'], |
451 |
plugin['name'], |
|
452 |
config['plugin_suffix']) |
|
453 |
if config['force_lowercase_libname']: |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
454 |
plugin['libname']= plugin['libname'].lower() |
455 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
456 |
plugin['root_plugin_dir']= config['root_plugin_dir'] |
457 |
plugin['plugin_prefix']= config['plugin_prefix'] |
|
458 |
plugin['plugin_suffix']= config['plugin_suffix'] |
|
459 |
plugin['pkgplugindir']= config['pkgplugindir'] |
|
1273.23.1
by Monty Taylor
Merged in latest pandora-build changes. Install plugins in pkglibdir now |
460 |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
461 |
# Dependencies must have a module but dependency aliases are simply added
|
462 |
# to the variable passed during compile.
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
463 |
plugin['dependency_list'] = plugin['dependencies'].split() |
464 |
dependency_aliases = plugin['dependency_aliases'].split() |
|
465 |
plugin['dependencies'] = ','.join(plugin['dependency_list'] + |
|
466 |
plugin['dependency_aliases'].split()) |
|
467 |
dependency_libs = ["%s/lib%s%s.la" % (config['root_plugin_dir'], |
|
468 |
dependency.lower().replace('::', '_'), |
|
469 |
config['plugin_suffix']) |
|
470 |
for dependency in plugin['dependency_list']] |
|
471 |
plugin['libs'] = " ".join(plugin['libs'].split() + dependency_libs); |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
472 |
|
473 |
# Libtool is going to expand:
|
|
474 |
# -DPANDORA_MODULE_AUTHOR='"Padraig O'"'"'Sullivan"'
|
|
475 |
# to:
|
|
476 |
# "-DPANDORA_MODULE_AUTHOR=\"Padraig O'Sullivan\""
|
|
477 |
# So we have to replace internal ''s to '"'"'
|
|
478 |
for key in ('author','title','description','version'): |
|
479 |
plugin[key]=plugin[key].replace('"','\\"') |
|
480 |
plugin[key]=plugin[key].replace("'","'\"'\"'") |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
481 |
return plugin |
482 |
||
483 |
||
484 |
def write_plugin_am(plugin, plugin_am): |
|
485 |
"""Write an automake fragment for this plugin.
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
486 |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
487 |
:param plugin: The plugin dict.
|
488 |
:param plugin_am: The file to write to.
|
|
489 |
"""
|
|
490 |
# The .plugin.ini.stamp avoids changing the datestamp on plugin.ini which can
|
|
491 |
# confuse VCS systems.
|
|
1192.3.25
by Monty Taylor
It seems to work. |
492 |
plugin_am.write(""" |
493 |
EXTRA_DIST += %(rel_path)s/plugin.ini |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
494 |
|
495 |
# Prevent errors when a plugin dir is removed
|
|
496 |
%(rel_path)s/plugin.ini: |
|
1192.3.53
by Robert Collins
Build fixes from Robert. |
497 |
|
498 |
""" % plugin) |
|
1716.1.1
by Monty Taylor
Added files to the tarball that should be there. Removed some that shouldn't |
499 |
if plugin.has_key('extra_dist') and plugin['extra_dist'] != "": |
500 |
plugin_am.write("EXTRA_DIST += %(extra_dist)s\n" % plugin) |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
501 |
if plugin['headers'] != "": |
502 |
plugin_am.write("noinst_HEADERS += %(headers)s\n" % plugin) |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
503 |
if plugin['install_headers'] != "": |
504 |
plugin_am.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin) |
|
1192.3.20
by Monty Taylor
Added the testsuite location finding code to support in-plugin-dir test suites. |
505 |
if plugin['testsuite']: |
506 |
if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "": |
|
507 |
plugin_am.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin) |
|
1716.1.1
by Monty Taylor
Added files to the tarball that should be there. Removed some that shouldn't |
508 |
if plugin.has_key('dist_testsuite') and plugin['dist_testsuite'] != "": |
509 |
plugin_am.write("EXTRA_DIST += %(rel_path)s/%(dist_testsuite)s\n" % plugin) |
|
1794.2.7
by Monty Taylor
Fixed a couple of options around make dist to make sure all the .rst files |
510 |
if plugin['docs'] is not None: |
511 |
plugin_am.write("EXTRA_DIST += ${top_srcdir}/%(rel_path)s/docs/*.rst\n" % plugin) |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
512 |
if plugin['static']: |
513 |
plugin_am.write(""" |
|
1273.23.1
by Monty Taylor
Merged in latest pandora-build changes. Install plugins in pkglibdir now |
514 |
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
515 |
EXTRA_DIST += %(rel_path)s/plugin.ini |
516 |
if %(build_conditional_tag)s |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
517 |
noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la |
518 |
%(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s |
|
519 |
%(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s |
|
520 |
%(root_plugin_dir)s_%(libname)s_la_LDFLAGS=$(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
521 |
%(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
522 |
%(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s |
523 |
%(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s |
|
524 |
%(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
525 |
check_PROGRAMS += %(tests)s |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
526 |
PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la |
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
527 |
endif
|
528 |
""" % plugin) |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
529 |
else: |
530 |
plugin_am.write(""" |
|
1273.23.1
by Monty Taylor
Merged in latest pandora-build changes. Install plugins in pkglibdir now |
531 |
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
532 |
EXTRA_DIST += %(rel_path)s/plugin.ini |
533 |
if %(build_conditional_tag)s |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
534 |
%(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la |
535 |
%(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) |
|
536 |
%(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s |
|
537 |
%(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
538 |
%(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
539 |
%(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s |
540 |
%(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s |
|
541 |
%(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
542 |
check_PROGRAMS += %(tests)s |
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
543 |
endif
|
544 |
""" % plugin) |
|
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
545 |
plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am') |
546 |
if os.path.exists(plugin_am_file): |
|
547 |
plugin_am.write('include %s\n' % plugin_am_file) |
|
548 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
549 |
#
|
550 |
# MAIN STARTS HERE:
|
|
551 |
#
|
|
552 |
||
553 |
# Parse the pandora-plugin config file
|
|
554 |
||
555 |
config_defaults= dict( |
|
556 |
top_srcdir='.', |
|
557 |
top_builddir='.', |
|
558 |
plugin_ini_fname='plugin.ini', |
|
559 |
plugin_prefix='', |
|
560 |
plugin_suffix='', |
|
561 |
extra_cflags='', |
|
562 |
extra_cppflags='', |
|
563 |
extra_cxxflags='', |
|
564 |
root_plugin_dir='', |
|
565 |
pkgplugindir='', |
|
566 |
default_install='True', |
|
567 |
default_plugin_version='', |
|
568 |
default_load_by_default='False', |
|
569 |
force_lowercase_libname='True', |
|
570 |
plugin_name_separator='_', |
|
571 |
module_name_separator='::' |
|
572 |
)
|
|
573 |
||
574 |
config_parser = ConfigParser.ConfigParser(defaults=config_defaults) |
|
575 |
config_parser.read(pandora_plugin_file) |
|
576 |
config = dict(config_parser.items('pandora-plugin')) |
|
577 |
config['force_lowercase_libname']=config_parser.getboolean('pandora-plugin','force_lowercase_libname') |
|
1192.3.25
by Monty Taylor
It seems to work. |
578 |
|
1377.3.8
by Monty Taylor
Let's not hardcode bzr. |
579 |
# I'm 3 seconds away from writing a comprehensive build solution
|
1377.3.7
by Monty Taylor
Read out the vcinfo file if it's there. |
580 |
if not os.path.exists('config/pandora_vc_revinfo'): |
1377.3.8
by Monty Taylor
Let's not hardcode bzr. |
581 |
if os.path.exists('.bzr'): |
582 |
bzr_revno= subprocess.Popen(["bzr", "revno"], stdout=subprocess.PIPE).communicate()[0].strip() |
|
583 |
rev_date= datetime.date.fromtimestamp(time.time()) |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
584 |
config['default_plugin_version'] = "%d.%02d.%s" % (rev_date.year, rev_date.month, bzr_revno) |
1377.3.8
by Monty Taylor
Let's not hardcode bzr. |
585 |
else: |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
586 |
config['default_plugin_version']=datetime.date.fromtimestamp(time.time()).isoformat() |
1377.3.6
by Monty Taylor
Set the default plugin version for plugins not specifying a version to be |
587 |
else: |
588 |
# need to read config/pandora_vc_revno
|
|
1377.3.7
by Monty Taylor
Read out the vcinfo file if it's there. |
589 |
pandora_vc_revno=open('config/pandora_vc_revinfo','r').read().split() |
590 |
rev_date="" |
|
591 |
bzr_revno="" |
|
592 |
for revno_line in pandora_vc_revno: |
|
593 |
(revno_key,revno_val)= revno_line.split("=") |
|
594 |
if revno_key == 'PANDORA_VC_REVNO': |
|
595 |
bzr_revno=revno_val.strip() |
|
596 |
elif revno_key == 'PANDORA_RELEASE_DATE': |
|
597 |
rev_date=revno_val.strip() |
|
598 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
599 |
config['default_plugin_version'] = "%s.%s" % (rev_date, bzr_revno) |
1377.3.7
by Monty Taylor
Read out the vcinfo file if it's there. |
600 |
|
1192.3.25
by Monty Taylor
It seems to work. |
601 |
actions=[] |
602 |
for arg in sys.argv: |
|
603 |
if arg.startswith('--top_srcdir='): |
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
604 |
config['top_srcdir']=arg[12:] |
1192.3.25
by Monty Taylor
It seems to work. |
605 |
elif arg.startswith('--top_builddir='): |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
606 |
config['top_builddir']=arg[14:] |
1192.3.25
by Monty Taylor
It seems to work. |
607 |
elif arg == "--force-all": |
608 |
actions=['plugin-list','pandora-plugin.am','write'] |
|
609 |
break
|
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
610 |
else: |
1192.3.25
by Monty Taylor
It seems to work. |
611 |
actions.append(arg) |
612 |
if len(actions) == 0: |
|
613 |
actions.append('write') |
|
614 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
615 |
plugin_list=[] |
616 |
||
1192.3.25
by Monty Taylor
It seems to work. |
617 |
def accumulate_plugins(arg, dirname, fnames): |
618 |
# plugin_ini_fname is a name in dirname indicating dirname is a plugin.
|
|
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
619 |
if config['plugin_ini_fname'] in fnames: |
1192.3.25
by Monty Taylor
It seems to work. |
620 |
arg.append(dirname) |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
621 |
|
622 |
os.path.walk(os.path.join(config['top_srcdir'], |
|
623 |
config['root_plugin_dir']), |
|
624 |
accumulate_plugins, |
|
625 |
plugin_list) |
|
1192.3.25
by Monty Taylor
It seems to work. |
626 |
|
627 |
if not os.path.exists("config/pandora-plugin.am") or "write" in actions: |
|
628 |
plugin_am_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.am')) |
|
629 |
plugin_am_file.write(""" |
|
630 |
# always the current list, generated every build so keep this lean.
|
|
1192.3.74
by Robert Collins
Finish the renaming of plugin.list -> pandora-plugin.list that mtaylor started. |
631 |
# pandora-plugin.list: datestamp preserved list
|
632 |
${srcdir}/config/pandora-plugin.list: .plugin.scan
|
|
1192.3.25
by Monty Taylor
It seems to work. |
633 |
.plugin.scan:
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
634 |
@cd ${top_srcdir} && python config/pandora-plugin plugin-list
|
1192.3.25
by Monty Taylor
It seems to work. |
635 |
|
636 |
# Plugins affect configure; so to prevent configure running twice in a tarball
|
|
637 |
# build (once up front, once with the right list of plugins, we ship the
|
|
638 |
# generated list of plugins and the housekeeping material for that list so it
|
|
639 |
# is likewise not updated.
|
|
640 |
EXTRA_DIST += \ |
|
641 |
config/pandora-plugin.am \ |
|
642 |
config/pandora-plugin.ac \ |
|
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
643 |
config/pandora-plugin \ |
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
644 |
config/pandora-plugin.ini
|
1192.3.25
by Monty Taylor
It seems to work. |
645 |
|
646 |
||
647 |
# Seed the list of plugin LDADDS which plugins may extend.
|
|
648 |
PANDORA_DYNAMIC_LDADDS=
|
|
649 |
||
650 |
# plugin.stamp: graph dominator for creating all per pandora-plugin.ac/am
|
|
651 |
# files. This is invoked when the code to generate such files has altered.""") |
|
652 |
||
653 |
if not os.path.exists("config/pandora-plugin.ac") or "write" in actions: |
|
654 |
plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac')) |
|
655 |
plugin_ac_file.write("dnl Generated file, run make to rebuild\n") |
|
656 |
||
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
657 |
if os.path.exists("docs/plugins"): |
658 |
if not os.path.exists("docs/plugins/list.rst") or "write" in actions: |
|
659 |
plugin_doc_index = ChangeProtectedFile("docs/plugins/list.rst") |
|
660 |
plugin_doc_index.write(""" |
|
661 |
Plugin Documentation
|
|
662 |
====================
|
|
663 |
||
664 |
.. toctree::
|
|
665 |
:maxdepth: 2
|
|
666 |
""") |
|
667 |
||
1192.4.1
by Robert Collins
Merged buildsystem change from lifeless. |
668 |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
669 |
if os.path.exists('plugin.ini'): |
670 |
# Are we in a plugin dir which wants to have a self-sufficient build system?
|
|
1192.3.25
by Monty Taylor
It seems to work. |
671 |
plugin_list=['.'] |
1241.9.3
by Monty Taylor
Fixed the out-of-tree plugin file generation. |
672 |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
673 |
write_external_plugin() |
674 |
else: |
|
1192.3.25
by Monty Taylor
It seems to work. |
675 |
plugin_list_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.list')) |
676 |
for p in plugin_list: |
|
677 |
plugin_list_file.write(p) |
|
678 |
plugin_list_file.write("\n") |
|
1192.3.7
by Monty Taylor
Added code necessary for building plugins dynamically. |
679 |
plugin_list.sort() |
1192.3.25
by Monty Taylor
It seems to work. |
680 |
plugin_list_file.close() |
681 |
||
682 |
if not os.path.exists("config/pandora-plugin.am") or 'write' in actions: |
|
1192.3.74
by Robert Collins
Finish the renaming of plugin.list -> pandora-plugin.list that mtaylor started. |
683 |
plugin_am_file.write("\n${top_srcdir}/config/pandora-plugin.am: ${top_srcdir}/config/pandora-plugin.list ${top_srcdir}/config/pandora-plugin ") |
1192.3.25
by Monty Taylor
It seems to work. |
684 |
for plugin_dir in plugin_list: |
685 |
plugin_am_file.write("\\\n\t%s/plugin.ini " % plugin_dir) |
|
1192.3.28
by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build |
686 |
plugin_am_file.write("\n\tcd ${top_srcdir} && python config/pandora-plugin write\n") |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
687 |
plugin_ini_list=[] |
688 |
||
689 |
# Load all plugin.ini files first so we can do dependency tracking.
|
|
1192.3.25
by Monty Taylor
It seems to work. |
690 |
for plugin_dir in plugin_list: |
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
691 |
plugin = read_plugin_ini(plugin_dir) |
692 |
expand_plugin_ini(plugin) |
|
693 |
plugin_ini_list.append(plugin) |
|
694 |
||
1497.3.15
by Monty Taylor
Merged in some stuff from pandora-build. |
695 |
# Check for duplicates
|
696 |
plugin_name_list = [plugin['libname'] for plugin in plugin_ini_list] |
|
697 |
for plugin in plugin_ini_list: |
|
698 |
if plugin_name_list.count(plugin['libname']) != 1: |
|
699 |
print "Duplicate module name %s" % plugin['libname'] |
|
700 |
exit(1) |
|
701 |
||
1471.3.1
by Monty Taylor
Latest pandora-build. Moves the lint check to only run distcheck. |
702 |
for plugin in plugin_ini_list: |
703 |
write_plugin(plugin, plugin_ini_list) |
|
1192.3.25
by Monty Taylor
It seems to work. |
704 |
|
705 |
if plugin_am_file is not None: |
|
706 |
plugin_am_file.close() |
|
707 |
if plugin_ac_file is not None: |
|
708 |
plugin_ac_file.close() |
|
1794.2.5
by Monty Taylor
Added support to pandora for finding and including per-plugin documentation. |
709 |
if plugin_doc_index is not None: |
710 |
plugin_doc_index.close() |