~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to config/pandora-plugin

  • Committer: Brian Aker
  • Date: 2010-10-27 21:00:49 UTC
  • mto: This revision was merged to the branch mainline in revision 1886.
  • Revision ID: brian@tangent.org-20101027210049-zfpgx2cfbrh8maq9
A couple of fixes to documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
 
#  Copyright (C) 2009 Sun Microsystems, Inc.
4
 
#  Copyright (C) 2010, 2011 Monty Taylor
 
3
#  Copyright (C) 2009 Sun Microsystems
5
4
#
6
5
#  This program is free software; you can redistribute it and/or modify
7
6
#  it under the terms of the GNU General Public License as published by
132
131
pkgplugindir=%(pkgplugindir)s
133
132
EXTRA_DIST = plugin.ini
134
133
 
135
 
noinst_HEADERS=
136
 
nobase_include_HEADERS=
137
 
nobase_pkginclude_HEADERS=
138
 
check_PROGRAMS=
139
 
noinst_LTLIBRARIES=
140
 
bin_PROGRAMS=
141
 
 
142
 
 
143
134
""" % plugin)
144
135
  if plugin['headers'] != "":
145
 
    plugin_file.write("noinst_HEADERS += %(headers)s\n" % plugin)
 
136
    plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin)
146
137
  if plugin['install_headers'] != "":
147
 
    plugin_file.write("nobase_pkginclude_HEADERS += %(install_headers)s\n" % plugin)
 
138
    plugin_file.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
148
139
  if plugin['testsuite']:
149
140
    if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
150
141
      plugin_file.write("EXTRA_DIST += %(testsuitedir)s\n" % plugin)
153
144
%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
154
145
%(libname)s_la_LIBADD=%(libs)s
155
146
%(libname)s_la_DEPENDENCIES=%(libs)s
156
 
%(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
 
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
157
148
%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
158
149
%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
159
150
%(libname)s_la_SOURCES=%(sources)s
245
236
    with_%(name)s_plugin="%(enabled)s"
246
237
    requested_%(name)s_plugin="no"
247
238
  ])
248
 
AC_ARG_WITH([static-%(name_with_dashes)s-plugin],[
249
 
AS_HELP_STRING([--with-static-%(name_with_dashes)s-plugin],[Build Archive Storage Engine. @<:@default=%(static_yesno)s@:>@])
250
 
AS_HELP_STRING([--without-static-%(name_with_dashes)s-plugin],[Disable building Archive Storage Engine])
251
 
  ],[
252
 
    with_static_%(name)s_plugin=${withval}
253
 
  ],[
254
 
    with_static_%(name)s_plugin=%(static_yesno)s
255
 
])
256
 
AS_IF([test "x${with_static_%(name)s_plugin}" = "xyes" -o "x${with_all_static}" = "xyes"],[
257
 
  shared_%(name)s_plugin=no
258
 
  ],[
259
 
  shared_%(name)s_plugin=yes
260
 
])
261
239
AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[
262
240
dnl indented wierd to make the help output correct
263
241
AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Enable loading %(title)s by default. @<:@default=%(default_yesno)s@:>@])
287
265
""" % plugin)
288
266
  if not plugin['unconditional']:
289
267
    plugin_ac.write("""
290
 
AM_CONDITIONAL([%(static_build_conditional_tag)s],
291
 
               [test %(build_conditional)s -a ! %(shared_build)s])
292
 
AM_CONDITIONAL([%(shared_build_conditional_tag)s],
293
 
               [test %(build_conditional)s -a %(shared_build)s])
294
268
AM_CONDITIONAL([%(build_conditional_tag)s],
295
269
               [test %(build_conditional)s])
296
270
    """ % plugin)
297
271
 
298
272
  plugin_ac.write("""
299
 
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[
 
273
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],
 
274
    [
300
275
""" % plugin)
301
276
  if plugin['testsuite']:
302
277
    plugin_ac.write("""
303
278
      pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}"
304
279
    """ % plugin)
305
 
  plugin_ac.write("""
306
 
      AS_IF([test "x${with_static_%(name)s_plugin}" = "xyes" -o "x${with_all_static}" = "xyes"],[
307
 
 
 
280
  if plugin['static']:
 
281
    plugin_ac.write("""
308
282
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
309
 
          pandora_builtin_load_list="%(module_name)s,${pandora_builtin_load_list}"
310
 
          pandora_builtin_load_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_load_symbols_list}"
 
283
          pandora_builtin_list="%(module_name)s,${pandora_builtin_list}"
 
284
          pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}"
 
285
          pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la"
311
286
          PANDORA_PLUGIN_DEP_LIBS="${PANDORA_PLUGIN_DEP_LIBS} %(plugin_dep_libs)s"
312
287
        ])
313
 
        pandora_builtin_list="%(module_name)s,${pandora_builtin_list}"
314
 
        pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}"
315
 
        pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la"
316
 
     ],[
 
288
    """ % plugin)
 
289
 
 
290
  else:
 
291
    plugin_ac.write("""
317
292
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
318
293
          pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}"
319
294
        ])
320
 
    ])
321
295
    """ % plugin)
322
 
  plugin_ac.write("])\n")
 
296
  plugin_ac.write("      ])\n")
323
297
 
324
298
def fix_file_paths(plugin, files):
325
299
  # TODO: determine path to plugin dir relative to top_srcdir... append it to
355
329
    plugin['tests']= fix_file_paths(plugin, plugin['tests'])
356
330
 
357
331
    # Make a yes/no version for autoconf help messages
358
 
    if plugin['load_by_default']:
 
332
    if plugin['load_by_default'] or plugin['static']:
359
333
      plugin['default_yesno']="yes"
360
334
    else:
361
335
      plugin['default_yesno']="no"
364
338
      plugin['extra_dist']=" ".join([os.path.join(plugin['rel_path'],f) for f in plugin['extra_dist'].split()])
365
339
 
366
340
 
367
 
    if plugin['static']:
368
 
      plugin['static_yesno']="yes"
369
 
    else:
370
 
      plugin['static_yesno']="no"
371
341
    plugin['build_conditional_tag']= "BUILD_%s_PLUGIN" % plugin['name'].upper()
372
 
    plugin['shared_build_conditional_tag']= "BUILD_%s_PLUGIN_SHARED" % plugin['name'].upper()
373
 
    plugin['static_build_conditional_tag']= "BUILD_%s_PLUGIN_STATIC" % plugin['name'].upper()
374
342
    plugin['name_with_dashes']= plugin['name'].replace('_','-')
375
343
    if plugin.has_key('build_conditional'):
376
344
      plugin['has_build_conditional']=True
378
346
    else:
379
347
      plugin['has_build_conditional']=False
380
348
      plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin
381
 
    plugin['shared_build']='"x${shared_%(name)s_plugin}" = "xyes"' %plugin
382
349
 
383
350
    if plugin['install']:
384
351
      plugin['library_type']= 'pkgplugin'
398
365
    return os.path.join(plugin_dir, "docs")
399
366
 
400
367
def read_plugin_ini(plugin_dir):
401
 
    sources_default=""
402
368
    if plugin_dir == ".":
403
369
      plugin_name="**OUT-OF-TREE**"
404
 
      module_name="**OUT-OF-TREE**"
405
370
    else:
406
 
      sources_default="%s.cc" % os.path.basename(plugin_dir)
 
371
      short_name=os.path.basename(plugin_dir)
407
372
      plugin_name = plugin_dir[plugin_dir.index(config['root_plugin_dir']) + len(config['root_plugin_dir']) + 1:]
408
373
      module_name = plugin_name.replace("/", config['module_name_separator']).replace("\\", config['module_name_separator'])
409
374
      plugin_name = plugin_name.replace("/", config['plugin_name_separator']).replace("\\", config['plugin_name_separator'])
410
375
 
411
376
 
412
377
    plugin_file= os.path.join(plugin_dir,config['plugin_ini_fname'])
413
 
    plugin_defaults= dict(sources=sources_default,
 
378
    plugin_defaults= dict(sources="%s.cc" % short_name,
414
379
                          headers="",
415
380
                          install_headers="",
416
381
                          cflags="",
534
499
  if plugin['headers'] != "":
535
500
    plugin_am.write("noinst_HEADERS += %(headers)s\n" % plugin)
536
501
  if plugin['install_headers'] != "":
537
 
    plugin_am.write("nobase_pkginclude_HEADERS += %(install_headers)s\n" % plugin)
 
502
    plugin_am.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
538
503
  if plugin['testsuite']:
539
504
    if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
540
505
      plugin_am.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin)
542
507
    plugin_am.write("EXTRA_DIST += %(rel_path)s/%(dist_testsuite)s\n" % plugin)
543
508
  if plugin['docs'] is not None:
544
509
    plugin_am.write("EXTRA_DIST += ${top_srcdir}/%(rel_path)s/docs/*.rst\n" % plugin)
545
 
  plugin_am.write("""
 
510
  if plugin['static']:
 
511
    plugin_am.write("""
546
512
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
547
 
# Include sources in EXTRA_DIST because we might not build this, but we
548
 
# still want the sources to wind up in a tarball
549
 
EXTRA_DIST += %(rel_path)s/plugin.ini %(sources)s
550
 
if %(static_build_conditional_tag)s
 
513
EXTRA_DIST += %(rel_path)s/plugin.ini
 
514
if %(build_conditional_tag)s
551
515
  noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
552
516
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
553
517
  %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
554
518
  %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=$(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
555
 
  %(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
 
519
  %(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
556
520
  %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
557
521
  %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
558
522
  %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
559
523
  check_PROGRAMS += %(tests)s
560
524
  PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la
561
525
endif
 
526
""" % plugin)
 
527
  else:
 
528
    plugin_am.write("""
 
529
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
562
530
EXTRA_DIST += %(rel_path)s/plugin.ini
563
 
if %(shared_build_conditional_tag)s
 
531
if %(build_conditional_tag)s
564
532
  %(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
565
533
  %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
566
534
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
567
535
  %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
568
 
  %(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
 
536
  %(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
569
537
  %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
570
538
  %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
571
539
  %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
683
651
if not os.path.exists("config/pandora-plugin.ac") or "write" in actions:
684
652
  plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac'))
685
653
  plugin_ac_file.write("dnl Generated file, run make to rebuild\n")
686
 
  plugin_ac_file.write("""
687
 
AC_ARG_WITH([all-static],[
688
 
AS_HELP_STRING([--with-all-static],[Link all plugins staticly into the server @<:@default=no@:>@])
689
 
],[
690
 
    with_all_static="$withval"
691
 
    ],[
692
 
    with_all_static=no
693
 
])
694
 
  """)
695
654
 
696
655
if os.path.exists("docs/plugins"):
697
656
  if not os.path.exists("docs/plugins/list.rst") or "write" in actions: