From 8d41cbe0be52ab3d689608cc12d87e54d0a94852 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 26 May 2005 01:26:30 +0000 Subject: [PATCH] - add patch for gcc4 problems (ignacio, #156228) - fix build on 64bit boxes. sizeof(int) != sizeof(void*) --- inkscape-0.41-64bit.patch | 372 ++++++++++++++++++++++++++++++++++++++ inkscape-gcc4.patch | 32 ++++ inkscape.spec | 11 +- 3 files changed, 414 insertions(+), 1 deletion(-) create mode 100644 inkscape-0.41-64bit.patch create mode 100644 inkscape-gcc4.patch diff --git a/inkscape-0.41-64bit.patch b/inkscape-0.41-64bit.patch new file mode 100644 index 0000000..6e0ed53 --- /dev/null +++ b/inkscape-0.41-64bit.patch @@ -0,0 +1,372 @@ +--- inkscape-0.41/src/verbs.cpp.64bit 2005-05-25 18:02:32.000000000 -0400 ++++ inkscape-0.41/src/verbs.cpp 2005-05-25 18:03:01.000000000 -0400 +@@ -1292,7 +1292,7 @@ + void + DialogVerb::perform (SPAction *action, void * data, void * pdata) + { +- if ((int) data != SP_VERB_DIALOG_TOGGLE) { ++ if (GPOINTER_TO_INT(data) != SP_VERB_DIALOG_TOGGLE) { + // unhide all when opening a new dialog + inkscape_dialogs_unhide (); + } +--- inkscape-0.41/src/dialogs/export.cpp.64bit 2005-05-25 18:04:09.000000000 -0400 ++++ inkscape-0.41/src/dialogs/export.cpp 2005-05-25 18:05:34.000000000 -0400 +@@ -595,7 +595,7 @@ + GtkObject *base ) + { + selection_type current_key; +- current_key = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + + if ((current_key == SELECTION_DRAWING || current_key == SELECTION_PAGE) && + (SP_DT_SELECTION(SP_ACTIVE_DESKTOP))->isEmpty() == false && +@@ -606,7 +606,7 @@ + } + was_empty = (SP_DT_SELECTION(SP_ACTIVE_DESKTOP))->isEmpty(); + +- current_key = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + + if (inkscape && + SP_IS_INKSCAPE (inkscape) && +@@ -627,7 +627,7 @@ + GtkObject *base ) + { + selection_type current_key; +- current_key = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ current_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + + switch (current_key) { + case SELECTION_DRAWING: +@@ -664,8 +664,8 @@ + return; + + selection_type key, old_key; +- key = (selection_type)((int)gtk_object_get_data (GTK_OBJECT (tb), "key")); +- old_key = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data (GTK_OBJECT (tb), "key"))); ++ old_key = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + + /* Ignore all "turned off" events unless we're the only active button */ + if (!gtk_toggle_button_get_active (tb) ) { +@@ -1036,7 +1036,7 @@ + g_object_set_data (G_OBJECT (base), "cancel", (gpointer) 0); + + /* Setup the values in the document */ +- switch ((selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type"))) { ++ switch ((selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")))) { + case SELECTION_PAGE: + case SELECTION_DRAWING: { + SPDocument * doc = SP_ACTIVE_DOCUMENT; +@@ -1229,7 +1229,7 @@ + current_bbox.round(2); + // std::cout << "Current " << current_bbox; + +- this_test[0] = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ this_test[0] = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + for (int i = 0; i < SELECTION_NUMBER_OF; i++) { + this_test[i + 1] = test_order[i]; + } +@@ -1298,7 +1298,7 @@ + + /* We're now using a custom size, not a fixed one */ + /* printf("Detecting state: %s\n", selection_names[key]); */ +- selection_type old = (selection_type)((int)gtk_object_get_data(GTK_OBJECT(base), "selection-type")); ++ selection_type old = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type"))); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_object_get_data(base, selection_names[old])), FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_object_get_data(base, selection_names[key])), TRUE); + gtk_object_set_data(GTK_OBJECT(base), "selection-type", (gpointer)key); +--- inkscape-0.41/src/sp-skeleton.cpp.64bit 2005-05-25 17:55:21.000000000 -0400 ++++ inkscape-0.41/src/sp-skeleton.cpp 2005-05-25 17:57:24.000000000 -0400 +@@ -91,7 +91,7 @@ + static void + sp_skeleton_init (SPSkeleton *skeleton) + { +- debug("0x%08x",(unsigned int)skeleton); ++ debug("0x%08x",GPOINTER_TO_UINT(skeleton)); + } + + /* +@@ -103,7 +103,7 @@ + static void + sp_skeleton_build (SPObject *object, SPDocument *document, SPRepr *repr) + { +- debug("0x%08x",(unsigned int)object); ++ debug("0x%08x",GPOINTER_TO_UINT(object)); + if (((SPObjectClass *) skeleton_parent_class)->build) + ((SPObjectClass *) skeleton_parent_class)->build (object, document, repr); + +@@ -132,7 +132,7 @@ + static void + sp_skeleton_release (SPObject *object) + { +- debug("0x%08x",(unsigned int)object); ++ debug("0x%08x",GPOINTER_TO_UINT(object)); + + /* deal with our children and our selves here */ + +@@ -146,7 +146,7 @@ + static void + sp_skeleton_set (SPObject *object, unsigned int key, const gchar *value) + { +- debug("0x%08x %s(%u): '%s'",(unsigned int)object, ++ debug("0x%08x %s(%u): '%s'",GPOINTER_TO_UINT(object), + sp_attribute_name(key),key,value); + SPSkeleton * skeleton; + +@@ -163,7 +163,7 @@ + static void + sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags) + { +- debug("0x%08x",(unsigned int)object); ++ debug("0x%08x",GPOINTER_TO_UINT(object)); + //SPSkeleton *skeleton = SP_SKELETON(object); + + if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | +@@ -183,7 +183,7 @@ + static SPRepr * + sp_skeleton_write(SPObject *object, SPRepr *repr, guint flags) + { +- debug("0x%08x",(unsigned int)object); ++ debug("0x%08x",GPOINTER_TO_UINT(object)); + //SPSkeleton *skeleton = SP_SKELETON(object); + + // Inkscape-only object, not copied during an "plain SVG" dump: +--- inkscape-0.41/src/sp-flowtext.cpp.64bit 2005-05-25 17:52:26.000000000 -0400 ++++ inkscape-0.41/src/sp-flowtext.cpp 2005-05-25 17:53:13.000000000 -0400 +@@ -673,7 +673,7 @@ + for (int k = comp->spans[j].l_st; kspans[j].l_en; k++) { + int u4_l = 0, u8_l = comp->letters[k].t_en-comp->letters[k].t_st; + for (char *p = &comp->chars[comp->letters[k].t_st]; p && *p; p = g_utf8_next_char(p)) { +- int d= ((int)p)-((int)(&comp->chars[0])); ++ int d= p - (&comp->chars[0]); + d-=comp->letters[k].t_st; + if ( d >= u8_l ) break; + u4_l++; +@@ -703,7 +703,7 @@ + for (int k = comp->spans[j].l_st; kspans[j].l_en; k++) { + int u4_l = 0, u8_l = comp->letters[k].t_en-comp->letters[k].t_st; + for (char *p = &comp->chars [comp->letters[k].t_st]; p && *p; p = g_utf8_next_char(p)) { +- int d = ((int)p)-((int)(&comp->chars[0])); ++ int d = p - (&comp->chars[0]); + d -= comp->letters[k].t_st; + if ( d >= u8_l ) break; + u4_l++; +--- inkscape-0.41/src/livarot/ShapeMisc.cpp.64bit 2005-05-25 18:27:11.000000000 -0400 ++++ inkscape-0.41/src/livarot/ShapeMisc.cpp 2005-05-25 18:27:33.000000000 -0400 +@@ -386,7 +386,7 @@ + if (askTo < 0 || askTo >= numberOfEdges() ) { + dadContour=-1; + } else { +- dadContour = (int) swdData[askTo].misc; ++ dadContour = GPOINTER_TO_INT(swdData[askTo].misc); + dadContour-=1; // pour compenser le decalage + } + } +--- inkscape-0.41/src/display/nr-arena-item.cpp.64bit 2005-05-25 18:07:30.000000000 -0400 ++++ inkscape-0.41/src/display/nr-arena-item.cpp 2005-05-25 18:07:44.000000000 -0400 +@@ -984,7 +984,7 @@ + + int hash_that(NRArenaItem* owner,int th,int tv) + { +- int res=(int)owner; ++ int res=GPOINTER_TO_INT(owner); + res*=17; + res+=th; + res*=59; +--- inkscape-0.41/src/libnrtype/FlowStyle.cpp.64bit 2005-05-25 18:16:21.000000000 -0400 ++++ inkscape-0.41/src/libnrtype/FlowStyle.cpp 2005-05-25 18:18:57.000000000 -0400 +@@ -126,7 +126,7 @@ + double sum=0; + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= iLen ) break; + sum+=kern_x[k_pos]; + k_pos++; +@@ -137,7 +137,7 @@ + double min_y=0,max_y=0; + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= iLen ) break; + if ( kern_y[k_pos] < min_y ) min_y=kern_y[k_pos]; + if ( kern_y[k_pos] > max_y ) max_y=kern_y[k_pos]; +@@ -193,7 +193,7 @@ + double a_k_x=0,a_k_y=0; + if ( kern_x ) { + for (char* p=iText+kx_st;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= g_en ) break; + a_k_x+=kern_x[kx_pos]; + kx_pos++; +@@ -204,7 +204,7 @@ + //int gLen=pGlyphs->log_clusters[i]; + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + a_k_y=kern_y[k_pos]; + if ( d >= g_st ) break; + k_pos++; +@@ -234,7 +234,7 @@ + double a_k_x=0,a_k_y=0; + if ( kern_x ) { + for (char* p=iText+kx_st;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= g_en ) break; + a_k_x+=kern_x[kx_pos]; + kx_pos++; +@@ -244,7 +244,7 @@ + if ( kern_y ) { + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + a_k_y=kern_y[k_pos]; + if ( d >= g_st ) break; + k_pos++; +@@ -283,7 +283,7 @@ + double a_k_x=0,a_k_y=0; + if ( kern_x ) { + for (char* p=iText+kx_st;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= g_en ) break; + a_k_x+=kern_x[kx_pos]; + kx_pos++; +@@ -294,7 +294,7 @@ + //int gLen=pGlyphs->log_clusters[i]; + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + a_k_y=kern_y[k_pos]; + if ( d >= g_st ) break; + k_pos++; +@@ -326,7 +326,7 @@ + double a_k_x=0,a_k_y=0; + if ( kern_x ) { + for (char* p=iText+kx_st;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + if ( d >= g_en ) break; + a_k_x+=kern_x[kx_pos]; + kx_pos++; +@@ -336,7 +336,7 @@ + if ( kern_y ) { + int k_pos=0; + for (char* p=iText;*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)iText); ++ int d=p-iText; + a_k_y=kern_y[k_pos]; + if ( d >= g_st ) break; + k_pos++; +--- inkscape-0.41/src/libnrtype/FontFactory.cpp.64bit 2005-05-25 18:12:05.000000000 -0400 ++++ inkscape-0.41/src/libnrtype/FontFactory.cpp 2005-05-25 18:12:20.000000000 -0400 +@@ -461,7 +461,7 @@ + if ( loadedFaces.find(who->descr) == loadedFaces.end() ) { + // not found + char* tc=pango_font_description_to_string(who->descr); +- g_warning("unrefFace %x=%s: failed\n",(unsigned int)who,tc); ++ g_warning("unrefFace %x=%s: failed\n",GPOINTER_TO_UINT(who),tc); + free(tc); + } else { + loadedFaces.erase(loadedFaces.find(who->descr)); +--- inkscape-0.41/src/libnrtype/FlowSrcText.cpp.64bit 2005-05-25 18:12:44.000000000 -0400 ++++ inkscape-0.41/src/libnrtype/FlowSrcText.cpp 2005-05-25 18:14:29.000000000 -0400 +@@ -65,7 +65,7 @@ + { + int ucs4_pos=0; + for (char* p=utf8_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)utf8_text); ++ int d= p - utf8_text; + if ( d >= utf8_pos ) { + return ucs4_pos; + } +@@ -77,7 +77,7 @@ + { + int cur_pos=0; + for (char* p=utf8_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)utf8_text); ++ int d=p-utf8_text; + if ( cur_pos >= ucs4_pos ) { + return d; + } +@@ -198,7 +198,7 @@ + int src_length=src[i].txt->utf8_length; + for (char* p=src_text;p&&*p;p=g_utf8_next_char(p)) { + gunichar c=g_utf8_get_char(p); +- int d=((int)p)-((int)src_text); ++ int d=p-src_text; + bool add_it=true; + if ( g_unichar_iscntrl(c) ) { + add_it=false; +@@ -226,7 +226,7 @@ + int src_length=src[i].txt->utf8_length; + for (char* p=src_text;p&&*p;p=g_utf8_next_char(p)) { + gunichar c=g_utf8_get_char(p); +- int d=((int)p)-((int)src_text); ++ int d=p-src_text; + bool add_it=true; + if ( g_unichar_iscntrl(c) ) { + add_it=false; +@@ -364,12 +364,12 @@ + int s_8_st=is_8_st-src[s_no].utf8_offset,s_8_en=is_8_en-src[s_no].utf8_offset; + int s_4_st=0,s_4_en=0; + for (char* p=src_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)src_text); ++ int d=p-src_text; + if ( d >= s_8_st ) break; + s_4_st++; + } + for (char* p=src_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)src_text); ++ int d=p-src_text; + if ( d >= s_8_en ) break; + s_4_en++; + } +--- inkscape-0.41/src/libnrtype/TextWrapper.cpp.64bit 2005-05-25 18:25:45.000000000 -0400 ++++ inkscape-0.41/src/libnrtype/TextWrapper.cpp 2005-05-25 18:26:10.000000000 -0400 +@@ -139,7 +139,7 @@ + // get the new codepoint + uni32_text[i]=g_utf8_get_char(p); + // compute the offset in the utf8_string +- int n_o=((int)p)-((int)utf8_text); ++ int n_o= p-utf8_text; + // record the codepoint's start + utf8_codepoint[i]=n_o; + // record the codepoint's correspondance in the utf8 string +--- inkscape-0.41/src/libnrtype/FlowBoxes.cpp.64bit 2005-05-25 18:15:09.000000000 -0400 ++++ inkscape-0.41/src/libnrtype/FlowBoxes.cpp 2005-05-25 18:16:00.000000000 -0400 +@@ -77,7 +77,7 @@ + int src_length=flow_to_me.src[i].txt->utf8_length; + int src_offset=flow_to_me.src[i].utf8_offset; + for (char* p=src_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)src_text); ++ int d=p-src_text; + gunichar nc=g_utf8_get_char(p); + if ( *p == '\n' ) { + AddCtrl(raw_text.utf8_length,ctrl_return); // nooo, not a newline! +@@ -548,7 +548,7 @@ + } + if ( *p == 0 ) break; + p=g_utf8_next_char(p); +- i=((int)p)-((int)t_st); ++ i=p-t_st; + ucs4_i++; + } + free(lAttrs); +@@ -772,7 +772,7 @@ + { + int n_o=0; + for (char* p=utf8_text;p&&*p;p=g_utf8_next_char(p)) { +- int d=((int)p)-((int)utf8_text); ++ int d=p-utf8_text; + if ( d >= pos ) break; + n_o++; + } diff --git a/inkscape-gcc4.patch b/inkscape-gcc4.patch new file mode 100644 index 0000000..32c43dd --- /dev/null +++ b/inkscape-gcc4.patch @@ -0,0 +1,32 @@ +--- inkscape-0.41/src/xml/sp-repr.h.gcc4 2005-05-10 05:38:09.000000000 -0400 ++++ inkscape-0.41/src/xml/sp-repr.h 2005-05-10 05:38:40.000000000 -0400 +@@ -44,6 +44,7 @@ + class SPRepr : public Inkscape::GC::Anchored { + public: + SPRepr() {} ++ virtual ~SPRepr() {} + + virtual SPReprType type() const=0; + +--- inkscape-0.41/src/file.cpp.gcc4 2005-05-10 05:40:00.000000000 -0400 ++++ inkscape-0.41/src/file.cpp 2005-05-10 05:40:52.000000000 -0400 +@@ -269,7 +269,7 @@ + Glib::ustring::size_type const dataLen = ustr.length(); + Glib::ustring::size_type const cstrLen = strlen(cstr); + +- g_message(" size: %d\n length: %d\n bytes: %d\n clen: %d", ustr.size(), dataLen, byteLen, cstrLen ); ++ g_message(" size: %zd\n length: %zd\n bytes: %zd\n clen: %zd", ustr.size(), dataLen, byteLen, cstrLen ); + g_message( " ASCII? %s", (ustr.is_ascii() ? "yes":"no") ); + g_message( " UTF-8? %s", (ustr.validate() ? "yes":"no") ); + +--- inkscape-0.41/src/interface.cpp.gcc4 2005-02-01 02:11:06.000000000 -0500 ++++ inkscape-0.41/src/interface.cpp 2005-05-10 05:29:12.000000000 -0400 +@@ -332,7 +332,7 @@ + if (event->state & GDK_SHIFT_MASK) shortcut |= SP_SHORTCUT_SHIFT_MASK; + if (event->state & GDK_CONTROL_MASK) shortcut |= SP_SHORTCUT_CONTROL_MASK; + if (event->state & GDK_MOD1_MASK) shortcut |= SP_SHORTCUT_ALT_MASK; +- sp_shortcut_set (shortcut, (Inkscape::Verb *)((int)data), true); ++ sp_shortcut_set (shortcut, (Inkscape::Verb *)data, true); + } + } + diff --git a/inkscape.spec b/inkscape.spec index 6b524cf..a229722 100644 --- a/inkscape.spec +++ b/inkscape.spec @@ -1,6 +1,6 @@ Name: inkscape Version: 0.41 -Release: 3 +Release: 4 Summary: A vector-based drawing program using SVG. @@ -8,6 +8,8 @@ Group: Applications/Productivity License: GPL URL: http://inkscape.sourceforge.net/ Source0: http://download.sourceforge.net/inkscape/inkscape-0.41.tar.bz2 +Patch0: inkscape-gcc4.patch +Patch1: inkscape-0.41-64bit.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: atk-devel @@ -49,8 +51,11 @@ C and C++, using the Gtk+ toolkit and optionally some Gnome libraries. %prep %setup -q +%patch0 -p1 -b .gcc4 +%patch1 -p1 -b .64bit %build +aclocal ; autoconf %configure \ --disable-dependency-tracking \ --with-xinerama \ @@ -99,6 +104,10 @@ update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || : %changelog +* Wed May 25 2005 Jeremy Katz - 0.41-4 +- add patch for gcc4 problems (ignacio, #156228) +- fix build on 64bit boxes. sizeof(int) != sizeof(void*) + * Sun May 22 2005 Jeremy Katz - 0.41-3 - rebuild on all arches