From 5a6ea6b45ff9c9398cf4d532b55889c3ffbaa1e7 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sat, 23 Sep 2023 09:42:56 +0200 Subject: BUILD: Build pq plugins with meson --- meson.build | 10 +++--- src/datacache/meson.build | 12 +++++-- src/datastore/meson.build | 24 ++++++++++---- src/meson.build | 5 +-- src/my/meson.build | 15 +++++++++ src/mysql/meson.build | 13 ++++++++ src/namecache/meson.build | 73 +++++++++++++++++++++++------------------ src/namestore/meson.build | 82 +++++++++++++++++++++++++++-------------------- src/pq/meson.build | 20 ++++++++++++ 9 files changed, 172 insertions(+), 82 deletions(-) create mode 100644 src/my/meson.build create mode 100644 src/mysql/meson.build create mode 100644 src/pq/meson.build diff --git a/meson.build b/meson.build index 62888727d..513a8da99 100644 --- a/meson.build +++ b/meson.build @@ -176,11 +176,13 @@ if ssh_bin.found() endif # Optional dependencies -mq_dep = dependency('libmysqlclient', required : false) -if not mq_dep.found() - mq_dep = cc.find_library('mysqlclient', required : false) + +# FIXME: I think we wanted to retire mysql support +my_dep = dependency('libmysqlclient', required : false) +if not my_dep.found() + my_dep = cc.find_library('mysqlclient', required : false) endif -if mq_dep.found() +if my_dep.found() add_project_arguments('-DHAVE_MYSQL', language : 'c') endif pq_dep = dependency('libpq', required : false) diff --git a/src/datacache/meson.build b/src/datacache/meson.build index a0a439403..b61a5e2a7 100644 --- a/src/datacache/meson.build +++ b/src/datacache/meson.build @@ -1,7 +1,5 @@ libgnunetdatacache_src = ['datacache.c'] -libgnunetplugindatacache_sqlite_src = ['plugin_datacache_sqlite.c'] - configure_file(input : 'datacache.conf', output : 'datacache.conf', configuration : cdata, @@ -25,10 +23,18 @@ libgnunetdatacache = library('gnunetdatacache', libgnunetdatacache_dep = declare_dependency(link_with : libgnunetdatacache) pkg.generate(libgnunetdatacache, url: 'https://www.gnunet.org', description : 'Provides datacache API for temporary storage to disk') + shared_module('gnunet_plugin_datacache_sqlite', - libgnunetplugindatacache_sqlite_src, + ['plugin_datacache_sqlite.c'], dependencies: [libgnunetutil_dep, libgnunetdatacache_dep, sqlite_dep, libgnunetsq_dep], include_directories: [incdir, configuration_inc]) +shared_module('gnunet_plugin_datacache_postgres', + ['plugin_datacache_postgres.c'], + dependencies: [libgnunetutil_dep, + libgnunetdatacache_dep, + pq_dep, + libgnunetpq_dep], + include_directories: [incdir, configuration_inc]) diff --git a/src/datastore/meson.build b/src/datastore/meson.build index 531d8fbdb..e54340f8c 100644 --- a/src/datastore/meson.build +++ b/src/datastore/meson.build @@ -27,6 +27,22 @@ libgnunetdatastore = library('gnunetdatastore', libgnunetdatastore_dep = declare_dependency(link_with : libgnunetdatastore) pkg.generate(libgnunetdatastore, url: 'https://www.gnunet.org', description : 'Management API for the datastore for persistent storage to disk') + +shared_module('gnunet_plugin_datastore_sqlite', + ['plugin_datastore_sqlite.c'], + dependencies: [libgnunetutil_dep, + libgnunetdatastore_dep, + sqlite_dep, + libgnunetsq_dep], + include_directories: [incdir, configuration_inc]) +shared_module('gnunet_plugin_datastore_postgres', + ['plugin_datastore_postgres.c'], + dependencies: [libgnunetutil_dep, + libgnunetdatastore_dep, + pq_dep, + libgnunetpq_dep], + include_directories: [incdir, configuration_inc]) + executable ('gnunet-datastore', ['gnunet-datastore.c'], dependencies: [libgnunetdatastore_dep, @@ -41,10 +57,4 @@ executable ('gnunet-service-datastore', libgnunetstatistics_dep, libgnunetdatacache_dep], include_directories: [incdir, configuration_inc]) -shared_module('gnunet_plugin_datastore_sqlite', - ['plugin_datastore_sqlite.c'], - dependencies: [libgnunetutil_dep, - libgnunetdatastore_dep, - sqlite_dep, - libgnunetsq_dep], - include_directories: [incdir, configuration_inc]) + diff --git a/src/meson.build b/src/meson.build index 389d08245..5db69ce3f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -19,8 +19,9 @@ if get_option('monolith') == false endif subdir('peerinfo') subdir('sq', if_found : [sqlite_dep]) -#subdir('$(MYSQL_DIR)') -#subdir('$(POSTGRES_DIR)') +subdir('mysql', if_found : [my_dep]) +subdir('my', if_found : [my_dep]) +subdir('pq', if_found : [pq_dep]) subdir('datacache') subdir('datastore') #subdir('template') diff --git a/src/my/meson.build b/src/my/meson.build new file mode 100644 index 000000000..877e80560 --- /dev/null +++ b/src/my/meson.build @@ -0,0 +1,15 @@ +libgnunetmy_src = ['my.c', + 'my_query_helper.c', + 'my_result_helper.c'] + +if get_option('monolith') == false + libgnunetmy = library('gnunetmy', + libgnunetmy_src, + dependencies: [libgnunetutil_dep, libgnunetmysq_dep, my_dep], + include_directories: [incdir, configuration_inc]) + libgnunetmy_dep = declare_dependency(link_with : libgnunetmy) +else + foreach p : libgnunetmy_src + gnunet_src += 'my/' + p + endforeach +endif diff --git a/src/mysql/meson.build b/src/mysql/meson.build new file mode 100644 index 000000000..1464fc45e --- /dev/null +++ b/src/mysql/meson.build @@ -0,0 +1,13 @@ +libgnunetmysq_src = ['mysql.c'] + +if get_option('monolith') == false + libgnunetmysq = library('gnunetmysq', + libgnunetmysq_src, + dependencies: [libgnunetutil_dep, my_dep], + include_directories: [incdir, configuration_inc]) + libgnunetmysq_dep = declare_dependency(link_with : libgnunetmysq) +else + foreach p : libgnunetmysq_src + gnunet_src += 'mysql/' + p + endforeach +endif diff --git a/src/namecache/meson.build b/src/namecache/meson.build index f50d7e5d1..24c546c05 100644 --- a/src/namecache/meson.build +++ b/src/namecache/meson.build @@ -1,5 +1,4 @@ libgnunetnamecache_src = ['namecache_api.c'] -libgnunetpluginnamecache_sqlite_src = ['plugin_namecache_sqlite.c'] gnunetnamecache_src = ['gnunet-namecache.c'] gnunetservicenamecache_src = ['gnunet-service-namecache.c'] @@ -11,37 +10,49 @@ configure_file(input : 'namecache.conf.in', install_dir: pkgcfgdir) -if get_option('monolith') == false - libgnunetnamecache = library('gnunetnamecache', - libgnunetnamecache_src, - dependencies: [libgnunetutil_dep, - libgnunetgnsrecord_dep], - include_directories: [incdir, configuration_inc]) - libgnunetnamecache_dep = declare_dependency(link_with : libgnunetnamecache) - libgnunetpluginnamecache_sqlite = library('gnunet_plugin_namecache_sqlite', - libgnunetpluginnamecache_sqlite_src, - dependencies: [libgnunetutil_dep, - libgnunetgnsrecord_dep, - sqlite_dep, - libgnunetsq_dep], - include_directories: [incdir, configuration_inc]) - libgnunetpluginnamecache_sqlite_dep = declare_dependency(link_with : libgnunetpluginnamecache_sqlite) - executable ('gnunet-namecache', - gnunetnamecache_src, - dependencies: [libgnunetnamecache_dep, - libgnunetutil_dep, - libgnunetgnsrecord_dep, - libgnunetidentity_dep], - include_directories: [incdir, configuration_inc]) - executable ('gnunet-service-namecache', - gnunetservicenamecache_src, - dependencies: [libgnunetnamecache_dep, - libgnunetutil_dep, - libgnunetgnsrecord_dep, - libgnunetstatistics_dep], - include_directories: [incdir, configuration_inc]) -else +if get_option('monolith') foreach p : libgnunetnamecache_src + libgnunetpluginnamecache_sqlite_src + gnunetservicenamecache_src gnunet_src += 'namecache/' + p endforeach + subdir_done() endif + +libgnunetnamecache = library('gnunetnamecache', + libgnunetnamecache_src, + soversion: '0.0.0', + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep], + include_directories: [incdir, configuration_inc]) +libgnunetnamecache_dep = declare_dependency(link_with : libgnunetnamecache) +pkg.generate(libgnunetnamecache, url: 'https://www.gnunet.org', + description : 'Provides API for storing GNS records to a cache') + +shared_module('gnunet_plugin_namecache_sqlite', + ['plugin_namecache_sqlite.c'], + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep, + sqlite_dep, + libgnunetsq_dep], + include_directories: [incdir, configuration_inc]) +shared_module('gnunet_plugin_namecache_postgres', + ['plugin_namecache_postgres.c'], + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep, + pq_dep, + libgnunetpq_dep], + include_directories: [incdir, configuration_inc]) + +executable ('gnunet-namecache', + gnunetnamecache_src, + dependencies: [libgnunetnamecache_dep, + libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep], + include_directories: [incdir, configuration_inc]) +executable ('gnunet-service-namecache', + gnunetservicenamecache_src, + dependencies: [libgnunetnamecache_dep, + libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetstatistics_dep], + include_directories: [incdir, configuration_inc]) diff --git a/src/namestore/meson.build b/src/namestore/meson.build index 010316df3..79396915e 100644 --- a/src/namestore/meson.build +++ b/src/namestore/meson.build @@ -11,42 +11,54 @@ configure_file(input : 'namestore.conf.in', install_dir: pkgcfgdir) -if get_option('monolith') == false - libgnunetnamestore = library('gnunetnamestore', - libgnunetnamestore_src, - dependencies: [libgnunetutil_dep, - libgnunetgnsrecord_dep, - libgnunetidentity_dep], - include_directories: [incdir, configuration_inc]) - libgnunetnamestore_dep = declare_dependency(link_with : libgnunetnamestore) - libgnunetpluginnamestore_sqlite = library('gnunet_plugin_namestore_sqlite', - libgnunetpluginnamestore_sqlite_src, - dependencies: [libgnunetutil_dep, - libgnunetgnsrecord_dep, - libgnunetidentity_dep, - libgnunetsq_dep, - libgnunetstatistics_dep, - sqlite_dep], - include_directories: [incdir, configuration_inc]) - libgnunetpluginnamestore_sqlite_dep = declare_dependency(link_with : libgnunetpluginnamestore_sqlite) - executable ('gnunet-namestore', - gnunetnamestore_src, - dependencies: [libgnunetnamestore_dep, - libgnunetutil_dep, - libgnunetgnsrecord_dep, - libgnunetidentity_dep], - include_directories: [incdir, configuration_inc]) - executable ('gnunet-service-namestore', - gnunetservicenamestore_src, - dependencies: [libgnunetnamestore_dep, - libgnunetutil_dep, - libgnunetnamecache_dep, - libgnunetgnsrecord_dep, - libgnunetidentity_dep, - libgnunetstatistics_dep], - include_directories: [incdir, configuration_inc]) -else +if get_option('monolith') foreach p : libgnunetnamestore_src + libgnunetpluginnamestore_sqlite_src + gnunetservicenamestore_src gnunet_src += 'namestore/' + p endforeach + subdir_done() endif +libgnunetnamestore = library('gnunetnamestore', + libgnunetnamestore_src, + soversion: '0.1.0', + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep], + include_directories: [incdir, configuration_inc]) +libgnunetnamestore_dep = declare_dependency(link_with : libgnunetnamestore) +pkg.generate(libgnunetnamestore, url: 'https://www.gnunet.org', + description : 'Provides API for storing GNS records to a database') + +shared_module('gnunet_plugin_namestore_sqlite', + libgnunetpluginnamestore_sqlite_src, + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep, + libgnunetsq_dep, + libgnunetstatistics_dep, + sqlite_dep], + include_directories: [incdir, configuration_inc]) +shared_module('gnunet_plugin_namestore_postgres', + ['plugin_namestore_postgres.c'], + dependencies: [libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep, + libgnunetpq_dep, + libgnunetstatistics_dep, + pq_dep], + include_directories: [incdir, configuration_inc]) +executable ('gnunet-namestore', + gnunetnamestore_src, + dependencies: [libgnunetnamestore_dep, + libgnunetutil_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep], + include_directories: [incdir, configuration_inc]) +executable ('gnunet-service-namestore', + gnunetservicenamestore_src, + dependencies: [libgnunetnamestore_dep, + libgnunetutil_dep, + libgnunetnamecache_dep, + libgnunetgnsrecord_dep, + libgnunetidentity_dep, + libgnunetstatistics_dep], + include_directories: [incdir, configuration_inc]) diff --git a/src/pq/meson.build b/src/pq/meson.build new file mode 100644 index 000000000..273a0c0fb --- /dev/null +++ b/src/pq/meson.build @@ -0,0 +1,20 @@ +libgnunetpq_src = ['pq.c', + 'pq_connect.c', + 'pq_eval.c', + 'pq_event.c', + 'pq_exec.c', + 'pq_prepare.c', + 'pq_query_helper.c', + 'pq_result_helper.c'] + +if get_option('monolith') == false + libgnunetpq = library('gnunetpq', + libgnunetpq_src, + dependencies: [libgnunetutil_dep, pq_dep], + include_directories: [incdir, configuration_inc]) + libgnunetpq_dep = declare_dependency(link_with : libgnunetpq) +else + foreach p : libgnunetpq_src + gnunet_src += 'pq/' + p + endforeach +endif -- cgit v1.2.3