From 0f5e13e706a3cb9d03f583d8ac8067b2630feba0 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 6 Jun 2009 18:51:57 +0200 Subject: [PATCH] Allow building without JSCore and do so for mingw --- midori/main.c | 6 ++++++ midori/sokoke.c | 8 ++++++++ wscript | 1 + 3 files changed, 15 insertions(+) diff --git a/midori/main.c b/midori/main.c index b2b6d917..1c3b26a0 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1307,6 +1307,7 @@ midori_load_session (gpointer data) return FALSE; } +#if HAVE_JSCORE static gint midori_run_script (const gchar* filename) { @@ -1344,6 +1345,7 @@ midori_run_script (const gchar* filename) g_print ("%s - Exception: %s\n", filename, exception); return 1; } +#endif #if WEBKIT_CHECK_VERSION (1, 1, 6) static void @@ -1391,8 +1393,10 @@ main (int argc, N_("Run ADDRESS as a web application"), N_("ADDRESS") }, { "config", 'c', 0, G_OPTION_ARG_FILENAME, &config, N_("Use FOLDER as configuration folder"), N_("FOLDER") }, + #if HAVE_JSCORE { "run", 'r', 0, G_OPTION_ARG_NONE, &run, N_("Run the specified filename as javascript"), NULL }, + #endif #if WEBKIT_CHECK_VERSION (1, 1, 6) { "snapshot", 's', 0, G_OPTION_ARG_STRING, &snapshot, N_("Take a snapshot of the specified URI"), NULL }, @@ -1529,9 +1533,11 @@ main (int argc, return 0; } + #if HAVE_JSCORE /* Standalone javascript support */ if (run) return midori_run_script (uris ? *uris : NULL); + #endif #if HAVE_HILDON osso_context = osso_initialize (PACKAGE_NAME, PACKAGE_VERSION, FALSE, NULL); diff --git a/midori/sokoke.c b/midori/sokoke.c index fe8fc61d..7ecda869 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -36,6 +36,7 @@ #include #endif +#if HAVE_JSCORE static gchar* sokoke_js_string_utf8 (JSStringRef js_string) { @@ -49,18 +50,22 @@ sokoke_js_string_utf8 (JSStringRef js_string) JSStringGetUTF8CString (js_string, string_utf8, size_utf8); return string_utf8; } +#endif gchar* sokoke_js_script_eval (JSContextRef js_context, const gchar* script, gchar** exception) { + #if HAVE_JSCORE gchar* value; JSStringRef js_value_string; + #endif g_return_val_if_fail (js_context, FALSE); g_return_val_if_fail (script, FALSE); + #if HAVE_JSCORE JSStringRef js_script = JSStringCreateWithUTF8CString (script); JSValueRef js_exception = NULL; JSValueRef js_value = JSEvaluateScript (js_context, js_script, @@ -79,6 +84,9 @@ sokoke_js_script_eval (JSContextRef js_context, value = sokoke_js_string_utf8 (js_value_string); JSStringRelease (js_value_string); return value; + #else + return g_strdup (""); + #endif } static void diff --git a/wscript b/wscript index 3f1857f4..4f83e054 100644 --- a/wscript +++ b/wscript @@ -177,6 +177,7 @@ def configure (conf): args = '--define-variable=target=win32' check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args) check_pkg ('webkit-1.0', '1.1.1', args=args) + conf.define ('HAVE_JSCORE', not is_mingw (conf.env)) check_pkg ('libsoup-2.4', '2.25.2') conf.define ('HAVE_LIBSOUP_2_25_2', 1) check_pkg ('libxml-2.0', '2.6')