From 71f5ae98b10548c70f6f0b4482ca6ead6c1217be Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 7 Apr 2021 07:34:47 +0300 Subject: [PATCH 42/42] Meson: Enable fcdb See osdn #41934 Signed-off-by: Marko Lindqvist --- gen_headers/meson_fc_config.h.in | 8 ++++++++ meson.build | 8 +++++++- server/scripting/script_fcdb.c | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in index c634218f50..c03e65331a 100644 --- a/gen_headers/meson_fc_config.h.in +++ b/gen_headers/meson_fc_config.h.in @@ -33,10 +33,18 @@ #define BINDIR "@BINDIR@" +#define FC_CONF_PATH "@SYSCONFDIR@/freeciv" + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif +/* Database backend available */ +#define HAVE_FCDB 1 + +/* Have Sqlite3 database backend */ +#define HAVE_FCDB_SQLITE3 1 + /* Release cycle information */ #mesondefine IS_DEVEL_VERSION diff --git a/meson.build b/meson.build index 2f1d215c82..b07d70d31c 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,8 @@ pub_conf_data.set('FREECIV_STORAGE_DIR', '~/.freeciv') priv_conf_data.set('DATADIR', join_paths(get_option('prefix'), get_option('datadir'))) priv_conf_data.set('DATASUBDIR', 'dev') +priv_conf_data.set('SYSCONFDIR', + join_paths(get_option('prefix'), get_option('sysconfdir'))) priv_conf_data.set('IS_DEVEL_VERSION', 1) @@ -304,7 +306,7 @@ if get_option('nls') endif common_inc = include_directories(cross_inc_path, - lua_inc_path, 'dependencies/tinycthread', + lua_inc_path, 'dependencies/luasql/src', 'dependencies/tinycthread', 'dependencies/tolua-5.2/include', 'dependencies/cvercmp', 'utility', 'common', 'common/networking', 'common/scriptcore', 'common/aicore') @@ -660,6 +662,10 @@ executable('freeciv-server', install: true ) +install_data( + 'lua/database.lua', + install_dir : join_paths(get_option('sysconfdir'), 'freeciv') + ) install_data( 'data/ruledit/comments-3.2.txt', diff --git a/server/scripting/script_fcdb.c b/server/scripting/script_fcdb.c index e9456dac2f..08fad85ded 100644 --- a/server/scripting/script_fcdb.c +++ b/server/scripting/script_fcdb.c @@ -241,7 +241,15 @@ bool script_fcdb_init(const char *fcdb_luafile) tolua_common_a_open(fcl->state); tolua_game_open(fcl->state); + +#ifdef MESON_BUILD + /* Tolua adds 'tolua_' prefix to _open() function names, + * and we can't pass it a basename where the original + * 'tolua_' has been stripped when generating from meson. */ + tolua_tolua_fcdb_open(fcl->state); +#else /* MESON_BUILD */ tolua_fcdb_open(fcl->state); +#endif /* MESON_BUILD */ lua_register(fcl->state, "md5sum", md5sum); #ifdef HAVE_FCDB_MYSQL luaL_requiref(fcl->state, "ls_mysql", luaopen_luasql_mysql, 1); -- 2.30.2