[libgda/jdbc: 1/3] add meson script for jdbc
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/jdbc: 1/3] add meson script for jdbc
- Date: Sun, 19 Sep 2021 23:18:19 +0000 (UTC)
commit 9461e72850afa677be074f5f13fb034bce657d98
Author: taozuhong <taozuhong gmail com>
Date: Mon Aug 2 11:46:42 2021 +0800
add meson script for jdbc
meson.build | 10 ++-
providers/jdbc/meson.build | 162 ++++++++++++++++++++++++++++++++++++++++++++-
providers/meson.build | 2 +-
3 files changed, 170 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 62b465941..1dd384bec 100644
--- a/meson.build
+++ b/meson.build
@@ -315,8 +315,14 @@ sqlite_xml_inf = files(sqlite_xml_fnamesext)
intlmerge = find_program('intltool-merge')
-found_jdbc = false
-
+# Jdbc dependencies
+java_dep = find_program('java')
+jdk_dep = dependency('jdk', version : '>=1.8')
+if jdk_dep.found() and java_dep.found()
+ found_jdbc = true
+else
+ found_jdbc = false
+endif
dates = compiler.run('''
#include<glib.h>
diff --git a/providers/jdbc/meson.build b/providers/jdbc/meson.build
index d525fe0f4..cbf99fe94 100644
--- a/providers/jdbc/meson.build
+++ b/providers/jdbc/meson.build
@@ -5,4 +5,164 @@ jdbc_doc_ignore = files([
'gda-jdbc-blob-op.h',
'gda-jdbc-provider.h',
'gda-jdbc-pstmt.h'
- ])
\ No newline at end of file
+])
+
+jni_filenames = [
+ 'GdaJConnection',
+ 'GdaJMeta',
+ 'GdaJProvider',
+ 'GdaJPStmt',
+ 'GdaJResultSet',
+ 'GdaJResultSetInfos',
+ 'GdaJColumnInfos',
+ 'GdaJBlobOp',
+ 'GdaJValue',
+ 'GdaInputStream'
+]
+
+jni_sources_fnamesext = []
+jni_headers_fnamesext = []
+jni_classes_fnamesext = []
+foreach fn : jni_filenames
+ jni_sources_fnamesext += [fn +'.c']
+ jni_headers_fnamesext += [fn +'.h']
+ jni_classes_fnamesext += [fn +'.class']
+endforeach
+
+jni_headers = files(jni_headers_fnamesext)
+jni_sources = files(jni_sources_fnamesext)
+jni_classes = files(jni_classes_fnamesext)
+
+jdbc_xml_fnames = [
+ 'jdbc_specs_dsn',
+ 'jdbc_specs_com.microsoft.sqlserver.jdbc.SQLServerDriver_dsn',
+]
+
+jdbc_xml_res = []
+foreach xt : jdbc_xml_fnames
+ i18n.merge_file(
+ input: xt + '.xml.in',
+ output: xt + '.xml.in.h',
+ type: 'xml',
+ po_dir: join_paths(meson.build_root(),'po')
+ )
+ jdbc_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
+
+jdbc_resourcesc = custom_target('jdbc_resourcesc',
+ command: [compile_resources,
+ '--sourcedir='+meson.current_build_dir(),
+ '--generate-source',
+ '--target', '@OUTPUT@',
+ '--internal',
+ '@INPUT@'
+ ],
+ input: 'jdbc.gresource.xml',
+ output: 'jdbc_resource.c',
+ depends: jdbc_xml_res,
+ install: false
+ )
+
+jdbc_resourcesh = custom_target('jdbc_resourcesh',
+ command: [compile_resources,
+ '--sourcedir='+meson.current_build_dir(),
+ '--generate-header',
+ '--target', '@OUTPUT@',
+ '--internal',
+ '@INPUT@'
+ ],
+ input: 'jdbc.gresource.xml',
+ output: 'jdbc_resource.h',
+ depends: jdbc_xml_res,
+ install: false
+ )
+
+resources = [
+ 'jdbc-resources.h',
+ 'jdbc-resources.c'
+]
+
+libgda_jdbc_sources = files([
+ 'gda-jdbc-blob-op.c',
+ 'gda-jdbc-blob-op.h',
+ 'gda-jdbc-ddl.c',
+ 'gda-jdbc-ddl.h',
+ 'gda-jdbc-provider.c',
+ 'gda-jdbc-provider.h',
+ 'gda-jdbc-pstmt.h',
+ 'gda-jdbc-pstmt.c',
+ 'gda-jdbc-meta.c',
+ 'gda-jdbc-meta.h',
+ 'gda-jdbc-recordset.c',
+ 'gda-jdbc-recordset.h',
+ 'gda-jdbc-util.c',
+ 'gda-jdbc-util.h',
+ 'gda-jdbc.h',
+ 'libmain.c',
+ 'jni-globals.h',
+ 'jni-wrapper.h',
+ 'jni-wrapper.c'
+])
+
+libgda_jdbc_sources += jni_headers
+libgda_jdbc_sources += jni_sources
+libgda_jdbc_sources += resources
+
+# generate jdbc provider jar
+jdbcprov_sources = files([
+ 'provider.java',
+ 'meta.java',
+ 'derby.java',
+ 'h2.java',
+ 'sqlserver.java',
+ 'MANIFEST.MF'
+])
+
+libgda_jdbc_provider_jar = jar(
+ 'gdaprovider-' + project_api_version,
+ jdbcprov_sources,
+ main_class : 'GdaJConnection',
+ install : true,
+ install_dir: join_paths(get_option('libdir'), project_package, 'providers')
+)
+
+jdbc_args += [
+ '-include',
+ join_paths(gda_top_build, 'config.h'),
+ '-DCLASS_PREFIX="GdaJdbc"'
+]
+jdbc_args += c_args
+
+link_args = [ '-Wl, --export-dynamic -module -avoid-version' ]
+host_os = host_machine.system().to_lower()
+if host_os.contains('darwin') or host_os.contains('machten') or host_os.contains('rhapsody')
+ link_args = [ '-Wl, -export_dynamic -module -avoid-version' ]
+endif
+
+libgda_jdbc_provider = library ('gda-jdbc-' + project_api_version,
+ libgda_jdbc_sources,
+ dependencies: [
+ libgda_dep,
+ inc_libgdah_dep,
+ inc_sqliteh_dep,
+ ],
+ c_args: jdbc_args,
+ link_args: link_args,
+ link_with: libgda,
+ install: true,
+ install_dir: join_paths(get_option('libdir'), project_package, 'providers')
+)
+
+libgda_jdbc_provider_pc = configure_file(
+ input: 'libgda-jdbc-'+project_api_version+'.pc.in',
+ output: 'libgda-jdbc-'+project_api_version+'.pc',
+ configuration : conf,
+ install_dir: join_paths(get_option('libdir'),'pkgconfig')
+)
diff --git a/providers/meson.build b/providers/meson.build
index fd648b2f1..e90cc8c69 100644
--- a/providers/meson.build
+++ b/providers/meson.build
@@ -18,7 +18,7 @@ if enable_ldap
subdir('ldap')
endif
-if found_jdbc and get_option('experimental')
+if found_jdbc
subdir('jdbc')
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]