From: Andy Spencer Date: Sun, 25 Oct 2009 17:12:14 +0000 (+0000) Subject: Fix gen.sh and related things for stand-alone libgis X-Git-Tag: v0.3~4 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=af10b851da5fa9719b321c36f1ef05b8aca98875 Fix gen.sh and related things for stand-alone libgis This make aweather run without needing to be installed. gen.sh the libgis source to be installed in ../libgis and configured with ./gen.sh --- diff --git a/autogen.sh b/autogen.sh index 28ac04b..086ea13 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,5 @@ #!/bin/sh -gtkdocize libtoolize aclocal autoheader diff --git a/configure.ac b/configure.ac index 3bf3fe4..6a98aa4 100644 --- a/configure.ac +++ b/configure.ac @@ -9,10 +9,10 @@ AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG -GTK_DOC_CHECK(1.9) # Check for required packages PKG_CHECK_MODULES(GIS, libgis) +AC_SUBST(PLUGINSDIR, `pkg-config --variable=pluginsdir libgis`) # Define odd RSL install location AC_CHECK_LIB(rsl, RSL_wsr88d_to_radar, RSL_LIBS="-lrsl") diff --git a/gen.sh b/gen.sh index e1ad515..c9b9949 100755 --- a/gen.sh +++ b/gen.sh @@ -1,8 +1,8 @@ #!/bin/bash dir=$(dirname $(readlink -f $0)) -# "--libdir=$dir/src/plugins" -# "--datadir=$dir/data" +PKG_CONFIG_PATH="../libgis/src/" \ ./autogen.sh \ - --enable-gtk-doc \ + "--datadir=$dir/data" \ + "--libdir=$dir/src/plugins" \ CFLAGS="-g -Werror -Wno-unused $CFLAGS" \ LDFLAGS="-Wl,-z,defs" diff --git a/src/Makefile.am b/src/Makefile.am index 3552e30..84399d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,8 @@ bin_PROGRAMS = aweather wsr88ddec aweather_SOURCES = main.c \ aweather-gui.c aweather-gui.h \ aweather-location.c aweather-location.h -aweather_CPPFLAGS = $(AM_CPPFLAGS) -DDATADIR="\"$(datadir)\"" +aweather_CPPFLAGS = $(AM_CPPFLAGS) \ + -DPKGDATADIR="\"$(pkgdatadir)\"" -DPLUGINSDIR="\"$(pkglibdir)\"" wsr88ddec = wsr88ddec.c wsr88ddec_LDADD = -lbz2 @@ -17,10 +18,10 @@ CLEANFILES = gmon.out valgrind.out MAINTAINERCLEANFILES = Makefile.in test: all - aweather -o -d 7 -s KVNX + .libs/aweather -o -d 7 -s KVNX gdb: all - gdb aweather + gdb .libs/aweather ddd: all - ddd aweather + ddd .libs/aweather diff --git a/src/aweather-gui.c b/src/aweather-gui.c index 88bd966..8edd693 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -452,16 +452,20 @@ static void aweather_gui_init(AWeatherGui *self) g_debug("AWeatherGui: init"); /* Simple things */ - self->prefs = gis_prefs_new("aweather"); - self->plugins = gis_plugins_new(); + gchar *config = g_build_filename(g_get_user_cache_dir(), "config.ini", NULL); + gchar *defaults = g_build_filename(PKGDATADIR, "defaults.ini", NULL); + self->prefs = gis_prefs_new(config, defaults); + self->plugins = gis_plugins_new(PLUGINSDIR); self->world = gis_world_new(); self->view = gis_view_new(); self->opengl = gis_opengl_new(self->world, self->view, self->plugins); + g_free(config); + g_free(defaults); /* Setup window */ self->builder = gtk_builder_new(); GError *error = NULL; - if (!gtk_builder_add_from_file(self->builder, DATADIR "/aweather/main.ui", &error)) + if (!gtk_builder_add_from_file(self->builder, PKGDATADIR "/main.ui", &error)) g_error("Failed to create gtk builder: %s", error->message); gtk_widget_reparent(aweather_gui_get_widget(self, "main_body"), GTK_WIDGET(self)); GtkWidget *paned = aweather_gui_get_widget(self, "main_paned"); @@ -471,7 +475,7 @@ static void aweather_gui_init(AWeatherGui *self) /* Plugins */ GtkTreeIter iter; self->gtk_plugins = GTK_LIST_STORE(aweather_gui_get_object(self, "plugins")); - for (GList *cur = gis_plugins_available(); cur; cur = cur->next) { + for (GList *cur = gis_plugins_available(self->plugins); cur; cur = cur->next) { gchar *name = cur->data; gboolean enabled = gis_prefs_get_boolean_v(self->prefs, cur->data, "enabled"); gtk_list_store_append(self->gtk_plugins, &iter); diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index c3718af..2dd2031 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -3,12 +3,12 @@ AM_CPPFLAGS = $(GIS_CFLAGS) AM_LDFLAGS = -module -avoid-version LIBS = $(GIS_LIBS) -plugindir = $(libdir)/gis +pluginsdir = $(PLUGINSDIR) -plugin_LTLIBRARIES = +plugins_LTLIBRARIES = if HAVE_RSL -plugin_LTLIBRARIES += radar.la +plugins_LTLIBRARIES += radar.la radar_la_SOURCES = radar.c radar.h \ marching.c marching.h \ radar-colormap.c