- Change patch to fix 32 bit issues in the mono bindings

(Itdb_Track data structure contained wrong values on x86 systems)
This commit is contained in:
Christian Krause 2011-01-09 18:40:35 +01:00
parent 78496e5a5a
commit c0d6367f8e
2 changed files with 118 additions and 35 deletions

View File

@ -1,69 +1,146 @@
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Artwork.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/Artwork.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Artwork.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/Artwork.cs 2010-10-21 00:23:46.000000000 +0200
@@ -24,7 +24,7 @@
From a39a5f0870149b47292f7bc3d303d3d8f569f013 Mon Sep 17 00:00:00 2001
From: Christian Krause <chkr@fedoraproject.org>
Date: Thu, 6 Jan 2011 23:12:43 +0100
Subject: [PATCH] fix alignment issues on x86
---
bindings/mono/Makefile.include | 2 +-
bindings/mono/libgpod-sharp/Artwork.cs | 4 ++++
bindings/mono/libgpod-sharp/Chapter.cs | 4 ++++
bindings/mono/libgpod-sharp/IpodInfo.cs | 5 +++++
bindings/mono/libgpod-sharp/PhotoAlbum.cs | 5 +++++
bindings/mono/libgpod-sharp/Playlist.cs | 5 +++++
bindings/mono/libgpod-sharp/Track.cs | 4 ++++
configure.ac | 7 +++++++
8 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/bindings/mono/Makefile.include b/bindings/mono/Makefile.include
index 504b059..a587456 100644
--- a/bindings/mono/Makefile.include
+++ b/bindings/mono/Makefile.include
@@ -18,7 +18,7 @@ all: $(ASSEMBLY_FILE)
$(ASSEMBLY_FILE).mdb: $(ASSEMBLY_FILE)
$(ASSEMBLY_FILE): $(SOURCES_BUILD)
- $(MCS) -debug -unsafe -target:$(TARGET) -out:$@ $(LINK) $(SOURCES_BUILD)
+ $(MCS) $(GMCS_FLAGS) -debug -unsafe -target:$(TARGET) -out:$@ $(LINK) $(SOURCES_BUILD)
EXTRA_DIST = $(SOURCES_BUILD)
diff --git a/bindings/mono/libgpod-sharp/Artwork.cs b/bindings/mono/libgpod-sharp/Artwork.cs
index 5be7369..5773e35 100644
--- a/bindings/mono/libgpod-sharp/Artwork.cs
+++ b/bindings/mono/libgpod-sharp/Artwork.cs
@@ -24,7 +24,11 @@ namespace GPod {
using native;
namespace native {
- [StructLayout (LayoutKind.Sequential)]
+ [StructLayout (LayoutKind.Sequential, Pack=1)]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
[StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_Artwork {
public IntPtr thumbnail;
public uint id;
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Chapter.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/Chapter.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Chapter.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/Chapter.cs 2010-10-21 00:23:46.000000000 +0200
@@ -22,7 +22,7 @@
diff --git a/bindings/mono/libgpod-sharp/Chapter.cs b/bindings/mono/libgpod-sharp/Chapter.cs
index 66ca556..ea632cd 100644
--- a/bindings/mono/libgpod-sharp/Chapter.cs
+++ b/bindings/mono/libgpod-sharp/Chapter.cs
@@ -22,7 +22,11 @@ namespace GPod {
using native;
namespace native {
- [StructLayout (LayoutKind.Sequential)]
+ [StructLayout (LayoutKind.Sequential, Pack=1)]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
[StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_Chapter {
public uint startpos;
public IntPtr chaptertitle;
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/IpodInfo.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/IpodInfo.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/IpodInfo.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/IpodInfo.cs 2010-10-21 00:23:46.000000000 +0200
@@ -23,6 +23,7 @@
diff --git a/bindings/mono/libgpod-sharp/IpodInfo.cs b/bindings/mono/libgpod-sharp/IpodInfo.cs
index 697041b..14024eb 100644
--- a/bindings/mono/libgpod-sharp/IpodInfo.cs
+++ b/bindings/mono/libgpod-sharp/IpodInfo.cs
@@ -23,6 +23,11 @@ namespace GPod {
using System.Collections.Generic;
namespace native {
+ [StructLayout (LayoutKind.Sequential, Pack=1) ]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
+ [StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_IpodInfo {
public IntPtr model_number;
public double capacity;
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/PhotoAlbum.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/PhotoAlbum.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/PhotoAlbum.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/PhotoAlbum.cs 2010-10-21 00:23:46.000000000 +0200
@@ -24,6 +24,7 @@
diff --git a/bindings/mono/libgpod-sharp/PhotoAlbum.cs b/bindings/mono/libgpod-sharp/PhotoAlbum.cs
index 42b2365..4a248ec 100644
--- a/bindings/mono/libgpod-sharp/PhotoAlbum.cs
+++ b/bindings/mono/libgpod-sharp/PhotoAlbum.cs
@@ -24,6 +24,11 @@ namespace GPod {
using native;
namespace native {
+ [StructLayout (LayoutKind.Sequential, Pack=1) ]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
+ [StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_PhotoAlbum {
public IntPtr photodb;
public IntPtr name;
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Playlist.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/Playlist.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Playlist.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/Playlist.cs 2010-10-21 00:23:46.000000000 +0200
@@ -24,6 +24,7 @@
diff --git a/bindings/mono/libgpod-sharp/Playlist.cs b/bindings/mono/libgpod-sharp/Playlist.cs
index 7ff5a68..48e4e32 100644
--- a/bindings/mono/libgpod-sharp/Playlist.cs
+++ b/bindings/mono/libgpod-sharp/Playlist.cs
@@ -24,6 +24,11 @@ namespace GPod {
using native;
namespace native {
+ [StructLayout (LayoutKind.Sequential, Pack=1) ]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
+ [StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_Playlist {
public IntPtr itdb;
public IntPtr name;
diff -uNr libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Track.cs libgpod-0.8.0/bindings/mono/libgpod-sharp/Track.cs
--- libgpod-0.8.0.old/bindings/mono/libgpod-sharp/Track.cs 2010-10-09 22:46:03.000000000 +0200
+++ libgpod-0.8.0/bindings/mono/libgpod-sharp/Track.cs 2010-10-21 00:23:46.000000000 +0200
@@ -24,7 +24,7 @@
diff --git a/bindings/mono/libgpod-sharp/Track.cs b/bindings/mono/libgpod-sharp/Track.cs
index 434df7e..ce716fa 100644
--- a/bindings/mono/libgpod-sharp/Track.cs
+++ b/bindings/mono/libgpod-sharp/Track.cs
@@ -24,7 +24,11 @@ namespace GPod {
namespace native {
- [StructLayout (LayoutKind.Sequential)]
+ [StructLayout (LayoutKind.Sequential, Pack=1)]
+#if ALIGNMENT_X86_LINUX
+ [StructLayout (LayoutKind.Sequential, Pack=4)]
+#else
[StructLayout (LayoutKind.Sequential)]
+#endif
internal struct Itdb_Track {
public IntPtr itdb;
public IntPtr title;
diff --git a/configure.ac b/configure.ac
index 295faf6..e278392 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,6 +315,13 @@ dnl **************************************************
MONO_MIN_VERSION=1.9.1
GTK_SHARP_MIN_VERSION=2.12
LIBGPOD_CHECK_MONO
+AC_CHECK_ALIGNOF([double])
+if test "$ac_cv_alignof_double" -eq 4 ; then
+ GMCS_FLAGS=-define:ALIGNMENT_X86_LINUX
+else
+ GMCS_FLAGS=
+fi
+AC_SUBST(GMCS_FLAGS)
dnl warnings bits, copied from gnome-keyring configure.in
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
--
1.7.3.4

View File

@ -3,11 +3,12 @@
Summary: Library to access the contents of an iPod
Name: libgpod
Version: 0.8.0
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtkpod.org/libgpod.html
Source0: http://downloads.sourceforge.net/gtkpod/%{name}-%{version}.tar.gz
# http://sourceforge.net/tracker/index.php?func=detail&aid=3059994&group_id=67873&atid=519273
Patch0: libgpod-0.8.0-x86-32.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: docbook-style-xsl
@ -29,7 +30,7 @@ BuildRequires: python-mutagen
BuildRequires: sg3_utils-devel
BuildRequires: sqlite-devel
BuildRequires: swig
BuildRequires: autoconf
BuildRequires: autoconf automake libtool
Requires: udev
%description
@ -114,6 +115,7 @@ chmod -x bindings/python/examples/*.py
%build
autoreconf -f -i
%configure --without-hal --enable-udev --with-temp-mount-dir=%{_localstatedir}/run/%{name}
make %{?_smp_mflags}
@ -180,6 +182,10 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/%{name}-sharp.pc
%changelog
* Sat Jan 08 2011 Christian Krause <chkr@fedoraproject.org> - 0.8.0-5
- Change patch to fix 32 bit issues in the mono bindings
(Itdb_Track data structure contained wrong values on x86 systems)
* Sun Dec 26 2010 Bastien Nocera <bnocera@redhat.com> 0.8.0-4
- Rebuild for new libimobiledevice