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'):
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
AC_CONFIG_HEADERS([config.h])
83
AC_CONFIG_MACRO_DIR([m4])
85
PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, require-cxx, force-gcc42)
87
PANDORA_REQUIRE_LIBPROTOBUF
88
PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0])
89
PANDORA_REQUIRE_PROTOC
92
PANDORA_REQUIRE_PTHREAD
96
PANDORA_USE_BETTER_MALLOC
101
write_plugin_ac(plugin, plugin_file)
103
plugin_file.write("""
104
AC_CONFIG_FILES(Makefile)
109
echo "Configuration summary for $PACKAGE_NAME version $VERSION $PANDORA_RELEASE_COMMENT"
111
echo " * Installation prefix: $prefix"
112
echo " * System type: $host_vendor-$host_os"
113
echo " * Host CPU: $host_cpu"
114
echo " * C Compiler: $CC_VERSION"
115
echo " * C++ Compiler: $CXX_VERSION"
116
echo " * Debug enabled: $with_debug"
117
echo " * Warnings as failure: $ac_cv_warnings_as_errors"
118
echo " * C++ cstdint location: $ac_cv_cxx_cstdint"
119
echo " * C++ hash_map location: $ac_cv_cxx_hash_map"
120
echo " * C++ hash namespace: $ac_cv_cxx_hash_namespace"
121
echo " * C++ shared_ptr namespace: $ac_cv_shared_ptr_namespace"
127
def write_external_makefile(plugin, plugin_file):
129
plugin_file.write("""
130
ACLOCAL_AMFLAGS = -I m4 --force
131
VERSION=$(PANDORA_RELEASE_VERSION)
133
pkgplugindir=$(libdir)/drizzle/plugin
134
EXTRA_DIST = %(rel_path)s/plugin.ini
136
if plugin['headers'] != "":
137
plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin)
138
if plugin['testsuite']:
139
if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
140
plugin_file.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin)
141
plugin_file.write("""
142
pkgplugin_LTLIBRARIES=lib%(name)s_plugin.la
143
lib%(name)s_plugin_la_LDFLAGS=-module -avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s
144
lib%(name)s_plugin_la_LIBADD=%(libs)s
145
lib%(name)s_plugin_la_DEPENDENCIES=%(libs)s
146
lib%(name)s_plugin_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(name)s %(cppflags)s
147
lib%(name)s_plugin_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
148
lib%(name)s_plugin_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
150
lib%(name)s_plugin_la_SOURCES=%(sources)s
152
plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am')
153
if os.path.exists(plugin_am_file):
154
plugin_file.write('include %s\n' % plugin_am_file)
73
156
def write_external_plugin():
74
157
"""Return True if the plugin had changed."""
75
158
plugin = read_plugin_ini('.')
76
159
expand_plugin_ini(plugin, '.')
77
plugin_file = ChangeProtectedFile('pandora-plugin.ac')
78
write_plugin_ac(plugin, plugin_file)
160
plugin_file = ChangeProtectedFile('configure.ac')
161
write_external_configure(plugin, plugin_file)
79
162
result = plugin_file.close()
80
plugin_file = ChangeProtectedFile('pandora-plugin.am')
81
write_plugin_am(plugin, plugin_file)
163
plugin_file = ChangeProtectedFile('Makefile.am')
164
write_external_makefile(plugin, plugin_file)
82
165
# Write some stub configure.ac and Makefile.am files that include the above
83
166
result = plugin_file.close() or result
205
297
parser=ConfigParser.ConfigParser(defaults=dict(sources="",headers="", cflags="",cppflags="",cxxflags="", libs="", ldflags=""))
206
298
parser.read(plugin_file)
207
299
plugin=dict(parser.items('plugin'))
208
plugin['name']= os.path.basename(plugin_dir)
300
if not plugin.has_key('name'):
301
plugin['name']= os.path.basename(plugin_dir)
302
if plugin_dir == '.':
303
if not plugin.has_key('url'):
304
print "External Plugins are required to specifiy a url"
305
plugin['url']= 'http://launchpad.net/%(name)s' % plugin
307
if plugin_dir == '.' and not plugin.has_key('version'):
308
print "External Plugins are required to specifiy a version"
209
311
if plugin.has_key('load_by_default'):
210
312
plugin['load_by_default']=parser.getboolean('plugin','load_by_default')