[libgda] Meson: Added support for Berkeley Database provider



commit 1428ad86604c57fa5758badff1fe577578b7d1d4
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Aug 2 10:09:13 2018 -0500

    Meson: Added support for Berkeley Database provider

 doc/C/libgda/meson.build  |  6 ++-
 libgda/meson.build        | 15 +++++++-
 meson.build               | 53 ++++++++++++++++++++------
 providers/bdb/meson.build | 94 +++++++++++++++++++++++++++++++++++++++++++++++
 providers/meson.build     |  4 ++
 5 files changed, 159 insertions(+), 13 deletions(-)
---
diff --git a/doc/C/libgda/meson.build b/doc/C/libgda/meson.build
index b104a4011..cdb563b55 100644
--- a/doc/C/libgda/meson.build
+++ b/doc/C/libgda/meson.build
@@ -74,7 +74,11 @@ contentf += files([
        'fdl-appendix.sgml'
        ])
 
-# ignore_bdb = ['gda-data-model-bdb.h']
+# ignore_bdb = []
+# if bdb_found
+# else
+#      ignore_bdb += ['gda-data-model-bdb.h']
+# endif
 
 # gnome_module.gtkdoc(project_package,
 #      main_xml: project_package+'-docs.xml',
diff --git a/libgda/meson.build b/libgda/meson.build
index 767d7e3f0..56a149422 100644
--- a/libgda/meson.build
+++ b/libgda/meson.build
@@ -243,6 +243,18 @@ ldap_cargs += [
        ]
 endif
 
+if lbdb_found
+       lbdbh_sources = files ([
+               'gda-data-model-bdb.h'
+               ])
+       libgda_headers_all += lbdbh_sources
+       lbdb_sources = files ([
+               'gda-data-model-bdb.c',
+               ])
+       libgda_source_all += lbdb_sources
+       lbdb_cargs += ['-DBDB_LIB="'+lbdb_filename+'"']
+endif
+
 inc_sqliteh = include_directories ('sqlite')
 inc_sqliteh_dep = declare_dependency (include_directories : inc_sqliteh)
 
@@ -276,7 +288,8 @@ libgda = library(
                ],
        c_args : [
                libgda_cargs,
-               ldap_cargs
+               ldap_cargs,
+               lbdb_cargs
                ],
        install : true
        )
diff --git a/meson.build b/meson.build
index 41ae5605b..192f8b79a 100644
--- a/meson.build
+++ b/meson.build
@@ -52,12 +52,44 @@ libxslt_dep = dependency('libxslt', required: false)
 jsonglib_dep = dependency('json-glib-1.0',required : false)
 postgres_dep = dependency ('libpq', required: false)
 
+# Platform data
+windows = build_machine.system().contains('windows')
+if windows
+win = import('windows')
+endif
+
+lbdb_found = false
+lbdb_versions = [
+       '6.0',
+       '5.3',
+       '5.1',
+       '5.0',
+       '4.9',
+       '4.8',
+       '4.7'
+       ]
+lbdb_cargs = []
+foreach lbdbv : lbdb_versions
+       bdb_lib = compiler.find_library('db-'+lbdbv, required: false)
+       if bdb_lib.found()
+               if compiler.has_header('db.h')
+                       lbdb_found = true
+                       if windows
+                               lbdb_filename = 'db-'+lbdbv+'.dll'
+                       else
+                               lbdb_filename = 'db-'+lbdbv+'.so'
+                       endif
+                       lbdb_cargs += [
+                               '-I'+get_option('includedir'),
+                               ]
+               endif
+       endif
+endforeach
+
 sqlite_dep = dependency ('sqlite3', version: '>= 3.6.11', required: false)
 sqlite_internal = true
 if sqlite_dep.found()
-       sqlite3_table_column_metadata = compiler.find_library('sqlite3_table_column_metadata',
-                                                                                                             
                          required: false
-                                                                                                             
                          )
+       sqlite3_table_column_metadata = compiler.find_library('sqlite3_table_column_metadata', required: 
false)
        if sqlite3_table_column_metadata.found()
                sqlite_internal = false
        endif
@@ -121,8 +153,13 @@ conf.set('exec_prefix', get_option('libexecdir'))
 conf.set('libdir', get_option('libdir'))
 conf.set('includedir', get_option('includedir'))
 conf.set('GDA_DEBUG_FLAGS', '')
-conf.set('LIBGDA_BDB_INC', '')
-conf.set('LIBGDA_BDB_TYPE', '')
+if lbdb_found
+       conf.set('LIBGDA_BDB_INC', '#include <libgda/gda-data-model-bdb.h>')
+       conf.set('LIBGDA_BDB_TYPE', 'gda_data_model_bdb_get_type')
+else
+       conf.set('LIBGDA_BDB_INC', '')
+       conf.set('LIBGDA_BDB_TYPE', '')
+endif
 if ldap_found
        conf.set('LIBGDA_LDAP_VINC',LIBGDA_LDAP_VINC)
        conf.set('LIBGDA_LDAP_INC',LIBGDA_LDAP_INC)
@@ -235,12 +272,6 @@ subdir('po')
 subdir('libgda')
 subdir('providers')
 
-# Platform data
-windows = build_machine.system().contains('windows')
-if windows
-win = import('windows')
-endif
-
 gtk_dep = dependency('gtk+-3.0', required: false)
 enable_ui = get_option('with-ui') and gtk_dep.found()
 if enable_ui
diff --git a/providers/bdb/meson.build b/providers/bdb/meson.build
new file mode 100644
index 000000000..b98ec03c7
--- /dev/null
+++ b/providers/bdb/meson.build
@@ -0,0 +1,94 @@
+inc_libgda_bdbh = include_directories ('.')
+inc_libgda_bdbh_dep = declare_dependency (include_directories : inc_libgda_bdbh)
+
+libgda_bdb_sources = files([
+       'gda-bdb.h',
+       'gda-bdb-provider.c',
+       'gda-bdb-provider.h',
+       'libmain.c'
+       ])
+
+bdb_xml_fnames = [
+       'bdb_specs_dsn',
+       ]
+
+bdb_xml_fnamesext = []
+foreach fn : bdb_xml_fnames
+       bdb_xml_fnamesext += [fn+'.xml.in']
+endforeach
+
+bdb_xml_inf = files(bdb_xml_fnamesext)
+
+bdb_xml_res = []
+foreach xt : bdb_xml_fnames
+       i18n.merge_file(
+               input: xt+'.xml.in',
+               output: xt+'.xml.in.h',
+               type: 'xml',
+               po_dir: join_paths(meson.build_root(),'po')
+               )
+       bdb_xml_res += custom_target(xt+'.raw.xml',
+               command: [raw_spec,
+                       '-o', meson.current_build_dir(),
+                       '@INPUT@'
+                       ],
+               input: xt+'.xml.in',
+               output: xt+'.raw.xml',
+               )
+endforeach
+
+bdb_resourcesc = custom_target('bdb_resourcesc',
+       command: [compile_resources,
+               '--sourcedir='+meson.current_build_dir(),
+               '--generate-source',
+               '--target', '@OUTPUT@',
+               '--internal',
+               '@INPUT@'
+               ],
+       input: 'bdb.gresource.xml',
+       output: 'bdb_resource.c',
+       depends: bdb_xml_res,
+       install: false
+       )
+
+bdb_resourcesh = custom_target('bdb_resourcesh',
+       command: [compile_resources,
+               '--sourcedir='+meson.current_build_dir(),
+               '--generate-header',
+               '--target', '@OUTPUT@',
+               '--internal',
+               '@INPUT@'
+               ],
+       input: 'bdb.gresource.xml',
+       output: 'bdb_resource.h',
+       depends: bdb_xml_res,
+       install: false
+       )
+bdb_resources = [
+       bdb_resourcesc,
+       bdb_resourcesh
+       ]
+
+libgda_bdb_sources += bdb_resources
+
+libgda_bdb_provider = library ('gda-bdb-'+project_api_version,
+       libgda_bdb_sources,
+       dependencies: [
+               libgda_dep,
+               bdb_lib,
+               inc_libgdah_dep,
+               inc_libgda_bdbh_dep,
+               inc_sqliteh_dep
+               ],
+       c_args: [
+               '-include',
+               meson.build_root() + '/config.h',
+               lbdb_cargs
+               ],
+       link_args: [
+               '-export-dynamic',
+               ],
+       link_with: libgda,
+       install: true,
+       install_dir: join_paths(get_option('libdir'), project_package, 'providers')
+       )
\ No newline at end of file
diff --git a/providers/meson.build b/providers/meson.build
index 48b627fde..572729c75 100644
--- a/providers/meson.build
+++ b/providers/meson.build
@@ -14,4 +14,8 @@ endif
 
 if found_jdbc
 subdir('jdbc')
+endif
+
+if lbdb_found
+subdir('bdb')
 endif
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]