From 008f98f5389016058a04e6ad31c355c453e669c7 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Fri, 2 Dec 2011 18:19:21 +0100 Subject: [PATCH] fix crash on PPC, bugzilla 749604 --- gjs-1.30.0-749604.patch | 120 ++++++++++++++++++++++++++++++++++++++++ gjs.spec | 7 ++- 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 gjs-1.30.0-749604.patch diff --git a/gjs-1.30.0-749604.patch b/gjs-1.30.0-749604.patch new file mode 100644 index 0000000..b35b38d --- /dev/null +++ b/gjs-1.30.0-749604.patch @@ -0,0 +1,120 @@ +diff -up newer-but-still-old/gi/function.c.fix-ffi-on-big-endian newer-but-still-old/gi/function.c +--- newer-but-still-old/gi/function.c.fix-ffi-on-big-endian 2011-11-28 15:24:07.453082729 -0600 ++++ newer-but-still-old/gi/function.c 2011-11-29 12:25:58.317567749 -0600 +@@ -166,6 +166,8 @@ gjs_callback_closure(ffi_cif *cif, + int i, n_args, n_jsargs; + jsval *jsargs, rval; + GITypeInfo ret_type; ++ GITypeTag return_tag; ++ GArgument return_value; + gboolean success = FALSE; + + trampoline = data; +@@ -215,10 +217,55 @@ gjs_callback_closure(ffi_cif *cif, + GJS_ARGUMENT_RETURN_VALUE, + FALSE, + TRUE, +- result)) { ++ &return_value)) { + goto out; + } + ++ return_tag = g_type_info_get_tag(&ret_type); ++ switch (return_tag) { ++ case GI_TYPE_TAG_INT8: ++ *(ffi_sarg *) result = (gint8) return_value.v_int8; ++ case GI_TYPE_TAG_UINT8: ++ *(ffi_arg *) result = (guint8) return_value.v_uint8; ++ break; ++ case GI_TYPE_TAG_INT16: ++ *(ffi_sarg *) result = (gint16) return_value.v_int16; ++ break; ++ case GI_TYPE_TAG_UINT16: ++ *(ffi_arg *) result = (guint16) return_value.v_uint16; ++ break; ++ case GI_TYPE_TAG_INT32: ++ *(ffi_sarg *) result = (gint32) return_value.v_int32; ++ break; ++ case GI_TYPE_TAG_UINT32: ++ case GI_TYPE_TAG_BOOLEAN: ++ case GI_TYPE_TAG_UNICHAR: ++ *(ffi_arg *) result = (guint32) return_value.v_uint32; ++ ++ break; ++ case GI_TYPE_TAG_INTERFACE: ++ { ++ GIBaseInfo* interface_info; ++ GIInfoType interface_type; ++ ++ interface_info = g_type_info_get_interface(&ret_type); ++ interface_type = g_base_info_get_type(interface_info); ++ ++ switch (interface_type) { ++ case GI_INFO_TYPE_ENUM: ++ case GI_INFO_TYPE_FLAGS: ++ *(ffi_sarg *) result = (gint32) return_value.v_long; ++ break; ++ default: ++ *(ffi_arg *) result = (ffi_arg) return_value.v_pointer; ++ break; ++ } ++ } ++ default: ++ *(ffi_arg *) result = (ffi_arg) return_value.v_pointer; ++ break; ++ } ++ + success = TRUE; + + out: +@@ -673,6 +720,50 @@ gjs_invoke_c_function(JSContext *co + + g_assert_cmpuint(next_rval, <, function->js_out_argc); + ++ switch (return_tag) { ++ case GI_TYPE_TAG_INT8: ++ return_value.v_int8 = (gint8) return_value.v_long; ++ case GI_TYPE_TAG_UINT8: ++ return_value.v_uint8 = (guint8) return_value.v_ulong; ++ break; ++ case GI_TYPE_TAG_INT16: ++ return_value.v_int16 = (gint16) return_value.v_long; ++ break; ++ case GI_TYPE_TAG_UINT16: ++ return_value.v_uint16 = (guint16) return_value.v_ulong; ++ break; ++ case GI_TYPE_TAG_INT32: ++ return_value.v_int32 = (gint32) return_value.v_long; ++ break; ++ case GI_TYPE_TAG_UINT32: ++ case GI_TYPE_TAG_BOOLEAN: ++ case GI_TYPE_TAG_UNICHAR: ++ return_value.v_uint32 = (guint32) return_value.v_ulong; ++ ++ break; ++ case GI_TYPE_TAG_INTERFACE: ++ { ++ GIBaseInfo* interface_info; ++ GIInfoType interface_type; ++ ++ interface_info = g_type_info_get_interface(&return_info); ++ interface_type = g_base_info_get_type(interface_info); ++ ++ ++ switch(interface_type) { ++ case GI_INFO_TYPE_ENUM: ++ case GI_INFO_TYPE_FLAGS: ++ return_value.v_int32 = (gint32) return_value.v_long; ++ break; ++ default: ++ break; ++ } ++ } ++ break; ++ default: ++ break; ++ } ++ + array_length_pos = g_type_info_get_array_length(&return_info); + if (array_length_pos >= 0) { + GIArgInfo array_length_arg; diff --git a/gjs.spec b/gjs.spec index c39b36c..e8e7c14 100644 --- a/gjs.spec +++ b/gjs.spec @@ -1,6 +1,6 @@ Name: gjs Version: 1.31.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Javascript Bindings for GNOME Group: System Environment/Libraries @@ -12,6 +12,7 @@ License: MIT and (MPLv1.1 or GPLv2+ or LGPLv2+) URL: http://live.gnome.org/Gjs/ #VCS: git://git.gnome.org/gjs Source0: http://download.gnome.org/sources/%{name}/1.31/%{name}-%{version}.tar.xz +Patch0: gjs-1.30.0-749604.patch BuildRequires: js-devel BuildRequires: cairo-devel @@ -39,6 +40,7 @@ Files for development with %{name}. %prep %setup -q +%patch0 -p1 rm -f configure @@ -80,6 +82,9 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';' %{_libdir}/*.so %changelog +* Fri Dec 02 2011 Karsten Hopp 1.31.0-2 +- fix crash on PPC, bugzilla 749604 + * Wed Nov 2 2011 Matthias Clasen - 1.31.0-1 - Update to 1.31.0