~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to config/pandora-plugin

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
 
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
131
132
pkgplugindir=%(pkgplugindir)s
132
133
EXTRA_DIST = plugin.ini
133
134
 
 
135
noinst_HEADERS=
 
136
nobase_include_HEADERS=
 
137
nobase_pkginclude_HEADERS=
 
138
check_PROGRAMS=
 
139
noinst_LTLIBRARIES=
 
140
bin_PROGRAMS=
 
141
 
 
142
 
134
143
""" % plugin)
135
144
  if plugin['headers'] != "":
136
 
    plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin)
 
145
    plugin_file.write("noinst_HEADERS += %(headers)s\n" % plugin)
137
146
  if plugin['install_headers'] != "":
138
 
    plugin_file.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
 
147
    plugin_file.write("nobase_pkginclude_HEADERS += %(install_headers)s\n" % plugin)
139
148
  if plugin['testsuite']:
140
149
    if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
141
150
      plugin_file.write("EXTRA_DIST += %(testsuitedir)s\n" % plugin)
144
153
%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
145
154
%(libname)s_la_LIBADD=%(libs)s
146
155
%(libname)s_la_DEPENDENCIES=%(libs)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
 
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
148
157
%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
149
158
%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
150
159
%(libname)s_la_SOURCES=%(sources)s
236
245
    with_%(name)s_plugin="%(enabled)s"
237
246
    requested_%(name)s_plugin="no"
238
247
  ])
 
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
])
239
261
AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[
240
262
dnl indented wierd to make the help output correct
241
263
AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Enable loading %(title)s by default. @<:@default=%(default_yesno)s@:>@])
265
287
""" % plugin)
266
288
  if not plugin['unconditional']:
267
289
    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])
268
294
AM_CONDITIONAL([%(build_conditional_tag)s],
269
295
               [test %(build_conditional)s])
270
296
    """ % plugin)
271
297
 
272
298
  plugin_ac.write("""
273
 
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],
274
 
    [
 
299
AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[
275
300
""" % plugin)
276
301
  if plugin['testsuite']:
277
302
    plugin_ac.write("""
278
303
      pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}"
279
304
    """ % plugin)
280
 
  if plugin['static']:
281
 
    plugin_ac.write("""
 
305
  plugin_ac.write("""
 
306
      AS_IF([test "x${with_static_%(name)s_plugin}" = "xyes" -o "x${with_all_static}" = "xyes"],[
 
307
 
282
308
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
283
309
          pandora_builtin_load_list="%(module_name)s,${pandora_builtin_load_list}"
284
310
          pandora_builtin_load_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_load_symbols_list}"
287
313
        pandora_builtin_list="%(module_name)s,${pandora_builtin_list}"
288
314
        pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}"
289
315
        pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la"
290
 
    """ % plugin)
291
 
 
292
 
  else:
293
 
    plugin_ac.write("""
 
316
     ],[
294
317
        AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
295
318
          pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}"
296
319
        ])
 
320
    ])
297
321
    """ % plugin)
298
 
  plugin_ac.write("      ])\n")
 
322
  plugin_ac.write("])\n")
299
323
 
300
324
def fix_file_paths(plugin, files):
301
325
  # TODO: determine path to plugin dir relative to top_srcdir... append it to
340
364
      plugin['extra_dist']=" ".join([os.path.join(plugin['rel_path'],f) for f in plugin['extra_dist'].split()])
341
365
 
342
366
 
 
367
    if plugin['static']:
 
368
      plugin['static_yesno']="yes"
 
369
    else:
 
370
      plugin['static_yesno']="no"
343
371
    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()
344
374
    plugin['name_with_dashes']= plugin['name'].replace('_','-')
345
375
    if plugin.has_key('build_conditional'):
346
376
      plugin['has_build_conditional']=True
348
378
    else:
349
379
      plugin['has_build_conditional']=False
350
380
      plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin
 
381
    plugin['shared_build']='"x${shared_%(name)s_plugin}" = "xyes"' %plugin
351
382
 
352
383
    if plugin['install']:
353
384
      plugin['library_type']= 'pkgplugin'
367
398
    return os.path.join(plugin_dir, "docs")
368
399
 
369
400
def read_plugin_ini(plugin_dir):
 
401
    sources_default=""
370
402
    if plugin_dir == ".":
371
403
      plugin_name="**OUT-OF-TREE**"
 
404
      module_name="**OUT-OF-TREE**"
372
405
    else:
373
 
      short_name=os.path.basename(plugin_dir)
 
406
      sources_default="%s.cc" % os.path.basename(plugin_dir)
374
407
      plugin_name = plugin_dir[plugin_dir.index(config['root_plugin_dir']) + len(config['root_plugin_dir']) + 1:]
375
408
      module_name = plugin_name.replace("/", config['module_name_separator']).replace("\\", config['module_name_separator'])
376
409
      plugin_name = plugin_name.replace("/", config['plugin_name_separator']).replace("\\", config['plugin_name_separator'])
377
410
 
378
411
 
379
412
    plugin_file= os.path.join(plugin_dir,config['plugin_ini_fname'])
380
 
    plugin_defaults= dict(sources="%s.cc" % short_name,
 
413
    plugin_defaults= dict(sources=sources_default,
381
414
                          headers="",
382
415
                          install_headers="",
383
416
                          cflags="",
501
534
  if plugin['headers'] != "":
502
535
    plugin_am.write("noinst_HEADERS += %(headers)s\n" % plugin)
503
536
  if plugin['install_headers'] != "":
504
 
    plugin_am.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
 
537
    plugin_am.write("nobase_pkginclude_HEADERS += %(install_headers)s\n" % plugin)
505
538
  if plugin['testsuite']:
506
539
    if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
507
540
      plugin_am.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin)
509
542
    plugin_am.write("EXTRA_DIST += %(rel_path)s/%(dist_testsuite)s\n" % plugin)
510
543
  if plugin['docs'] is not None:
511
544
    plugin_am.write("EXTRA_DIST += ${top_srcdir}/%(rel_path)s/docs/*.rst\n" % plugin)
512
 
  if plugin['static']:
513
 
    plugin_am.write("""
 
545
  plugin_am.write("""
514
546
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
515
 
EXTRA_DIST += %(rel_path)s/plugin.ini
516
 
if %(build_conditional_tag)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
517
551
  noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
518
552
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
519
553
  %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
520
554
  %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=$(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
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
 
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
522
556
  %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
523
557
  %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
524
558
  %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
525
559
  check_PROGRAMS += %(tests)s
526
560
  PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la
527
561
endif
528
 
""" % plugin)
529
 
  else:
530
 
    plugin_am.write("""
531
 
%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
532
562
EXTRA_DIST += %(rel_path)s/plugin.ini
533
 
if %(build_conditional_tag)s
 
563
if %(shared_build_conditional_tag)s
534
564
  %(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
535
565
  %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
536
566
  %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
537
567
  %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
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
 
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
539
569
  %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
540
570
  %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
541
571
  %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
653
683
if not os.path.exists("config/pandora-plugin.ac") or "write" in actions:
654
684
  plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac'))
655
685
  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
  """)
656
695
 
657
696
if os.path.exists("docs/plugins"):
658
697
  if not os.path.exists("docs/plugins/list.rst") or "write" in actions: