[libgweather] Add support for the meson build system
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] Add support for the meson build system
- Date: Mon, 27 Nov 2017 01:29:27 +0000 (UTC)
commit a5d17340753eff516ea1a1e3304643c7b5a2c3fe
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Aug 22 17:40:43 2017 +0200
Add support for the meson build system
data/{Locations.xml.in => Locations.xml} | 0
data/glade/{libgweather.xml.in => libgweather.xml} | 8 +-
data/locations.its | 14 +++
data/meson.build | 19 ++++
doc/meson.build | 17 +++
libgweather/gweather-enum-types.c.tmpl | 1 +
libgweather/gweather-enum-types.h.tmpl | 2 +
libgweather/gweather-location-entry.h | 6 +
libgweather/gweather-location.c | 2 +-
libgweather/gweather-location.h | 31 +++++-
libgweather/gweather-timezone-menu.h | 4 +
libgweather/gweather-timezone.h | 10 ++
libgweather/gweather-version.h.in | 22 ++---
libgweather/gweather-weather.h | 59 ++++++++++-
libgweather/meson.build | 106 ++++++++++++++++++
libgweather/test_locations.c | 1 +
libgweather/test_metar.c | 4 +
libgweather/test_sun_moon.c | 4 +
meson.build | 114 ++++++++++++++++++++
meson/meson_post_install.py | 10 ++
meson_options.txt | 8 ++
po-locations/POTFILES.in | 5 +-
po-locations/meson.build | 2 +
po/POTFILES.in | 2 -
po/meson.build | 2 +
schemas/meson.build | 14 +++
26 files changed, 441 insertions(+), 26 deletions(-)
---
diff --git a/data/Locations.xml.in b/data/Locations.xml
similarity index 100%
rename from data/Locations.xml.in
rename to data/Locations.xml
diff --git a/data/glade/libgweather.xml.in b/data/glade/libgweather.xml
similarity index 58%
rename from data/glade/libgweather.xml.in
rename to data/glade/libgweather.xml
index 291ace1..c6de8b3 100644
--- a/data/glade/libgweather.xml.in
+++ b/data/glade/libgweather.xml
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<glade-catalog version="3.0" name="libgweather" library="gweather-3" domain="libgweather-3.0" depends="gtk+"
book="libgweather-3.0">
<glade-widget-classes>
- <glade-widget-class name="GWeatherLocationEntry" _title="Location Entry" generic-name="locentry"
get-type-function="gweather_location_entry_get_type">
+ <glade-widget-class name="GWeatherLocationEntry" title="Location Entry" generic-name="locentry"
get-type-function="gweather_location_entry_get_type">
<!-- There are no editable properties, because GtkBuilder can't handle boxed types -->
</glade-widget-class>
- <glade-widget-class name="GWeatherTimezoneMenu" _title="Timezone Menu" generic-name="tzmenu"
get-type-function="gweather_timezone_menu_get_type">
+ <glade-widget-class name="GWeatherTimezoneMenu" title="Timezone Menu" generic-name="tzmenu"
get-type-function="gweather_timezone_menu_get_type">
<properties>
- <property id="tzid" _name="Timezone" />
+ <property id="tzid" name="Timezone" />
</properties>
</glade-widget-class>
</glade-widget-classes>
- <glade-widget-group name="GWeather" _title="GWeather">
+ <glade-widget-group name="GWeather" title="GWeather">
<glade-widget-class-ref name="GWeatherLocationEntry" />
<glade-widget-class-ref name="GWeatherTimezoneMenu" />
</glade-widget-group>
diff --git a/data/locations.its b/data/locations.its
new file mode 100644
index 0000000..9589dde
--- /dev/null
+++ b/data/locations.its
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<its:rules xmlns:its="http://www.w3.org/2005/11/its"
+ xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0"
+ version="2.0">
+ <its:translateRule selector="/gweather" translate="no"/>
+ <its:translateRule selector="//_name" translate="yes"/>
+
+ <!-- The 'msgctxt' attribute should be extracted as msgctxt. -->
+ <gt:contextRule selector="/gweather//*[@msgctxt]" contextPointer="@msgctxt"/>
+
+ <!-- Extracted strings are consumed by the library and are never
+ merged back; we don't want to escape special characters. -->
+ <gt:escapeRule selector="/interface" escape="no"/>
+</its:rules>
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..60d3d29
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,19 @@
+# FIXME check syntax of Locations.xml
+
+pkgconfig.generate(
+ filebase : 'gweather-3.0',
+ name : 'GWeather',
+ description : 'GWeather shared library',
+ version : meson.project_version(),
+ libraries : lib_libgweather,
+)
+
+if enable_glade_catalog
+ install_data('glade/libgweather.xml',
+ install_dir: glade_catalogdir)
+endif
+
+install_data('Locations.xml',
+ install_dir: pkgdatadir)
+install_data('locations.dtd',
+ install_dir: pkgdatadir)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..455ae1e
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,17 @@
+
+version_conf = configuration_data()
+version_conf.set('LIBGWEATHER_VERSION', meson.project_version())
+configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
+
+gnome.gtkdoc('libgweather',
+ main_xml: 'libgweather-docs.xml',
+ dependencies: libgweather_dep,
+ gobject_typesfile: join_paths(meson.current_source_dir(), 'libgweather.types'),
+ ignore_headers: ['gweather-enum-types.h',
+ 'gweather-parser.h',
+ 'gweather-private.h'],
+ install: true,
+ mkdb_args: ['--xml-mode', '--output-format=xml'],
+ scan_args: ['--deprecated-guards="GWEATHER_DISABLE_DEPRECATED"'],
+ src_dir: [join_paths(meson.source_root(), 'libgweather'),
+ join_paths(meson.build_root(), 'libgweather')])
diff --git a/libgweather/gweather-enum-types.c.tmpl b/libgweather/gweather-enum-types.c.tmpl
index f5c9cb3..4430bda 100644
--- a/libgweather/gweather-enum-types.c.tmpl
+++ b/libgweather/gweather-enum-types.c.tmpl
@@ -1,4 +1,5 @@
/*** BEGIN file-header ***/
+#include <config.h>
#include "gweather-enum-types.h"
#include "gweather-location.h"
#include "gweather-enums.h"
diff --git a/libgweather/gweather-enum-types.h.tmpl b/libgweather/gweather-enum-types.h.tmpl
index 935fd11..3ca1995 100644
--- a/libgweather/gweather-enum-types.h.tmpl
+++ b/libgweather/gweather-enum-types.h.tmpl
@@ -7,6 +7,7 @@
#endif
#include <glib-object.h>
+#include <libgweather/gweather-version.h>
G_BEGIN_DECLS
/*** END file-header ***/
@@ -17,6 +18,7 @@ G_BEGIN_DECLS
/*** END file-production ***/
/*** BEGIN value-header ***/
+GWEATHER_EXTERN
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define GWEATHER_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
diff --git a/libgweather/gweather-location-entry.h b/libgweather/gweather-location-entry.h
index 3fbde06..057f993 100644
--- a/libgweather/gweather-location-entry.h
+++ b/libgweather/gweather-location-entry.h
@@ -50,16 +50,22 @@ struct _GWeatherLocationEntryClass {
GtkSearchEntryClass parent_class;
};
+GWEATHER_EXTERN
GType gweather_location_entry_get_type (void);
+GWEATHER_EXTERN
GtkWidget *gweather_location_entry_new (GWeatherLocation *top);
+GWEATHER_EXTERN
void gweather_location_entry_set_location (GWeatherLocationEntry *entry,
GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_entry_get_location (GWeatherLocationEntry *entry);
+GWEATHER_EXTERN
gboolean gweather_location_entry_has_custom_text (GWeatherLocationEntry *entry);
+GWEATHER_EXTERN
gboolean gweather_location_entry_set_city (GWeatherLocationEntry *entry,
const char *city_name,
const char *code);
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index d2d70c8..cde231c 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -159,7 +159,7 @@ location_new_from_xml (GWeatherParser *parser, GWeatherLocationLevel level,
}
tagname = (const char *) xmlTextReaderConstName (parser->xml);
- if (!strcmp (tagname, "name") && !loc->english_name) {
+ if ((!strcmp (tagname, "name") || !strcmp (tagname, "_name")) && !loc->english_name) {
loc->msgctxt = _gweather_parser_get_msgctxt_value (parser);
value = _gweather_parser_get_value (parser);
if (!value)
diff --git a/libgweather/gweather-location.h b/libgweather/gweather-location.h
index 2388772..5e50faa 100644
--- a/libgweather/gweather-location.h
+++ b/libgweather/gweather-location.h
@@ -47,34 +47,48 @@ typedef enum { /*< underscore_name=gweather_location_level >*/
GWEATHER_LOCATION_DETACHED
} GWeatherLocationLevel;
+GWEATHER_EXTERN
GType gweather_location_get_type (void);
#define GWEATHER_TYPE_LOCATION (gweather_location_get_type ())
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_get_world (void);
-G_DEPRECATED_FOR(gweather_location_get_world)
+GWEATHER_EXTERN G_DEPRECATED_FOR(gweather_location_get_world)
GWeatherLocation *gweather_location_new_world (gboolean use_regions);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_ref (GWeatherLocation *loc);
+GWEATHER_EXTERN
void gweather_location_unref (GWeatherLocation *loc);
+GWEATHER_EXTERN
const char *gweather_location_get_name (GWeatherLocation *loc);
+GWEATHER_EXTERN
const char *gweather_location_get_sort_name (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocationLevel gweather_location_get_level (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_get_parent (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocation **gweather_location_get_children (GWeatherLocation *loc);
+GWEATHER_EXTERN
gboolean gweather_location_has_coords (GWeatherLocation *loc);
+GWEATHER_EXTERN
void gweather_location_get_coords (GWeatherLocation *loc,
double *latitude,
double *longitude);
+GWEATHER_EXTERN
double gweather_location_get_distance (GWeatherLocation *loc,
GWeatherLocation *loc2);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_find_nearest_city (GWeatherLocation *loc,
double lat,
double lon);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_find_nearest_city_full (GWeatherLocation *loc,
double lat,
double lon,
@@ -82,37 +96,52 @@ GWeatherLocation *gweather_location_find_nearest_city_full (GWeatherLocatio
gpointer user_data,
GDestroyNotify destroy);
+GWEATHER_EXTERN
void gweather_location_detect_nearest_city (GWeatherLocation *loc,
double lat,
double lon,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_detect_nearest_city_finish (GAsyncResult *result, GError **error);
+GWEATHER_EXTERN
const char *gweather_location_get_country (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherTimezone *gweather_location_get_timezone (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherTimezone **gweather_location_get_timezones (GWeatherLocation *loc);
+GWEATHER_EXTERN
void gweather_location_free_timezones (GWeatherLocation *loc,
GWeatherTimezone **zones);
+GWEATHER_EXTERN
const char *gweather_location_get_code (GWeatherLocation *loc);
+GWEATHER_EXTERN
char *gweather_location_get_city_name (GWeatherLocation *loc);
+GWEATHER_EXTERN
char *gweather_location_get_country_name (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_find_by_station_code (GWeatherLocation *world,
const gchar *station_code);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_find_by_country_code (GWeatherLocation *world,
const gchar *country_code);
+GWEATHER_EXTERN
gboolean gweather_location_equal (GWeatherLocation *one,
GWeatherLocation *two);
+GWEATHER_EXTERN
GVariant *gweather_location_serialize (GWeatherLocation *loc);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_deserialize (GWeatherLocation *world,
GVariant *serialized);
+GWEATHER_EXTERN
GWeatherLocation *gweather_location_new_detached (const char *name,
const char *icao,
gdouble latitude,
diff --git a/libgweather/gweather-timezone-menu.h b/libgweather/gweather-timezone-menu.h
index 62e46f3..9265d92 100644
--- a/libgweather/gweather-timezone-menu.h
+++ b/libgweather/gweather-timezone-menu.h
@@ -50,12 +50,16 @@ struct _GWeatherTimezoneMenuClass {
};
+GWEATHER_EXTERN
GType gweather_timezone_menu_get_type (void);
+GWEATHER_EXTERN
GtkWidget *gweather_timezone_menu_new (GWeatherLocation *top);
+GWEATHER_EXTERN
void gweather_timezone_menu_set_tzid (GWeatherTimezoneMenu *menu,
const char *tzid);
+GWEATHER_EXTERN
const char *gweather_timezone_menu_get_tzid (GWeatherTimezoneMenu *menu);
#endif
diff --git a/libgweather/gweather-timezone.h b/libgweather/gweather-timezone.h
index 540724e..eaab589 100644
--- a/libgweather/gweather-timezone.h
+++ b/libgweather/gweather-timezone.h
@@ -31,19 +31,29 @@ G_BEGIN_DECLS
typedef struct _GWeatherTimezone GWeatherTimezone;
+GWEATHER_EXTERN
GType gweather_timezone_get_type (void);
#define GWEATHER_TYPE_TIMEZONE (gweather_timezone_get_type ())
+GWEATHER_EXTERN
const char *gweather_timezone_get_name (GWeatherTimezone *zone);
+GWEATHER_EXTERN
const char *gweather_timezone_get_tzid (GWeatherTimezone *zone);
+GWEATHER_EXTERN
int gweather_timezone_get_offset (GWeatherTimezone *zone);
+GWEATHER_EXTERN
gboolean gweather_timezone_has_dst (GWeatherTimezone *zone);
+GWEATHER_EXTERN
int gweather_timezone_get_dst_offset (GWeatherTimezone *zone);
+GWEATHER_EXTERN
GWeatherTimezone *gweather_timezone_ref (GWeatherTimezone *zone);
+GWEATHER_EXTERN
void gweather_timezone_unref (GWeatherTimezone *zone);
+GWEATHER_EXTERN
GWeatherTimezone *gweather_timezone_get_utc (void);
+GWEATHER_EXTERN
GWeatherTimezone *gweather_timezone_get_by_tzid (const char *tzid);
G_END_DECLS
diff --git a/libgweather/gweather-version.h.in b/libgweather/gweather-version.h.in
index 3554d49..51c9360 100644
--- a/libgweather/gweather-version.h.in
+++ b/libgweather/gweather-version.h.in
@@ -28,6 +28,10 @@
#error "gweather-version.h must not be included individually, include gweather.h instead"
#endif
+#ifndef GWEATHER_EXTERN
+#define GWEATHER_EXTERN extern
+#endif
+
/**
* SECTION:gweatherversion
* @short_description: libgweather version checking
@@ -43,7 +47,7 @@
*
* Since: 3.12
*/
-#define GWEATHER_MAJOR_VERSION (@LIBGWEATHER_MAJOR_VERSION@)
+#mesondefine GWEATHER_MAJOR_VERSION
/**
* GWEATHER_MINOR_VERSION:
@@ -52,7 +56,7 @@
*
* Since: 3.12
*/
-#define GWEATHER_MINOR_VERSION (@LIBGWEATHER_MINOR_VERSION@)
+#mesondefine GWEATHER_MINOR_VERSION
/**
* GWEATHER_MICRO_VERSION:
@@ -61,7 +65,7 @@
*
* Since: 3.12
*/
-#define GWEATHER_MICRO_VERSION (@LIBGWEATHER_MICRO_VERSION@)
+#mesondefine GWEATHER_MICRO_VERSION
/**
* GWEATHER_VERSION
@@ -70,17 +74,7 @@
*
* Since: 3.12
*/
-#define GWEATHER_VERSION (@LIBGWEATHER_VERSION@)
-
-/**
- * GWEATHER_VERSION_S:
- *
- * LibGweather version, encoded as a string, useful for printing and
- * concatenation.
- *
- * Since: 3.12
- */
-#define GWEATHER_VERSION_S "@LIBGWEATHER_VERSION@"
+#mesondefine GWEATHER_VERSION
/**
* GWEATHER_VERSION_HEX:
diff --git a/libgweather/gweather-weather.h b/libgweather/gweather-weather.h
index b5125b5..75bb36c 100644
--- a/libgweather/gweather-weather.h
+++ b/libgweather/gweather-weather.h
@@ -75,53 +75,88 @@ struct _GWeatherInfoClass {
void (*updated) (GWeatherInfo *info);
};
+GWEATHER_EXTERN
GType gweather_info_get_type (void) G_GNUC_CONST;
+GWEATHER_EXTERN
GWeatherInfo * gweather_info_new (GWeatherLocation *location,
GWeatherForecastType type);
+GWEATHER_EXTERN
void gweather_info_update (GWeatherInfo *info);
+GWEATHER_EXTERN
void gweather_info_abort (GWeatherInfo *info);
+GWEATHER_EXTERN
void gweather_info_store_cache (void);
+GWEATHER_EXTERN
GWeatherProvider gweather_info_get_enabled_providers (GWeatherInfo *info);
+GWEATHER_EXTERN
void gweather_info_set_enabled_providers (GWeatherInfo *info,
GWeatherProvider providers);
+GWEATHER_EXTERN
gboolean gweather_info_is_valid (GWeatherInfo *info);
+GWEATHER_EXTERN
gboolean gweather_info_network_error (GWeatherInfo *info);
+GWEATHER_EXTERN
const GWeatherLocation * gweather_info_get_location (GWeatherInfo *info);
+GWEATHER_EXTERN
void gweather_info_set_location (GWeatherInfo *info,
GWeatherLocation *location);
+GWEATHER_EXTERN
gchar * gweather_info_get_location_name (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_update (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_sky (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_conditions (GWeatherInfo *info);
-G_DEPRECATED_FOR(gweather_info_get_forecast_list)
+GWEATHER_EXTERN G_DEPRECATED_FOR(gweather_info_get_forecast_list)
gchar * gweather_info_get_forecast (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_temp (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_temp_min (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_temp_max (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_dew (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_humidity (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_wind (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_pressure (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_visibility (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_apparent (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_sunrise (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_sunset (GWeatherInfo *info);
+GWEATHER_EXTERN
GSList * gweather_info_get_forecast_list (GWeatherInfo *info);
+GWEATHER_EXTERN
GdkPixbufAnimation * gweather_info_get_radar (GWeatherInfo *info);
+GWEATHER_EXTERN
const gchar *gweather_info_get_attribution (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_temp_summary (GWeatherInfo *info);
+GWEATHER_EXTERN
gchar * gweather_info_get_weather_summary (GWeatherInfo *info);
+GWEATHER_EXTERN
const gchar * gweather_info_get_icon_name (GWeatherInfo *info);
+GWEATHER_EXTERN
const gchar * gweather_info_get_symbolic_icon_name (GWeatherInfo *info);
+GWEATHER_EXTERN
gint gweather_info_next_sun_event (GWeatherInfo *info);
+GWEATHER_EXTERN
gboolean gweather_info_is_daytime (GWeatherInfo *info);
/* values retrieving functions */
@@ -174,7 +209,9 @@ typedef enum { /*< underscore_name=gweather_wind_direction >*/
GWEATHER_WIND_LAST
} GWeatherWindDirection;
+GWEATHER_EXTERN
const gchar * gweather_wind_direction_to_string (GWeatherWindDirection wind);
+GWEATHER_EXTERN
const gchar * gweather_wind_direction_to_string_full (GWeatherWindDirection wind,
GWeatherFormatOptions options);
@@ -203,7 +240,9 @@ typedef enum { /*< underscore_name=gweather_sky >*/
GWEATHER_SKY_LAST
} GWeatherSky;
+GWEATHER_EXTERN
const gchar * gweather_sky_to_string (GWeatherSky sky);
+GWEATHER_EXTERN
const gchar * gweather_sky_to_string_full (GWeatherSky sky,
GWeatherFormatOptions options);
@@ -319,20 +358,35 @@ typedef gdouble GWeatherMoonPhase;
*/
typedef gdouble GWeatherMoonLatitude;
+GWEATHER_EXTERN
gboolean gweather_info_get_value_update (GWeatherInfo *info, time_t *value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_sky (GWeatherInfo *info, GWeatherSky *sky);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_conditions (GWeatherInfo *info, GWeatherConditionPhenomenon *phenomenon,
GWeatherConditionQualifier *qualifier);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_temp (GWeatherInfo *info, GWeatherTemperatureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_temp_min (GWeatherInfo *info, GWeatherTemperatureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_temp_max (GWeatherInfo *info, GWeatherTemperatureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_dew (GWeatherInfo *info, GWeatherTemperatureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_apparent (GWeatherInfo *info, GWeatherTemperatureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_wind (GWeatherInfo *info, GWeatherSpeedUnit unit, gdouble *speed,
GWeatherWindDirection *direction);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_pressure (GWeatherInfo *info, GWeatherPressureUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_visibility (GWeatherInfo *info, GWeatherDistanceUnit unit, gdouble
*value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_sunrise (GWeatherInfo *info, time_t *value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_sunset (GWeatherInfo *info, time_t *value);
+GWEATHER_EXTERN
gboolean gweather_info_get_value_moonphase (GWeatherInfo *info, GWeatherMoonPhase *value,
GWeatherMoonLatitude *lat);
+GWEATHER_EXTERN
gboolean gweather_info_get_upcoming_moonphases (GWeatherInfo *info, time_t *phases);
typedef struct _GWeatherConditions GWeatherConditions;
@@ -359,10 +413,13 @@ struct _GWeatherConditions {
GWeatherConditionQualifier qualifier;
};
+GWEATHER_EXTERN
const gchar * gweather_conditions_to_string (GWeatherConditions *conditions);
+GWEATHER_EXTERN
const gchar * gweather_conditions_to_string_full (GWeatherConditions *conditions,
GWeatherFormatOptions options);
+GWEATHER_EXTERN
GWeatherTemperatureUnit gweather_temperature_unit_to_real (GWeatherTemperatureUnit unit);
G_END_DECLS
diff --git a/libgweather/meson.build b/libgweather/meson.build
new file mode 100644
index 0000000..e41a0b6
--- /dev/null
+++ b/libgweather/meson.build
@@ -0,0 +1,106 @@
+add_global_arguments([
+ '-DHAVE_CONFIG_H',
+ '-I' + meson.build_root(),
+ '-I' + meson.source_root(),
+ '-DGWEATHER_COMPILATION',
+ '-D_XOPEN_SOURCE=700',
+ '-D_DEFAULT_SOURCE',
+], language: 'c')
+
+headerdir = join_paths(includedir, 'libgweather-3.0/libgweather')
+
+versionconf = configuration_data()
+versionconf.set('GWEATHER_MAJOR_VERSION', libgweather_version[0])
+versionconf.set('GWEATHER_MINOR_VERSION',
+libgweather_version[1])
+versionconf.set('GWEATHER_MICRO_VERSION',
+libgweather_version[2])
+versionconf.set_quoted('GWEATHER_VERSION', meson.project_version())
+configure_file(
+ input: 'gweather-version.h.in',
+ output: 'gweather-version.h',
+ configuration: versionconf,
+ install: true,
+ install_dir: headerdir
+)
+
+gweather_new_headers = [
+ 'gweather.h',
+ 'gweather-location.h',
+ 'gweather-location-entry.h',
+ 'gweather-timezone.h',
+ 'gweather-timezone-menu.h',
+ 'gweather-weather.h',
+ 'gweather-enums.h'
+]
+gweather_enum_types = gnome.mkenums('gweather-enum-types',
+ sources: gweather_new_headers,
+ c_template: 'gweather-enum-types.c.tmpl',
+ h_template: 'gweather-enum-types.h.tmpl',
+ install_header: true,
+ install_dir: headerdir)
+install_headers(gweather_new_headers,
+ install_dir: headerdir)
+
+gweather_c_sources = [
+ gweather_enum_types,
+ 'gweather.c',
+ 'gweather-private.c',
+ 'gweather-weather.c',
+ 'weather-metar.c',
+ 'weather-iwin.c',
+ 'weather-yahoo.c',
+ 'weather-wx.c',
+ 'weather-yrno.c',
+ 'weather-owm.c',
+ 'weather-sun.c',
+ 'weather-moon.c',
+ 'gweather-location.c',
+ 'gweather-timezone.c',
+ 'gweather-location-entry.c',
+ 'gweather-timezone-menu.c',
+ 'gweather-parser.c']
+introspection_sources = gweather_c_sources + gweather_new_headers
+
+lib_libgweather = shared_library('gweather-3',
+ gweather_c_sources,
+ dependencies : deps_libgweather,
+ version : libgweather_so_version,
+ install : true
+)
+libgweather_dep = declare_dependency(sources: [gweather_enum_types[1]],
+ dependencies: deps_libgweather,
+ link_with: lib_libgweather)
+
+executable('test_locations',
+ ['test_locations.c'],
+ dependencies: libgweather_dep,
+ install: false)
+#executable('test_metar',
+# ['test_metar.c', 'weather-metar.c'],
+# dependencies: libgweather_dep,
+# install: false)
+#executable('test_sun_moon',
+# ['test_sun_moon.c', 'weather-sun.c', 'weather-moon.c'],
+# dependencies: libgweather_dep,
+# install: false)
+
+gweather_gir = gnome.generate_gir(lib_libgweather,
+ sources: introspection_sources,
+ dependencies: deps_libgweather,
+ nsversion: '3.0',
+ namespace: 'GWeather',
+ includes: ['GObject-2.0', 'Gtk-3.0'],
+ symbol_prefix: 'gweather',
+ identifier_prefix: 'GWeather',
+ export_packages: 'gweather-3.0',
+ extra_args: ['--warn-all', '--c-include=libgweather/gweather.h'],
+ install: true)
+
+if enable_vala
+ gnome.generate_vapi('gweather-3.0',
+ sources: gweather_gir[0],
+ packages: ['gobject-2.0', 'gtk+-3.0'],
+ metadata_dirs: '.',
+ install: true)
+endif
diff --git a/libgweather/test_locations.c b/libgweather/test_locations.c
index b52e67b..fcb39f9 100644
--- a/libgweather/test_locations.c
+++ b/libgweather/test_locations.c
@@ -1,4 +1,5 @@
+#include <gweather-version.h>
#include "gweather-location-entry.h"
#include "gweather-timezone-menu.h"
diff --git a/libgweather/test_metar.c b/libgweather/test_metar.c
index 1527b4a..74c9d9a 100644
--- a/libgweather/test_metar.c
+++ b/libgweather/test_metar.c
@@ -3,6 +3,10 @@
* Simple program to reproduce METAR parsing results from command line
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <glib.h>
#include <string.h>
#include <stdio.h>
diff --git a/libgweather/test_sun_moon.c b/libgweather/test_sun_moon.c
index 57c1b4e..33cada1 100644
--- a/libgweather/test_sun_moon.c
+++ b/libgweather/test_sun_moon.c
@@ -1,5 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <glib.h>
#include <string.h>
#include <time.h>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..17a662c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,114 @@
+project('libgweather', 'c',
+ version: '3.27.1',
+ meson_version: '>= 0.36.0',
+)
+
+libgweather_version = meson.project_version().split('.')
+
+# We use libtool-version numbers because it's easier to understand.
+# Before making a release, the libgweather_so_*
+# numbers should be modified. The components are of the form C:R:A.
+# a) If binary compatibility has been broken (eg removed or changed interfaces)
+# change to C+1:0:0.
+# b) If interfaces have been changed or added, but binary compatibility has
+# been preserved, change to C+1:0:A+1
+# c) If the interface is the same as the previous version, change to C:R+1:A
+libgweather_lt_c=14
+libgweather_lt_r=0
+libgweather_lt_a=8
+
+# convert to soname
+libgweather_so_version = '@0@.@1@.@2@'.format((libgweather_lt_c - libgweather_lt_a),
+ libgweather_lt_a, libgweather_lt_r)
+
+pkgconfig = import('pkgconfig')
+gnome = import('gnome')
+i18n = import('i18n')
+
+prefix = get_option('prefix')
+
+bindir = join_paths(prefix, get_option('bindir'))
+datadir = join_paths(prefix, get_option('datadir'))
+libdir = join_paths(prefix, get_option('libdir'))
+includedir = join_paths(prefix, get_option('includedir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+sysconfdir = join_paths(prefix, get_option('sysconfdir'))
+pkgdatadir = join_paths(datadir, 'libgweather')
+
+c_compiler = meson.get_compiler('c')
+gtk_dep = dependency('gtk+-3.0', version: '>=3.13.5')
+glib_dep = dependency('gio-2.0', version: '>=2.35.1')
+libsoup_dep = dependency('libsoup-2.4', version: '>=2.44.0')
+libxml_dep = dependency('libxml-2.0', version: '>=2.6.0')
+geocode_glib_dep = dependency('geocode-glib-1.0')
+math_dep = c_compiler.find_library('m', required : false)
+deps_libgweather = [math_dep, gtk_dep, glib_dep, libsoup_dep, libxml_dep, geocode_glib_dep]
+
+config_h = configuration_data()
+GETTEXT_PACKAGE = 'gweather-3.0'
+config_h.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE)
+config_h.set_quoted('LOCALEDIR', join_paths(datadir, 'locale'))
+config_h.set_quoted('GNOMELOCALEDIR', join_paths(datadir, 'locale'))
+config_h.set_quoted('G_LOG_DOMAIN', 'GWeather')
+config_h.set_quoted('GWEATHER_XML_LOCATION_DIR', pkgdatadir)
+
+if c_compiler.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
+ config_h.set('HAVE_TM_TM_GMOFF', 1)
+endif
+
+if c_compiler.has_header_symbol('time.h', 'timezone')
+ config_h.set('HAVE_TIMEZONE', 1)
+endif
+
+if c_compiler.links('char c; c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));', prefix:
'#include <langinfo.h>')
+ config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1)
+endif
+
+config_h.set_quoted('ZONEINFO_DIR', get_option('with-zoneinfo-dir'))
+config_h.set_quoted('OWM_APIKEY', get_option('with-owm-apikey'))
+
+if get_option('default_library') != 'static'
+ if host_machine.system() == 'windows'
+ config_h.set('DLL_EXPORT', true)
+ if cc.get_id() == 'msvc'
+ config_h.set('GWEATHER_EXTERN', '__declspec(dllexport) extern')
+ else
+ config_h.set('GWEATHER_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
+ add_global_arguments(['-fvisibility=hidden'], language: 'c')
+ endif
+ else
+ config_h.set('GWEATHER_EXTERN', '__attribute__((visibility("default"))) extern')
+ add_global_arguments(['-fvisibility=hidden'], language: 'c')
+ endif
+endif
+
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h,
+)
+
+if get_option('enable-glade-catalog') == 'no'
+ enable_glade_catalog = false
+else
+ glade_dep = dependency('gladeui-2.0', required: (get_option('enable-glade-catalog') == 'yes'))
+ enable_glade_catalog = glade_dep.found()
+ if enable_glade_catalog
+ glade_catalogdir = glade_dep.get_pkgconfig_variable('catalogdir')
+ endif
+endif
+
+enable_vala = get_option('enable-vala')
+if enable_vala == 'auto'
+ enable_vala = find_program('vapigen', required: false).found()
+else
+ enable_vala = enable_vala != 'no'
+endif
+
+subdir('libgweather')
+subdir('data')
+subdir('schemas')
+subdir('doc')
+subdir('po')
+subdir('po-locations')
+meson.add_install_script('meson/meson_post_install.py')
diff --git a/meson/meson_post_install.py b/meson/meson_post_install.py
new file mode 100755
index 0000000..76ed255
--- /dev/null
+++ b/meson/meson_post_install.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+ print('Compiling gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..3476082
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,8 @@
+option('with-zoneinfo-dir', type: 'string', value: '/usr/share/zoneinfo',
+ description: 'zoneinfo directory')
+option('with-owm-apikey', type: 'string', value: '',
+ description: 'Specify an API key for OpenWeatherMap (optional)')
+option('enable-glade-catalog', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto',
+ description: 'Install a glade catalog file')
+option('enable-vala', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto',
+ description: 'Install vala bindings')
diff --git a/po-locations/POTFILES.in b/po-locations/POTFILES.in
index 0c12af0..6dac565 100644
--- a/po-locations/POTFILES.in
+++ b/po-locations/POTFILES.in
@@ -1,4 +1,3 @@
-# This list should contain *only* data/Locations.xml.in.
+# This list should contain *only* data/Locations.xml.
# Everything else should be in POTFILES.skip.
-[encoding:UTF-8]
-data/Locations.xml.in
+data/Locations.xml
diff --git a/po-locations/meson.build b/po-locations/meson.build
new file mode 100644
index 0000000..ec9cf07
--- /dev/null
+++ b/po-locations/meson.build
@@ -0,0 +1,2 @@
+i18n.gettext('libgweather-locations',
+ args: ['--its', join_paths(meson.source_root(), 'data/locations.its')])
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e1da5f2..23b28da 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,6 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
#
-[encoding: UTF-8]
-data/glade/libgweather.xml.in
libgweather/gweather-location.c
libgweather/gweather-location-entry.c
libgweather/gweather-parser.c
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..0136c4c
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,2 @@
+i18n.gettext('libgweather-3.0',
+ preset: 'glib')
diff --git a/schemas/meson.build b/schemas/meson.build
new file mode 100644
index 0000000..d7f341c
--- /dev/null
+++ b/schemas/meson.build
@@ -0,0 +1,14 @@
+gsettingsdir = join_paths(datadir, 'glib-2.0', 'schemas')
+install_data('org.gnome.GWeather.gschema.xml',
+ install_dir : gsettingsdir)
+
+gnome.mkenums('org.gnome.GWeather.enums.xml',
+ comments: '<!-- @comment@ -->',
+ fhead: '<schemalist>',
+ vhead: '<@type@ id="org.gnome.GWeather.@EnumName@">',
+ vprod: '<value nick="@valuenick@" value="@valuenum@"/>',
+ vtail: '</@type@>',
+ ftail: '</schemalist>',
+ sources: ['../libgweather/gweather-enums.h'],
+ install_header: true,
+ install_dir: gsettingsdir)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]