From edb70371e2b56824f803465bdfac93cb0f1878aa Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Mon, 8 Sep 2014 11:19:37 +0200 Subject: [PATCH] Aggiunto il pacchetto libgweather. --- packages/mingw-w64-libgweather/001-win.patch | 271 +++++++++++++++++++ packages/mingw-w64-libgweather/PKGBUILD | 51 ++++ 2 files changed, 322 insertions(+) create mode 100644 packages/mingw-w64-libgweather/001-win.patch create mode 100644 packages/mingw-w64-libgweather/PKGBUILD diff --git a/packages/mingw-w64-libgweather/001-win.patch b/packages/mingw-w64-libgweather/001-win.patch new file mode 100644 index 0000000..0548e49 --- /dev/null +++ b/packages/mingw-w64-libgweather/001-win.patch @@ -0,0 +1,271 @@ +--- ./libgweather/Makefile.am.orig 2014-09-07 18:29:45.795392300 +0200 ++++ ./libgweather/Makefile.am 2014-09-07 18:29:16.289735000 +0200 +@@ -87,6 +87,7 @@ + INTROSPECTION_GIRS = + INTROSPECTION_SCANNER_ARGS = --warn-all --add-include-path=$(srcdir) --c-include=libgweather/gweather.h + INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) ++INTROSPECTION_SCANNER_ENV = CC="$(CC)" + + if HAVE_INTROSPECTION + introspection_sources = \ +--- ./libgweather/weather-iwin.c.orig 2014-09-07 17:25:15.852668400 +0200 ++++ ./libgweather/weather-iwin.c 2014-09-07 17:26:07.678605100 +0200 +@@ -364,7 +364,14 @@ + gchar latstr[G_ASCII_DTOSTR_BUF_SIZE], lonstr[G_ASCII_DTOSTR_BUF_SIZE]; + + now = time (NULL); ++#ifndef G_OS_WIN32 + localtime_r (&now, &tm); ++#else ++ GDate *gdate = g_date_new (); ++ g_date_set_time_t (gdate, now); ++ g_date_to_struct_tm (gdate, &tm); ++ g_date_free (gdate); ++#endif + + g_ascii_dtostr (latstr, sizeof(latstr), RADIANS_TO_DEGREES (loc->latitude)); + g_ascii_dtostr (lonstr, sizeof(lonstr), RADIANS_TO_DEGREES (loc->longitude)); +--- ./libgweather/weather-metar.c.orig 2014-09-07 17:23:43.223452300 +0200 ++++ ./libgweather/weather-metar.c 2014-09-07 17:25:51.173668900 +0200 +@@ -47,7 +47,14 @@ + const time_t now = time (NULL); + struct tm tm; + ++#ifndef G_OS_WIN32 + localtime_r (&now, &tm); ++#else ++ GDate *gdate = g_date_new (); ++ g_date_set_time_t (gdate, now); ++ g_date_to_struct_tm (gdate, &tm); ++ g_date_free (gdate); ++#endif + + /* If last reading took place just before midnight UTC on the + * first, adjust the date downward to allow for the month +--- ./libgweather/weather-owm.c.orig 2014-03-08 19:38:42.000000000 +0100 ++++ ./libgweather/weather-owm.c 2014-09-07 17:58:20.405807600 +0200 +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -38,6 +37,10 @@ + #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE + #include "weather-priv.h" + ++#ifndef G_OS_WIN32 ++#include ++#endif ++ + #define XC(t) ((const xmlChar *)(t)) + + /* Reference for symbols at http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes */ +@@ -133,16 +136,39 @@ + GTimeZone *tz; + GDateTime *dt; + time_t rval; +- char *after; +- +- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time); +- if (after == NULL) { +- g_warning ("Cannot parse date string \"%s\"", str); +- return 0; +- } + +- if (*after == 'Z') +- tzid = "UTC"; ++#ifndef G_OS_WIN32 ++ char *after; ++ after = strptime ((const char*) str, "%Y-%m-%dT%T", &time); ++ if (after == NULL) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ if (*after == 'Z') ++ tzid = "UTC"; ++#else ++ int year; ++ int mon; ++ int mday; ++ int hour; ++ int min; ++ int sec; ++ char *gctz; ++ int parsed = scanf ((const char*) str, "%d-%d-%dT%d:%d:%d%s", ++ &year, &mon, &mday, &hour, &min, &sec, &gctz); ++ if (parsed != 7) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ time.tm_year = year + 1900; ++ time.tm_mon = mon + 1; ++ time.tm_mday = mday; ++ time.tm_hour = hour; ++ time.tm_min = min; ++ time.tm_sec = sec; ++ if (*gctz == 'Z') ++ tzid = "UTC"; ++#endif + + tz = g_time_zone_new (tzid); + dt = g_date_time_new (tz, +--- ./libgweather/weather-priv.h.orig 2014-09-07 17:09:34.535003100 +0200 ++++ ./libgweather/weather-priv.h 2014-09-07 17:09:36.914103100 +0200 +@@ -31,10 +31,6 @@ + #include "gweather-weather.h" + #include "gweather-location.h" + +-#ifdef _WIN32 +-#include "gweather-win32.h" +-#endif +- + void _gweather_gettext_init (void); + + struct _GWeatherLocation { +--- ./libgweather/weather-sun.c.orig 2014-09-07 17:53:39.134081200 +0200 ++++ ./libgweather/weather-sun.c 2014-09-07 17:54:30.044591900 +0200 +@@ -322,7 +322,14 @@ + _gweather_info_ensure_sun (info); + + /* Determine when the next local midnight occurs */ ++#ifndef G_OS_WIN32 + (void) localtime_r (&now, <m); ++#else ++ GDate *gdate = g_date_new (); ++ g_date_set_time_t (gdate, now); ++ g_date_to_struct_tm (gdate, <m); ++ g_date_free (gdate); ++#endif + ltm.tm_sec = 0; + ltm.tm_min = 0; + ltm.tm_hour = 0; +--- ./libgweather/weather-yahoo.c.orig 2014-03-08 19:38:42.000000000 +0100 ++++ ./libgweather/weather-yahoo.c 2014-09-07 18:25:56.929726100 +0200 +@@ -151,10 +151,54 @@ + { + struct tm time = { 0 }; + ++#ifndef G_OS_WIN32 + if (!strptime ((const char*) str, "%d %b %Y", &time)) { + g_warning ("Cannot parse date string \"%s\"", str); + return 0; + } ++#else ++ int day; ++ char *month; ++ int year; ++ int i; ++ GDateTime *gdt; ++ GDateTime *gdt_now; ++ GDateTime *gdt_tmp; ++ int parsed = scanf ((const char*) str, "%d %s %d", ++ &day, &month, &year); ++ if (parsed != 3) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ time.tm_year = year + 1900; ++ ++ gdt_now = g_date_time_new_now_local (); ++ gdt = g_date_time_new_local (g_date_time_get_year (gdt_now), 1, 1, 0, 0, 0); ++ for (i = 0; i < 12; i++) ++ { ++ gdt_tmp = g_date_time_add_months (gdt, i); ++ if (g_strcmp0 (g_date_time_format (gdt_tmp, "%b"), month) == 0) ++ { ++ time.tm_mon = g_date_time_get_month (gdt) + 1; ++ break; ++ } ++ else if (g_strcmp0 (g_date_time_format (gdt_tmp, "%B"), month) == 0) ++ { ++ time.tm_mon = g_date_time_get_month (gdt) + 1; ++ break; ++ } ++ g_date_time_unref (gdt_tmp); ++ } ++ if (time.tm_mon == 0) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ ++ time.tm_mday = day; ++ ++ g_date_time_unref (gdt_now); ++ g_date_time_unref (gdt); ++#endif + + return mktime(&time); + } +--- ./libgweather/weather-yrno.c.orig 2014-09-07 17:34:08.504436200 +0200 ++++ ./libgweather/weather-yrno.c 2014-09-07 17:58:24.358807100 +0200 +@@ -94,16 +94,39 @@ + GTimeZone *tz; + GDateTime *dt; + time_t rval; +- char *after; + +- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time); +- if (after == NULL) { +- g_warning ("Cannot parse date string \"%s\"", str); +- return 0; +- } +- +- if (*after == 'Z') +- tzid = "UTC"; ++#ifndef G_OS_WIN32 ++ char *after; ++ after = strptime ((const char*) str, "%Y-%m-%dT%T", &time); ++ if (after == NULL) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ if (*after == 'Z') ++ tzid = "UTC"; ++#else ++ int year; ++ int mon; ++ int mday; ++ int hour; ++ int min; ++ int sec; ++ char *gctz; ++ int parsed = scanf ((const char*) str, "%d-%d-%dT%d:%d:%d%s", ++ &year, &mon, &mday, &hour, &min, &sec, &gctz); ++ if (parsed != 7) { ++ g_warning ("Cannot parse date string \"%s\"", str); ++ return 0; ++ } ++ time.tm_year = year + 1900; ++ time.tm_mon = mon + 1; ++ time.tm_mday = mday; ++ time.tm_hour = hour; ++ time.tm_min = min; ++ time.tm_sec = sec; ++ if (*gctz == 'Z') ++ tzid = "UTC"; ++#endif + + tz = g_time_zone_new (tzid); + dt = g_date_time_new (tz, +--- ./libgweather/weather.c.orig 2014-09-07 17:18:05.621641500 +0200 ++++ ./libgweather/weather.c 2014-09-07 17:27:17.789137400 +0200 +@@ -28,12 +28,15 @@ + #include + #include + #include +-#include + + #include + #include + #include + ++#ifndef G_OS_WIN32 ++#include ++#endif ++ + #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE + #include "gweather-weather.h" + #include "weather-priv.h" diff --git a/packages/mingw-w64-libgweather/PKGBUILD b/packages/mingw-w64-libgweather/PKGBUILD new file mode 100644 index 0000000..836d594 --- /dev/null +++ b/packages/mingw-w64-libgweather/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: Andrea Zagli + +_realname=libgweather +pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" +pkgver=3.13.91 +pkgrel=1 +arch=('any') +pkgdesc="GWeather shared library (mingw-w64)" +depends=("${MINGW_PACKAGE_PREFIX}-gtk3" + "${MINGW_PACKAGE_PREFIX}-libsoup" + "${MINGW_PACKAGE_PREFIX}-libxml2" + "${MINGW_PACKAGE_PREFIX}-geocode-glib") +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-gtk-doc" + "${MINGW_PACKAGE_PREFIX}-vala" + "${MINGW_PACKAGE_PREFIX}-gobject-introspection" + "${MINGW_PACKAGE_PREFIX}-glade" + "intltool") +options=('strip' 'staticlibs') +license=("LGPL 2.1") +url="http://www.gnome.org/" +source=(http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver:0:4}/${_realname}-$pkgver.tar.xz + 001-win.patch) +sha256sums=('f4871d5d19b463e130651665fc922c981f592c244db3074e4444689319deeb00' + '54aafa1ec47f818855cb8d17bb4f7f4458505a54b08c9fc51bfd4bbc1d6c37a2') + +prepare() { + cd ${_realname}-${pkgver} + patch -p1 -i ${srcdir}/001-win.patch + + AUTOPOINT='intltoolize --automake --copy' autoreconf -fi +} + +build() { + mkdir -p build-${MINGW_CHOST} + cd build-${MINGW_CHOST} + + ../${_realname}-${pkgver}/configure \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --libexecdir=${MINGW_PREFIX}/lib \ + --enable-introspection=no + make +} + +package() { + cd "$srcdir/build-${MINGW_CHOST}" + make DESTDIR=$pkgdir install +} -- 2.49.0