libgweather r540 - in trunk: . doc libgweather
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: libgweather r540 - in trunk: . doc libgweather
- Date: Tue, 2 Dec 2008 18:12:03 +0000 (UTC)
Author: vuntz
Date: Tue Dec 2 18:12:03 2008
New Revision: 540
URL: http://svn.gnome.org/viewvc/libgweather?rev=540&view=rev
Log:
2008-12-02 Vincent Untz <vuntz gnome org>
Second part of win32 portability.
Based on patch by Tor Lillqvist <tml iki fi>
Needed for bug #352287.
* configure.in: detect win32
* doc/Makefile.am: ignore gweather-win32.h
* libgweather/Makefile.am: hack stuff for win32
* libgweather/gweather-win32.[ch]: new, some black magic win32 changes
to get the right directories
* libgweather/gweather-timezone.c:
* libgweather/weather-metar.c:
* libgweather/weather-sun.c:
* libgweather/weather.c: include gweather-win32.h on win32
Added:
trunk/libgweather/gweather-win32.c
trunk/libgweather/gweather-win32.h
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/doc/Makefile.am
trunk/libgweather/Makefile.am
trunk/libgweather/gweather-timezone.c
trunk/libgweather/weather-metar.c
trunk/libgweather/weather-sun.c
trunk/libgweather/weather.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Dec 2 18:12:03 2008
@@ -15,6 +15,19 @@
LT_VERSION=4:0:3
AC_SUBST(LT_VERSION)
+AC_CANONICAL_HOST
+AC_MSG_CHECKING([for Win32])
+case "$host" in
+ *-*-mingw*)
+ gweather_native_win32="yes"
+ ;;
+ *)
+ gweather_native_win32="no"
+ ;;
+esac
+AC_MSG_RESULT([$gweather_native_win32])
+AM_CONDITIONAL(OS_WIN32, [test "$gweather_native_win32" = "yes"])
+
GTK_REQUIRED=2.11.0
GLIB_REQUIRED=2.13.0
LIBSOUP_REQUIRED=2.4.0
Modified: trunk/doc/Makefile.am
==============================================================================
--- trunk/doc/Makefile.am (original)
+++ trunk/doc/Makefile.am Tue Dec 2 18:12:03 2008
@@ -48,7 +48,7 @@
# Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
-IGNORE_HFILES=gweather-enum-types.h parser.h weather-priv.h
+IGNORE_HFILES=gweather-enum-types.h gweather-win32.h parser.h weather-priv.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
Modified: trunk/libgweather/Makefile.am
==============================================================================
--- trunk/libgweather/Makefile.am (original)
+++ trunk/libgweather/Makefile.am Tue Dec 2 18:12:03 2008
@@ -25,10 +25,17 @@
gweather-xml.c gweather-xml.h \
gweather-location.c gweather-location.h \
gweather-timezone.c gweather-timezone.h \
+ gweather-win32.h \
location-entry.c location-entry.h \
timezone-menu.c timezone-menu.h \
parser.c parser.h
+if OS_WIN32
+libgweather_la_SOURCES += gweather-win32.c
+else
+EXTRA_libgweather_la_SOURCES = gweather-win32.c
+endif
+
libgweather_la_CFLAGS = \
-I$(top_srcdir) \
-I$(srcdir) \
@@ -93,7 +100,7 @@
test_locations_LDADD = libgweather.la
-noinst_HEADERS = weather-priv.h
+noinst_HEADERS = weather-priv.h gweather-win32.h
noinst_PROGRAMS = test_metar test_locations
schemadir = @GCONF_SCHEMA_FILE_DIR@
Modified: trunk/libgweather/gweather-timezone.c
==============================================================================
--- trunk/libgweather/gweather-timezone.c (original)
+++ trunk/libgweather/gweather-timezone.c Tue Dec 2 18:12:03 2008
@@ -28,6 +28,10 @@
#include "gweather-timezone.h"
#include "parser.h"
+#ifdef G_OS_WIN32
+#include "gweather-win32.h"
+#endif
+
/**
* GWeatherTimezone:
*
Added: trunk/libgweather/gweather-win32.c
==============================================================================
--- (empty file)
+++ trunk/libgweather/gweather-win32.c Tue Dec 2 18:12:03 2008
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* gweather-win32.c - Win32 portability
+ *
+ * Copyright 2008, Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef G_OS_WIN32
+
+#include <windows.h>
+
+#include "gweather-win32.h"
+
+static HMODULE dll = NULL;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ dll = hinstDLL;
+
+ return TRUE;
+}
+
+char *
+_gweather_win32_get_zoneinfo_dir (void)
+{
+ static char *retval = NULL;
+ char *root;
+
+ if (retval)
+ return retval;
+
+ root = g_win32_get_package_installation_directory_of_module (dll);
+ retval = g_build_filename (root, "share/zoneinfo", NULL);
+ g_free (root);
+
+ return retval;
+}
+
+char *
+_gweather_win32_get_locale_dir (void)
+{
+ static char *retval = NULL;
+ char *root;
+
+ if (retval)
+ return retval;
+
+ root = g_win32_get_package_installation_directory_of_module (dll);
+ retval = g_build_filename (root, "share/locale", NULL);
+ g_free (root);
+
+ return retval;
+}
+
+#endif
Added: trunk/libgweather/gweather-win32.h
==============================================================================
--- (empty file)
+++ trunk/libgweather/gweather-win32.h Tue Dec 2 18:12:03 2008
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* gweather-win32.h - Win32 portability
+ *
+ * Copyright 2008, Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GWEATHER_WIN32_H__
+#define __GWEATHER_WIN32_H__
+
+G_BEGIN_DECLS
+
+#ifdef G_OS_WIN32
+
+#define localtime_r(t,tmp) (localtime (t) ? ((*tmp) = *localtime (t), tmp) : NULL)
+
+#undef GNOMELOCALEDIR
+#define GNOMELOCALEDIR _gweather_win32_get_locale_dir ()
+
+#undef ZONEINFO_DIR
+#define ZONEINFO_DIR _gweather_win32_get_zoneinfo_dir ()
+
+char *_gweather_win32_get_locale_dir (void);
+char *_gweather_win32_get_zoneinfo_dir (void);
+
+#endif
+
+G_END_DECLS
+
+#endif /* __GWEATHER_WIN32_H__ */
Modified: trunk/libgweather/weather-metar.c
==============================================================================
--- trunk/libgweather/weather-metar.c (original)
+++ trunk/libgweather/weather-metar.c Tue Dec 2 18:12:03 2008
@@ -29,6 +29,9 @@
#include "weather.h"
#include "weather-priv.h"
+#ifdef G_OS_WIN32
+#include "gweather-win32.h"
+#endif
enum {
TIME_RE,
Modified: trunk/libgweather/weather-sun.c
==============================================================================
--- trunk/libgweather/weather-sun.c (original)
+++ trunk/libgweather/weather-sun.c Tue Dec 2 18:12:03 2008
@@ -37,6 +37,10 @@
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "weather-priv.h"
+#ifdef G_OS_WIN32
+#include "gweather-win32.h"
+#endif
+
#define EPOCH_TO_J2000(t) (t - 946728000)
#define MEAN_ECLIPTIC_LONGITUDE 280.46435
#define PERIGEE_LONGITUDE 282.94719
Modified: trunk/libgweather/weather.c
==============================================================================
--- trunk/libgweather/weather.c (original)
+++ trunk/libgweather/weather.c Tue Dec 2 18:12:03 2008
@@ -41,6 +41,10 @@
#include "weather.h"
#include "weather-priv.h"
+#ifdef G_OS_WIN32
+#include "gweather-win32.h"
+#endif
+
static void _weather_internal_check (void);
const char *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]