Package: xaralx
Version: 0.7r1692-2
Followup-For: Bug #382658

Hi,

I have tested the patch provided in this bug. First of all, I had to
modify debian/rules to build the package (see the attached debdiff).
Basically, on Debian G5 machines running the powerpc port, uname -m
report to be ppc64, which confuses the configure scripts. This can be a
serious problem when the autobuilder is a G5 machine (This is not the
case yet).

After building the patched package, I managed to run xaralx. However, it
systematically crashes when opening example files from xaralx-examples.
(see the xml crash file).

I did not try to do something else apart from opening a file.

Hope this helps,

-- Charles Plessy, Wako, Saitama, Japan.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: powerpc (ppc64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-2-powerpc64
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages xaralx depends on:
ii  libc6                     2.3.6.ds1-11   GNU C Library: Shared libraries
ii  libfreetype6              2.2.1-5        FreeType 2 font engine, shared lib
ii  libgcc1                   1:4.1.1-21     GCC support library
ii  libglib2.0-0              2.12.4-2       The GLib library of C routines
ii  libgtk2.0-0               2.8.20-5       The GTK+ graphical user interface 
ii  libjpeg62                 6b-13          The Independent JPEG Group's JPEG 
ii  libpango1.0-0             1.14.8-4       Layout and rendering of internatio
ii  libpng12-0                1.2.15~beta5-1 PNG library - runtime
ii  libstdc++6                4.1.1-21       The GNU Standard C++ Library v3
ii  libwxbase2.6-0            2.6.3.2.1.5    wxBase library (runtime) - non-GUI
ii  libwxgtk2.6-0             2.6.3.2.1.5    wxWidgets Cross-platform C++ GUI t
ii  libxml2                   2.6.27.dfsg-1  GNOME XML library

Versions of packages xaralx recommends:
ii  imagemagick         7:6.2.4.5.dfsg1-0.14 Image manipulation programs
ii  xaralx-svg          0.7r1692-3           SVG (Scalable Vector Graphics) plu

-- no debconf information

Attachment: xaralx.xml
Description: application/xml

diff -u xaralx-0.7r1692/debian/patches/00list xaralx-0.7r1692/debian/patches/00list
--- xaralx-0.7r1692/debian/patches/00list
+++ xaralx-0.7r1692/debian/patches/00list
@@ -2,0 +3 @@
+30_powerpc_fixes.dpatch
diff -u xaralx-0.7r1692/debian/changelog xaralx-0.7r1692/debian/changelog
--- xaralx-0.7r1692/debian/changelog
+++ xaralx-0.7r1692/debian/changelog
@@ -1,3 +1,9 @@
+xaralx (0.7r1692-3) unstable; urgency=low
+
+  * Dpatched patch from bug 382658. 
+
+ -- Charles Plessy <[EMAIL PROTECTED]>  Sat, 24 Feb 2007 17:01:52 +0900
+
 xaralx (0.7r1692-2) unstable; urgency=low
 
   * List additional licenes in debian/copyright
diff -u xaralx-0.7r1692/debian/rules xaralx-0.7r1692/debian/rules
--- xaralx-0.7r1692/debian/rules
+++ xaralx-0.7r1692/debian/rules
@@ -9,6 +9,15 @@
 CFLAGS = -Wall -g
 AUTOMAKE = automake-1.9
 
+DEB_HOST_ARCH_CPU    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+ifeq ($(DEB_HOST_ARCH_CPU),powerpc)
+PLATFORM        = powerpc
+else
+PLATFORM        =
+endif
+
+
+
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
 else
@@ -20,7 +29,7 @@
 	dh_testdir
 	# Add here commands to configure the package.
 	#autoreconf -f # -i -s 
-	AUTOMAKE=/bin/true ACLOCAL=/bin/true AUTOCONF=/bin/true ./configure  --enable-xarlib --enable-filters
+	AUTOMAKE=/bin/true ACLOCAL=/bin/true AUTOCONF=/bin/true ./configure $(PLATFORM) --enable-xarlib --enable-filters
 
 	touch configure-stamp
 
only in patch2:
unchanged:
--- xaralx-0.7r1692.orig/debian/patches/30_powerpc_fixes.dpatch
+++ xaralx-0.7r1692/debian/patches/30_powerpc_fixes.dpatch
@@ -0,0 +1,204 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30_powerpc_fixes.dpatch by Charles Plessy <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch from bug 382658
+
[EMAIL PROTECTED]@
+
+Index: Kernel/cxfile.cpp
+===================================================================
+--- xaralx/Kernel/cxfile.cpp	(revision 1694)
++++ xaralx/Kernel/cxfile.cpp	(revision 1695)
+@@ -889,15 +889,17 @@
+ 
+ BOOL CXaraFile::Read(FLOAT* pf)
+ {
+-	BOOL ok = (Read((BYTE*)pf,sizeof(FLOAT)));
+-	*pf = LEtoNative(*pf);
++	FloatUnion f;
++	BOOL ok = (Read((BYTE*)&(f.u_INT32),sizeof(f.u_INT32)));
++	*pf = LEtoNative(f);
+ 	return ok;
+ }
+ 
+ BOOL CXaraFile::Read(double* pd)
+ {
+-	BOOL ok = (Read((BYTE*)pd,sizeof(double)));
+-	*pd = LEtoNative(*pd);
++	DoubleUnion f;
++	BOOL ok = (Read((BYTE*)&(f.u_INT64),sizeof(f.u_INT64)));
++	*pd = LEtoNative(f);
+ 	return ok;
+ }
+ 
+@@ -1088,12 +1090,14 @@
+ 
+ BOOL CXaraFile::Write(FLOAT f)
+ {
+-	return (Write((BYTE*)&f,sizeof(FLOAT)));
++	FloatUnion u=NativetoLEU(f);
++	return (Write((BYTE*)&(u.u_INT32),sizeof(u.u_INT32)));
+ }
+ 
+ BOOL CXaraFile::Write(double d)
+ {
+-	return (Write((BYTE*)&d,sizeof(double)));
++	DoubleUnion u=NativetoLEU(d);
++	return (Write((BYTE*)&(u.u_INT64),sizeof(u.u_INT64)));
+ }
+ 
+ BOOL CXaraFile::WriteWCHAR(WCHAR w)
+Index: Kernel/cxfrec.cpp
+===================================================================
+--- xaralx/Kernel/cxfrec.cpp	(revision 1694)
++++ xaralx/Kernel/cxfrec.cpp	(revision 1695)
+@@ -624,7 +624,8 @@
+ BOOL CXaraFileRecord::WriteFLOAT(FLOAT f)
+ {
+ 	ENTERWRITEFUNCTION(FTT_FLOAT);
+-	BOOL ok = WriteBuffer((BYTE*)&f,sizeof(FLOAT));
++	FloatUnion u=NativetoLEU(f);
++	BOOL ok = WriteBuffer((BYTE*)&(u.u_INT32),sizeof(u.u_INT32));
+ 	LEAVEWRITEFUNCTION;
+ 	return (ok);
+ }	
+@@ -668,7 +669,8 @@
+ BOOL CXaraFileRecord::WriteDOUBLE(double d)
+ {
+ 	ENTERWRITEFUNCTION(FTT_DOUBLE);
+-	BOOL ok = WriteBuffer((BYTE*)&d,sizeof(double));
++	DoubleUnion u=NativetoLEU(d);
++	BOOL ok = WriteBuffer((BYTE*)&(u.u_INT64),sizeof(u.u_INT64));
+ 	LEAVEWRITEFUNCTION;
+ 	return (ok);
+ }	
+@@ -1323,22 +1325,25 @@
+ 
+ BOOL CXaraFileRecord::ReadFLOAT(FLOAT* pf)
+ {
+-	BOOL ok = ReadBuffer((BYTE*)pf,sizeof(FLOAT));
+-	*pf = LEtoNative(*pf);
++	FloatUnion f;
++	BOOL ok = ReadBuffer((BYTE*)&(f.u_INT32),sizeof(f.u_INT32));
++	*pf = LEtoNative(f);
+ 	return ok;
+ }
+ 
+ BOOL CXaraFileRecord::ReadDOUBLE(double* pd)
+ {
+-	BOOL ok = ReadBuffer((BYTE*)pd,sizeof(double));
+-	*pd = LEtoNative(*pd);
++	DoubleUnion f;
++	BOOL ok = ReadBuffer((BYTE*)&(f.u_INT64),sizeof(f.u_INT64));
++	*pd = LEtoNative(f);
+ 	return ok;
+ }
+ 
+ BOOL CXaraFileRecord::ReadDOUBLEnoError(double* pd)
+ {
+-	BOOL ok = ReadBuffernoError((BYTE*)pd,sizeof(double));
+-	*pd = LEtoNative(*pd);
++	DoubleUnion f;
++	BOOL ok = ReadBuffernoError((BYTE*)&(f.u_INT64),sizeof(f.u_INT64));
++	*pd = LEtoNative(f);
+ 	return ok;
+ }
+ 
+Index: wxOil/hardwaremanager.h
+===================================================================
+--- xaralx/wxOil/hardwaremanager.h	(revision 1694)
++++ xaralx/wxOil/hardwaremanager.h	(revision 1695)
+@@ -115,6 +115,19 @@
+ 
+ namespace oilHardwareManager
+ {
++	// Avoid aliasing problems
++	union DoubleUnion
++	{
++		double u_double;
++		INT64 u_INT64;
++	};
++
++	union FloatUnion
++	{
++		float u_float;
++		INT32 u_INT32;
++	};
++
+ // Byte ordering functions
+ #if defined(WORDS_BIGENDIAN)
+ 	// __BIG_ENDIAN__
+@@ -158,16 +171,28 @@
+ 	static inline FIXED16 NativetoBE(FIXED16 n) {return n;}
+ 	static inline FIXED16 NativetoLE(FIXED16 n) {return FIXED16::FromRawLong(wxINT32_SWAP_ALWAYS(n.GetRawLong()));}
+ 
+-	static inline float BEtoNative(float n) {return n;}
+-	static inline float LEtoNative(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
+-	static inline float NativetoBE(float n) {return n;}
+-	static inline float NativetoLE(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
++	// AMB is not sure these are are a great idea as they rely on floats/doubles being set up with invalid data
++//	static inline float BEtoNative(float n) {return n;}
++//	static inline float LEtoNative(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
++//	static inline float NativetoBE(float n) {return n;}
++//	static inline float NativetoLE(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
+ 
+-	static inline double BEtoNative(double n) {return n;}
+-	static inline double LEtoNative(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
+-	static inline double NativetoBE(double n) {return n;}
+-	static inline double NativetoLE(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
++	// AMB is not sure these are are a great idea as they rely on floats/doubles being set up with invalid data
++//	static inline double BEtoNative(double n) {return n;}
++//	static inline double LEtoNative(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
++//	static inline double NativetoBE(double n) {return n;}
++//	static inline double NativetoLE(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
+ 
++	static inline float BEtoNative(FloatUnion n) {return n.u_float;}
++	static inline float LEtoNative(FloatUnion n) {n.u_INT32 = wxINT32_SWAP_ALWAYS(n.u_INT32); return n.u_float;}
++	static inline FloatUnion NativetoBEU(float n) {FloatUnion f; f.u_float=n; return f;}
++	static inline FloatUnion NativetoLEU(float n) {FloatUnion f; f.u_float=n; f.u_INT32 = wxINT32_SWAP_ALWAYS(f.u_INT32); return f;}
++
++	static inline double BEtoNative(DoubleUnion n) {return n.u_double;}
++	static inline double LEtoNative(DoubleUnion n) {n.u_INT64 = wxINT64_SWAP_ALWAYS(n.u_INT64); return n.u_double;}
++	static inline DoubleUnion NativetoBEU(double n) {DoubleUnion f; f.u_double=n; return f;}
++	static inline DoubleUnion NativetoLEU(double n) {DoubleUnion f; f.u_double=n; f.u_INT64 = wxINT64_SWAP_ALWAYS(f.u_INT64); return f;}
++
+ #else
+ 	// __LITTLE_ENDIAN__
+ 	// Little-Endian, signed
+@@ -210,16 +235,27 @@
+ 	static inline FIXED16 NativetoBE(FIXED16 n) {return FIXED16::FromRawLong(wxINT32_SWAP_ALWAYS(n.GetRawLong()));}
+ 	static inline FIXED16 NativetoLE(FIXED16 n) {return n;}
+ 
+-	static inline float BEtoNative(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
+-	static inline float LEtoNative(float n) {return n;}
+-	static inline float NativetoBE(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
+-	static inline float NativetoLE(float n) {return n;}
++	// AMB is not sure these are are a great idea as they rely on floats/doubles being set up with invalid data
++//	static inline float BEtoNative(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
++//	static inline float LEtoNative(float n) {return n;}
++//	static inline float NativetoBE(float n) {return n;} //{return reinterpret_cast<float>(wxINT32_SWAP_ALWAYS(reinterpret_cast<INT32>(n)));}
++//	static inline float NativetoLE(float n) {return n;}
+ 
+-	static inline double BEtoNative(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
+-	static inline double LEtoNative(double n) {return n;}
+-	static inline double NativetoBE(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
+-	static inline double NativetoLE(double n) {return n;}
++	// AMB is not sure these are are a great idea as they rely on floats/doubles being set up with invalid data
++//	static inline double BEtoNative(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
++//	static inline double LEtoNative(double n) {return n;}
++//	static inline double NativetoBE(double n) {return n;} //{return reinterpret_cast<double>(wxINT64_SWAP_ALWAYS(reinterpret_cast<INT64>(n)));}
++//	static inline double NativetoLE(double n) {return n;}
+ 
++	static inline float BEtoNative(FloatUnion n) {n.u_INT32 = wxINT32_SWAP_ALWAYS(n.u_INT32); return n.u_float;}
++	static inline float LEtoNative(FloatUnion n) {return n.u_float;}
++	static inline FloatUnion NativetoBEU(float n) {FloatUnion f; f.u_float=n; f.u_INT32 = wxINT32_SWAP_ALWAYS(f.u_INT32); return f;}
++	static inline FloatUnion NativetoLEU(float n) {FloatUnion f; f.u_float=n; return f;}
++
++	static inline double BEtoNative(DoubleUnion n) {n.u_INT64 = wxINT64_SWAP_ALWAYS(n.u_INT64); return n.u_double;}
++	static inline double LEtoNative(DoubleUnion n) {return n.u_double;}
++	static inline DoubleUnion NativetoBEU(double n) {DoubleUnion f; f.u_double=n; f.u_INT64 = wxINT64_SWAP_ALWAYS(f.u_INT64); return f;}
++	static inline DoubleUnion NativetoLEU(double n) {DoubleUnion f; f.u_double=n; return f;}
+ #endif
+ 
+ // -------------------------------------------------------------------------------

Reply via email to