[gjs] Make things build with glib 2.16



commit ddee27556fedd445d5b959b3ca7177e9175a59c5
Author: James Willcox <jwillcox litl com>
Date:   Tue Dec 8 10:06:58 2009 -0500

    Make things build with glib 2.16

 Makefile-test.am         |    2 +-
 Makefile.am              |    1 +
 gjs/compat.h             |   40 ++++++++++++++++++++++++++++++++++++++++
 gjs/jsapi-util-string.c  |    1 +
 modules/gettext-native.c |    1 +
 5 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index 2b333ec..02752c4 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -74,7 +74,7 @@ TESTS_ENVIRONMENT =							\
 	G_FILENAME_ENCODING=latin1	# ensure filenames are not utf8
 
 test:	$(gjsnative_LTLIBRARIES) ${TEST_PROGS}
-	@test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
+	@test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ${TEST_PROGS_OPTIONS}
 
 check:	test
 
diff --git a/Makefile.am b/Makefile.am
index 83f3a46..3f6ae18 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,7 @@ nobase_gjsinclude_HEADERS =	\
 	gjs/mem.h		\
 	gjs/native.h
 noinst_HEADERS +=		\
+	gjs/compat.h		\
 	gjs/context-jsapi.h	\
 	gjs/profiler.h		\
 	util/crash.h		\
diff --git a/gjs/compat.h b/gjs/compat.h
new file mode 100644
index 0000000..4ac8f74
--- /dev/null
+++ b/gjs/compat.h
@@ -0,0 +1,40 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (c) 2009  litl, LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __GJS_COMPAT_H__
+#define __GJS_COMPAT_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if !GLIB_CHECK_VERSION(2, 18, 0)
+
+#define g_set_error_literal(error, domain, code, message) g_set_error(error, domain, code, "%s", message)
+#define g_dpgettext2(domain, ctx, msgid) dgettext(domain, msgid)
+
+#endif
+
+G_END_DECLS
+
+#endif  /* __GJS_MEM_H__ */
diff --git a/gjs/jsapi-util-string.c b/gjs/jsapi-util-string.c
index 2e953c8..475008c 100644
--- a/gjs/jsapi-util-string.c
+++ b/gjs/jsapi-util-string.c
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include "jsapi-util.h"
+#include "compat.h"
 
 gboolean
 gjs_try_string_to_utf8 (JSContext  *context,
diff --git a/modules/gettext-native.c b/modules/gettext-native.c
index e563b53..e75f141 100644
--- a/modules/gettext-native.c
+++ b/modules/gettext-native.c
@@ -27,6 +27,7 @@
 #include <gjs/gjs.h>
 #include <jsapi.h>
 #include <glib/gi18n.h>
+#include <gjs/compat.h>
 
 static JSBool
 gjs_textdomain(JSContext *context,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]