File gmime-no-off_t.patch of Package gmime
To prevent future large rejects, removal of off_t is done in following way:
First run this script:
# Replace all occurrences of variable sized off_t by goffset:
sed -i "s/off_t/goffset/g;s/OFF_T/G_GINT64_FORMAT/g" */*.[ch]
# GMime.metadata does not need to be generated any more
mv mono/GMime.metadata.in mono/GMime.metadata
# api file is not regenerated during build. Fix it now:
# Current gtk# does not support goffset yet.
sed -i s/off_t/long/g mono/gmime-api.raw
# And finally fix all remaining problems related to off_t:
patch -p0 <gmime-no-off_t.patch
--- Makefile.am
+++ Makefile.am
@@ -49,7 +49,6 @@
## Use sed and then mv to avoid problems if the user interrupts.
sed -e 's?\@GMIME_LIBDIR\@?$(GMIME_LIBDIR)?g' \
-e 's?\@GMIME_INCLUDEDIR\@?$(GMIME_INCLUDEDIR)?g' \
- -e 's?\@GMIME_CFLAGS\@?$(GMIME_CFLAGS)?g' \
-e 's?\@GMIME_LIBS\@?$(GMIME_LIBS)?g' \
-e 's?\@VERSION\@?$(VERSION)?g' \
< $(srcdir)/gmimeConf.sh.in > gmimeConf.tmp \
--- configure.in
+++ configure.in
@@ -14,7 +14,7 @@
GMIME_MINOR_VERSION=2
GMIME_MICRO_VERSION=18
GMIME_VERSION=$GMIME_MAJOR_VERSION.$GMIME_MINOR_VERSION.$GMIME_MICRO_VERSION
-GMIME_VERSION_INFO=`expr $GMIME_MAJOR_VERSION + $GMIME_MINOR_VERSION`:$GMIME_MICRO_VERSION:$GMIME_MINOR_VERSION
+GMIME_VERSION_INFO=`expr $GMIME_MAJOR_VERSION + $GMIME_MINOR_VERSION - 1`:`expr $GMIME_MICRO_VERSION - 11`:`expr $GMIME_MINOR_VERSION - 2`
AC_SUBST(GMIME_MAJOR_VERSION)
AC_SUBST(GMIME_MINOR_VERSION)
@@ -145,8 +145,8 @@
AC_DEFINE(ENABLE_WARNINGS, 1, [Define if GMime should enable warning output.])
fi
-dnl We need at *least* glib 2.0.0
-AM_PATH_GLIB_2_0(2.0.0, ,
+dnl We need at *least* glib 2.14.0 (for goffset, otherwise 2.0.0 is sufficient)
+AM_PATH_GLIB_2_0(2.14.0, ,
AC_MSG_ERROR(Cannot find GLIB: Is pkg-config in your path?),
gobject gmodule gthread)
@@ -315,70 +315,13 @@
dnl *************************************
dnl *** Checks for large file support ***
dnl *************************************
-AC_ARG_ENABLE(largefile,
- AC_HELP_STRING([--enable-largefile],
- [enable support for large files [[default=no]]]),,
- enable_largefile="no")
-if test "x$enable_largefile" != "xno"; then
- AC_SYS_LARGEFILE
- AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], largefile64_source,
- [
- AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- ],[
- int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
- ],[
- largefile64_source="no"
- ],[
- AC_TRY_COMPILE([
- #define _LARGEFILE64_SOURCE
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- ],[
- int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
- ],[
- largefile64_source="yes"
- ],[
- largefile64_source="unknown"
- ])
- ])
- ])
-
- enable_largefile="no"
-
- if test "x$largefile64_source" = "xyes"; then
- GMIME_CFLAGS="-D_LARGEFILE64_SOURCE"
- enable_largefile="yes"
- elif test "x$largefile64_source" = "xunknown"; then
- AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
- fi
-
- if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
- GMIME_CFLAGS="$GMIME_CFLAGS -D_LARGE_FILES"
- enable_largefile="yes"
- fi
-
- if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
- GMIME_CFLAGS="$GMIME_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
- enable_largefile="yes"
- fi
-else
- GMIME_CFLAGS=""
-fi
-AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = "xyes")
+AC_SYS_LARGEFILE
dnl Check type sizes
-CFLAGS_save="$CFLAGS"
-CFLAGS="$CFLAGS $GMIME_CFLAGS"
AC_CHECK_SIZEOF(ssize_t)
AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(off_t)
-CFLAGS="$CFLAGS_save"
-dnl convenience printf formatting macros for ssize_t/size_t/off_t
+dnl convenience printf formatting macros for ssize_t/size_t
if test $ac_cv_sizeof_size_t -eq 8; then
AC_DEFINE(SSIZE_T, "%lld", [Define to the `ssize_t' printf formatter.])
AC_DEFINE(SIZE_T, "%llu", [Define to the `size_t' printf formatter.])
@@ -386,11 +329,6 @@
AC_DEFINE(SSIZE_T, "%ld", [Define to the `ssize_t' printf formatter.])
AC_DEFINE(SIZE_T, "%lu", [Define to the `size_t' printf formatter.])
fi
-if test $ac_cv_sizeof_off_t -eq 8; then
- AC_DEFINE(OFF_T, "%lld", [Define to the `off_t' printf formatter.])
-else
- AC_DEFINE(OFF_T, "%ld", [Define to the `off_t' printf formatter.])
-fi
dnl Check for some network functions
@@ -503,7 +441,6 @@
AC_SUBST(GMIME_LIBS)
AC_SUBST(GMIME_LIBDIR)
AC_SUBST(GMIME_INCLUDEDIR)
-AC_SUBST(GMIME_CFLAGS)
AC_OUTPUT(
--- examples/Makefile.am
+++ examples/Makefile.am
@@ -4,7 +4,7 @@
extra_DIST = README
-INCLUDES = -I$(top_srcdir) $(GMIME_CFLAGS) $(GLIB_CFLAGS)
+INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS)
noinst_PROGRAMS = basic-example imap-example
--- gmime-2.0.pc.in
+++ gmime-2.0.pc.in
@@ -9,4 +9,4 @@
Description: MIME parser and utility library
Requires: glib-2.0,gobject-2.0
Libs: -L${libdir} @GMIME_LIBS@
-Cflags: -I${includedir}/gmime-2.0 @GMIME_CFLAGS@
+Cflags: -I${includedir}/gmime-2.0
--- gmime-config.in
+++ gmime-config.in
@@ -55,7 +55,7 @@
;;
--cflags)
- echo @GMIME_INCLUDEDIR@ @GMIME_CFLAGS@ @glib_cflags@
+ echo @GMIME_INCLUDEDIR@ @glib_cflags@
;;
--libs)
--- gmime/Makefile.am
+++ gmime/Makefile.am
@@ -10,7 +10,6 @@
$(VERSION_FLAGS) \
-DG_LOG_DOMAIN=\"gmime\" \
-DG_DISABLE_DEPRECATED \
- $(GMIME_CFLAGS) \
$(GLIB_CFLAGS)
VERSION_FLAGS = -DGMIME_VERSION=\"$(GMIME_VERSION)\" \
--- gmimeConf.sh.in
+++ gmimeConf.sh.in
@@ -3,6 +3,5 @@
#
GMIME_LIBDIR="@GMIME_LIBDIR@"
GMIME_LIBS="@GMIME_LIBS@"
-GMIME_CFLAGS="@GMIME_CFLAGS@"
GMIME_INCLUDEDIR="@GMIME_INCLUDEDIR@"
MODULE_VERSION="gmime-@VERSION@"
--- mono/GMime.metadata
+++ mono/GMime.metadata
@@ -42,17 +42,11 @@
<attr path="/api/namespace/object[@cname='GMimeMultipart']/method[@name='Foreach']" name="name">ForeachPart</attr>
<attr path="/api/namespace/object[@cname='GMimeStream']/method[@name='Length']" name="name">GetLength</attr>
- <!-- We need to remap off_t conditionally. For 64-bit systems or 32-bit
- systems without large file support, "long" is the right thing here, and
- the generator will map it to an IntPtr for marshaling. However, if
- large file support is enabled on 32-bit systems, off_t must be mapped to
- "gint64" and marshaled as a C# "long". See Makefile.am for the actual
- replacement. -->
-
- <attr path="/api/namespace/*/field[@type='off_t']" name="type">@off_t_type@</attr>
- <attr path="/api/namespace/*/*/return-type[@type='off_t']" name="type">@off_t_type@</attr>
- <attr path="/api/namespace/*/*/parameter[@type='off_t']" name="type">@off_t_type@</attr>
- <attr path="/api/namespace/*/*/*/parameter[@type='off_t']" name="type">@off_t_type@</attr>
+ <!-- We need to remap goffset to 64-bit "long" -->
+ <attr path="/api/namespace/*/field[@type='long']" name="type">goffset</attr>
+ <attr path="/api/namespace/*/*/return-type[@type='long']" name="type">goffset</attr>
+ <attr path="/api/namespace/*/*/parameter[@type='long']" name="type">goffset</attr>
+ <attr path="/api/namespace/*/*/*/parameter[@type='long']" name="type">goffset</attr>
<!-- We want to be able to get at the type and subtype fields of this
structure, so don't mark it as opaque. -->
--- mono/Makefile.am
+++ mono/Makefile.am
@@ -1,7 +1,6 @@
API=gmime-api.xml
RAW_API = gmime-api.raw
METADATA = GMime.metadata
-METADATA_IN = $(METADATA).in
ASSEMBLY_NAME = gmime-sharp
references = $(GTK_SHARP_LIBS)
SOURCES_XML = sources.xml
@@ -12,7 +11,7 @@
gapidir = $(datadir)/gapi-2.0
noinst_DATA = $(ASSEMBLY) $(ASSEMBLY).config
gapi_DATA = $(API)
-CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API) $(METADATA)
+CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API)
DISTCLEANFILES = $(ASSEMBLY).config AssemblyInfo.cs
pkgconfigdir = $(libdir)/pkgconfig
@@ -48,21 +47,12 @@
$(ASSEMBLY_NAME).pub \
AssemblyInfo.cs.in \
$(RAW_API) \
- $(METADATA_IN) \
+ $(METADATA) \
$(customs) \
$(sources) \
$(SOURCES_XML) \
gmime-sharp.pc.in
-if ENABLE_LARGEFILE
-off_t_type=gint64
-else
-off_t_type=long
-endif
-
-$(METADATA): $(srcdir)/$(METADATA_IN)
- sed -e 's|\@off_t_type\@|$(off_t_type)|g' < $(srcdir)/$(METADATA_IN) > $@
-
$(API): $(srcdir)/$(RAW_API) $(METADATA)
cp $(srcdir)/$(RAW_API) $(API)
chmod u+w $(API)
--- src/Makefile.am
+++ src/Makefile.am
@@ -2,7 +2,7 @@
SUBDIRS = .
-INCLUDES = -I$(top_srcdir) $(GMIME_CFLAGS) $(GLIB_CFLAGS)
+INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS)
bin_PROGRAMS = uuencode uudecode
--- tests/Makefile.am
+++ tests/Makefile.am
@@ -8,7 +8,6 @@
$(VERSION_FLAGS) \
-DG_LOG_DOMAIN=\"gmime-tests\" \
-DG_DISABLE_DEPRECATED \
- $(GMIME_CFLAGS) \
$(GLIB_CFLAGS)
VERSION_FLAGS = -DGMIME_VERSION=\"$(GMIME_VERSION)\" \
--- util/Makefile.am
+++ util/Makefile.am
@@ -8,7 +8,6 @@
$(VERSION_FLAGS) \
-DG_LOG_DOMAIN=\"util\" \
-DG_DISABLE_DEPRECATED \
- $(GMIME_CFLAGS) \
$(GLIB_CFLAGS)
libutil_la_SOURCES = \