Skip to content
Snippets Groups Projects
Commit 871a0a3f authored by Armin Luntzer's avatar Armin Luntzer
Browse files

* more cross-platform build work

* more search paths for config/plugin files
parent ab56ec0a
No related branches found
No related tags found
No related merge requests found
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
touch NEWS touch NEWS
if [[ $(uname) == "Darwin" ]]; then if [[ $(uname) == "Darwin" ]]; then
glibtoolize glibtoolize
else elif [[ $(uname) != "MINGW"* ]]; then
libtoolize libtoolize
fi fi
aclocal aclocal
autoconf autoconf
automake --add-missing automake --add-missing
AC_INIT([radtel], [0.1], [armin.luntzer@univie.ac.at], []) AC_INIT([radtel], [0.0.1], [armin.luntzer@univie.ac.at], [])
AM_INIT_AUTOMAKE([subdir-objects foreign dist-xz]) AM_INIT_AUTOMAKE([subdir-objects foreign dist-xz])
LT_INIT([dlopen])
AC_PROG_CC AC_PROG_CC
AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_MACRO_DIRS([m4])
...@@ -23,9 +21,18 @@ case "${host_os}" in ...@@ -23,9 +21,18 @@ case "${host_os}" in
;; ;;
esac esac
dnl libootl sucks on windows (for our purpose), so we'll build
dnl plugin dlls ourselves
test x$IS_WINDOWS != xtrue && LT_INIT([dlopen])
test x$IS_WINDOWS = xtrue && AC_PROG_RANLIB
AM_CONDITIONAL([OS_WINDOWS], [test x$IS_WINDOWS = xtrue]) AM_CONDITIONAL([OS_WINDOWS], [test x$IS_WINDOWS = xtrue])
AM_CONDITIONAL([OS_DARWIN], [test x$IS_DARWIN = xtrue]) AM_CONDITIONAL([OS_DARWIN], [test x$IS_DARWIN = xtrue])
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources) AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
GLIB_GSETTINGS GLIB_GSETTINGS
......
...@@ -30,11 +30,10 @@ radtelsrv_LDADD += -L$(top_builddir)/src/server/api -lbackend ...@@ -30,11 +30,10 @@ radtelsrv_LDADD += -L$(top_builddir)/src/server/api -lbackend
radtelsrv_LDFLAGS := $(radtel_LIBS) radtelsrv_LDFLAGS := $(radtel_LIBS)
radtelsrv_LDFLAGS += -lm radtelsrv_LDFLAGS += -lm
# do we need this? if OS_WINDOWS
#if OS_WINDOWS radtelsrv_LDFLAGS += -Wl,--out-implib,libhost.a
#radtelsrv_LDFLAGS += -Wl,--out-implib,libhost.a radtelsrv_LDFLAGS += -Wl,--export-all-symbols
#radtelsrv_LDFLAGS += -Wl,--export-all-symbols endif
#endif
......
...@@ -66,11 +66,11 @@ static int backend_load_module_from_prefix(const gchar *plugin_path) ...@@ -66,11 +66,11 @@ static int backend_load_module_from_prefix(const gchar *plugin_path)
void (*mod_init)(void); void (*mod_init)(void);
g_message("Will try to load plugin from %s", plugin_path);
mod = g_module_open(plugin_path, G_MODULE_BIND_LAZY); mod = g_module_open(plugin_path, G_MODULE_BIND_LAZY);
if(!mod) { if(!mod) {
g_debug("Unable to load plugin %s: %s", plugin_path, g_warning("Unable to load plugin %s: %s", plugin_path,
g_module_error()); g_module_error());
return -1; return -1;
} }
...@@ -117,6 +117,15 @@ static int backend_load_module(const gchar *plugin_path) ...@@ -117,6 +117,15 @@ static int backend_load_module(const gchar *plugin_path)
return 0; return 0;
/* try again in lib/plugdir */
plug = g_strconcat("lib/", PLUGDIR, "/", plugin_path, NULL);
ret = backend_load_module_from_prefix(plug);
g_free(plug);
if (!ret)
return 0;
/* try again in system lib dir/plugdir */ /* try again in system lib dir/plugdir */
plug = g_strconcat(LIBDIR, "/", PLUGDIR, "/", plugin_path, NULL); plug = g_strconcat(LIBDIR, "/", PLUGDIR, "/", plugin_path, NULL);
ret = backend_load_module_from_prefix(plug); ret = backend_load_module_from_prefix(plug);
......
...@@ -8,8 +8,8 @@ pluginconfdir = $(sysconfdir)/$(confdir)/backends ...@@ -8,8 +8,8 @@ pluginconfdir = $(sysconfdir)/$(confdir)/backends
pluginconf_DATA = $(top_builddir)/src/server/config/backends/rt_sim.cfg pluginconf_DATA = $(top_builddir)/src/server/config/backends/rt_sim.cfg
AM_CPPFLAGS := \-DCONFDIR=\"$(confdir)\" \ AM_CPPFLAGS := -DCONFDIR=\"$(confdir)\" \
\-DSYSCONFDIR=\"$(sysconfdir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS := $(GMODULE_CFLAGS) AM_CFLAGS := $(GMODULE_CFLAGS)
...@@ -25,22 +25,54 @@ if !OS_DARWIN ...@@ -25,22 +25,54 @@ if !OS_DARWIN
AM_CFLAGS += -fopenmp AM_CFLAGS += -fopenmp
endif endif
if !OS_WINDOWS
#plugin_LTLIBRARIES = rt_sim.la
#rt_sim_la_LDFLAGS := -avoid-version
#rt_sim_la_LDFLAGS += -module
#rt_sim_la_LDFLAGS += -shared
#rt_sim_la_LDFLAGS += -export-dynamic
#
#rt_sim_la_LIBADD := -L$(top_builddir)/src/net/ -lproto
#rt_sim_la_LIBADD += -L$(top_builddir)/src/util/ -lutil
#rt_sim_la_LIBADD += $(GMODULE_LIBS)
#rt_sim_la_LIBADD += $(GTHREAD_LIBS)
#rt_sim_la_LIBADD += $(GLIB_LIBS)
#rt_sim_la_LIBADD += $(GTK3_LIBS)
#rt_sim_la_LIBADD += $(GIO_LIBS)
#
#rt_sim_la_SOURCES = rt_sim.c
plugin_LTLIBRARIES = rt_sim.la else
rt_sim_la_LDFLAGS := -avoid-version # libtool stinks on windows. Rather, windows dlls stink
rt_sim_la_LDFLAGS += -module # I'll build my own! With Black Jack! And hookers!
rt_sim_la_LDFLAGS += -shared
rt_sim_la_LDFLAGS += -export-dynamic
rt_sim_la_LIBADD := -L$(top_builddir)/src/net/ -lproto all: rt_sim.dll
rt_sim_la_LIBADD += -L$(top_builddir)/src/util/ -lutil
rt_sim_la_LIBADD += $(GMODULE_LIBS) SUFFIXES = .dll
rt_sim_la_LIBADD += $(GTHREAD_LIBS) CLEANFILES = *.dll
rt_sim_la_LIBADD += $(GLIB_LIBS)
rt_sim_la_LIBADD += $(GTK3_LIBS) AM_CFLAGS += -Wl,-no-undefined
rt_sim_la_LIBADD += $(GIO_LIBS) AM_CFLAGS += -Wl,--unresolved-symbols=ignore-all
AM_CFLAGS += -Wl,--enable-runtime-pseudo-reloc
AM_CFLAGS += -shared
AM_CFLAGS += -fPIC
AM_LDFLAGS := -L$(top_builddir)/src/net/ -lproto
AM_LDFLAGS += -L$(top_builddir)/src/util/ -lutil
AM_LDFLAGS += $(GMODULE_LIBS)
AM_LDFLAGS += $(GTHREAD_LIBS)
AM_LDFLAGS += $(GLIB_LIBS)
AM_LDFLAGS += $(GTK3_LIBS)
AM_LDFLAGS += $(GIO_LIBS)
AM_LDFLAGS += -L$(top_builddir)/src/server -lhost
plugin_DATA = $(top_builddir)/src/server/backends/SIM/rt_sim.dll
%.dll: %.c
$(CC) $(AM_CPPFLAGS) $(AM_CFLAGS) -I $(top_srcdir)/include -o $@ $< $(AM_LDFLAGS)
endif
rt_sim_la_SOURCES = rt_sim.c
...@@ -187,10 +187,14 @@ static int server_load_config_from_prefix(const gchar *prefix, GError **err) ...@@ -187,10 +187,14 @@ static int server_load_config_from_prefix(const gchar *prefix, GError **err)
gchar *cfg; gchar *cfg;
kf = g_key_file_new(); kf = g_key_file_new();
flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
cfg = g_strconcat(prefix, "server.cfg", NULL); cfg = g_strconcat(prefix, "server.cfg", NULL);
g_message("Will try to load config from %s", cfg);
ret = g_key_file_load_from_file(kf, cfg, flags, err); ret = g_key_file_load_from_file(kf, cfg, flags, err);
...@@ -240,6 +244,14 @@ int server_cfg_load(void) ...@@ -240,6 +244,14 @@ int server_cfg_load(void)
g_free(prefix); g_free(prefix);
} }
if (ret) {
g_clear_error(&error);
/* try again in confdir */
prefix = g_strconcat("etc/", CONFDIR, "/", NULL);
ret = server_load_config_from_prefix(prefix, &error);
g_free(prefix);
}
if (ret) { if (ret) {
g_clear_error(&error); g_clear_error(&error);
/* try again in sysconfdir */ /* try again in sysconfdir */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment