~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to config/pandora-plugin

  • Committer: Lee Bieber
  • Date: 2011-01-19 00:14:08 UTC
  • mfrom: (2093.1.2 pandora-static-build)
  • mto: This revision was merged to the branch mainline in revision 2096.
  • Revision ID: kalebral@gmail.com-20110119001408-2sv68ld4uwt85fbw
Merge Monty - fix bug 583375: support configure option to specify static/dynamic build for a plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
#  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
#  Copyright (C) 2010, 2011 Monty Taylor
4
5
#
5
6
#  This program is free software; you can redistribute it and/or modify
6
7
#  it under the terms of the GNU General Public License as published by
243
244
    with_%(name)s_plugin="%(enabled)s"
244
245
    requested_%(name)s_plugin="no"
245
246
  ])
 
247
AC_ARG_WITH([static-%(name_with_dashes)s-plugin],[
 
248
AS_HELP_STRING([--with-static-%(name_with_dashes)s-plugin],[Build Archive Storage Engine. @<:@default=%(static_yesno)s@:>@])
 
249
AS_HELP_STRING([--without-static-%(name_with_dashes)s-plugin],[Disable building Archive Storage Engine])
 
250
  ],[
 
251
    with_static_%(name)s_plugin=${withval}
 
252
  ],[
 
253
    with_static_%(name)s_plugin=%(static_yesno)s
 
254
])
 
255
AS_IF([test "x${with_static_%(name)s_plugin}" = "xyes" -o "x${with_all_static}" = "xyes"],[
 
256
  shared_%(name)s_plugin=no
 
257
  ],[
 
258
  shared_%(name)s_plugin=yes
 
259
])
246
260
AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[
247
261
dnl indented wierd to make the help output correct
248
262
AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Enable loading %(title)s by default. @<:@default=%(default_yesno)s@:>@])
272
286
""" % plugin)
273
287
  if not plugin['unconditional']:
274
288
    plugin_ac.write("""
 
289
AM_CONDITIONAL([%(static_build_conditional_tag)s],
 
290
               [test %(build_conditional)s -a ! %(shared_build)s])
 
291
AM_CONDITIONAL([%(shared_build_conditional_tag)s],
 
292
               [test %(build_conditional)s -a %(shared_build)s])
275
293
AM_CONDITIONAL([%(build_conditional_tag)s],
276
294
               [test %(build_conditional)s])
277
295
    """ % plugin)
278
296
 
279
297
  plugin_ac.write("""
280
 
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],
281
 
    [
 
298
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[
282
299
""" % plugin)
283
300
  if plugin['testsuite']:
284
301
    plugin_ac.write("""
285
302
      pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}"
286
303
    """ % plugin)
287
 
  if plugin['static']:
288
 
    plugin_ac.write("""
 
304
  plugin_ac.write("""
 
305
      AS_IF([test "x${with_static_%(name)s_plugin}" = "xyes" -o "x${with_all_static}" = "xyes"],[
 
306
 
289
307
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
290
308
          pandora_builtin_load_list="%(module_name)s,${pandora_builtin_load_list}"
291
309
          pandora_builtin_load_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_load_symbols_list}"
294
312
        pandora_builtin_list="%(module_name)s,${pandora_builtin_list}"
295
313
        pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}"
296
314
        pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la"
297
 
    """ % plugin)
298
 
 
299
 
  else:
300
 
    plugin_ac.write("""
 
315
     ],[
301
316
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
302
317
          pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}"
303
318
        ])
 
319
    ])
304
320
    """ % plugin)
305
 
  plugin_ac.write("      ])\n")
 
321
  plugin_ac.write("])\n")
306
322
 
307
323
def fix_file_paths(plugin, files):
308
324
  # TODO: determine path to plugin dir relative to top_srcdir... append it to
347
363
      plugin['extra_dist']=" ".join([os.path.join(plugin['rel_path'],f) for f in plugin['extra_dist'].split()])
348
364
 
349
365
 
 
366
    if plugin['static']:
 
367
      plugin['static_yesno']="yes"
 
368
    else:
 
369
      plugin['static_yesno']="no"
350
370
    plugin['build_conditional_tag']= "BUILD_%s_PLUGIN" % plugin['name'].upper()
 
371
    plugin['shared_build_conditional_tag']= "BUILD_%s_PLUGIN_SHARED" % plugin['name'].upper()
 
372
    plugin['static_build_conditional_tag']= "BUILD_%s_PLUGIN_STATIC" % plugin['name'].upper()
351
373
    plugin['name_with_dashes']= plugin['name'].replace('_','-')
352
374
    if plugin.has_key('build_conditional'):
353
375
      plugin['has_build_conditional']=True
355
377
    else:
356
378
      plugin['has_build_conditional']=False
357
379
      plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin
 
380
    plugin['shared_build']='"x${shared_%(name)s_plugin}" = "xyes"' %plugin
358
381
 
359
382
    if plugin['install']:
360
383
      plugin['library_type']= 'pkgplugin'
518
541
    plugin_am.write("EXTRA_DIST += %(rel_path)s/%(dist_testsuite)s\n" % plugin)
519
542
  if plugin['docs'] is not None:
520
543
    plugin_am.write("EXTRA_DIST += ${top_srcdir}/%(rel_path)s/docs/*.rst\n" % plugin)
521
 
  if plugin['static']:
522
 
    plugin_am.write("""
 
544
  plugin_am.write("""
523
545
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
524
 
EXTRA_DIST += %(rel_path)s/plugin.ini
525
 
if %(build_conditional_tag)s
 
546
# Include sources in EXTRA_DIST because we might not build this, but we
 
547
# still want the sources to wind up in a tarball
 
548
EXTRA_DIST += %(rel_path)s/plugin.ini %(sources)s
 
549
if %(static_build_conditional_tag)s
526
550
  noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
527
551
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
528
552
  %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
534
558
  check_PROGRAMS += %(tests)s
535
559
  PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la
536
560
endif
537
 
""" % plugin)
538
 
  else:
539
 
    plugin_am.write("""
540
 
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
541
561
EXTRA_DIST += %(rel_path)s/plugin.ini
542
 
if %(build_conditional_tag)s
 
562
if %(shared_build_conditional_tag)s
543
563
  %(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
544
564
  %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
545
565
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
662
682
if not os.path.exists("config/pandora-plugin.ac") or "write" in actions:
663
683
  plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac'))
664
684
  plugin_ac_file.write("dnl Generated file, run make to rebuild\n")
 
685
  plugin_ac_file.write("""
 
686
AC_ARG_WITH([all-static],[
 
687
AS_HELP_STRING([--with-all-static],[Link all plugins staticly into the server @<:@default=no@:>@])
 
688
],[
 
689
    with_all_static="$withval"
 
690
    ],[
 
691
    with_all_static=no
 
692
])
 
693
  """)
665
694
 
666
695
if os.path.exists("docs/plugins"):
667
696
  if not os.path.exists("docs/plugins/list.rst") or "write" in actions: