summaryrefslogtreecommitdiff
path: root/devel/m4
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-07-29 14:36:46 +0000
committerjoerg <joerg@pkgsrc.org>2007-07-29 14:36:46 +0000
commit826763b775d3c29ab79325b94ce65f6b21bf0348 (patch)
treeb3626f7bc7f3bb2a8b8f057d4d1fe0adecb97727 /devel/m4
parent011ce190625ebe6cab4d184eba00287ecea115cc (diff)
downloadpkgsrc-826763b775d3c29ab79325b94ce65f6b21bf0348.tar.gz
Override gnulib's fflush.c on DragonFly with a far less intrusive
versions. This is still in discussion with upstream, but working m4 is critical, so apply this stop-gap solution. It works on the other BSD derived stdio implementations as well, if you want to switch.
Diffstat (limited to 'devel/m4')
-rw-r--r--devel/m4/Makefile7
-rw-r--r--devel/m4/distinfo4
-rw-r--r--devel/m4/files/bsd-fflush.c72
-rw-r--r--devel/m4/patches/patch-ab13
-rw-r--r--devel/m4/patches/patch-ac24
5 files changed, 118 insertions, 2 deletions
diff --git a/devel/m4/Makefile b/devel/m4/Makefile
index 04855a46894..33cfa9d0b9c 100644
--- a/devel/m4/Makefile
+++ b/devel/m4/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.50 2007/07/22 06:34:41 wiz Exp $
+# $NetBSD: Makefile,v 1.51 2007/07/29 14:36:46 joerg Exp $
DISTNAME= m4-1.4.10
PKGREVISION= 1
@@ -32,6 +32,11 @@ PLIST_SUBST+= GM4_LINK=""
PLIST_SUBST+= GM4_LINK="@comment "
.endif
+.if ${OPSYS} == "DragonFly"
+post-patch:
+ ${CP} ${FILESDIR}/bsd-fflush.c ${WRKSRC}/lib/fflush.c
+.endif
+
post-install:
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/examples/m4
${INSTALL_DATA} ${WRKSRC}/examples/*.m4 ${DESTDIR}${PREFIX}/share/examples/m4
diff --git a/devel/m4/distinfo b/devel/m4/distinfo
index 2f9872f9dac..739b8b10e45 100644
--- a/devel/m4/distinfo
+++ b/devel/m4/distinfo
@@ -1,6 +1,8 @@
-$NetBSD: distinfo,v 1.19 2007/07/22 06:34:41 wiz Exp $
+$NetBSD: distinfo,v 1.20 2007/07/29 14:36:46 joerg Exp $
SHA1 (m4-1.4.10.tar.gz) = 26d47c893722d683308f5d9fc172a11d5b2ad8a9
RMD160 (m4-1.4.10.tar.gz) = 0a26a714ce9691006524da7c2c3e2859e7321a95
Size (m4-1.4.10.tar.gz) = 928375 bytes
SHA1 (patch-aa) = 426327aabb1f48647b3561439dba0261a49860f3
+SHA1 (patch-ab) = 01838a4b055888f48650f6e621f3848c47f7af2a
+SHA1 (patch-ac) = 86c14a4deae3171a0b7a66a2daf94eb58688b742
diff --git a/devel/m4/files/bsd-fflush.c b/devel/m4/files/bsd-fflush.c
new file mode 100644
index 00000000000..f0bdf4ea09c
--- /dev/null
+++ b/devel/m4/files/bsd-fflush.c
@@ -0,0 +1,72 @@
+/* $NetBSD: bsd-fflush.c,v 1.1 2007/07/29 14:36:46 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+ * All rights reserved.
+ *
+ * This code was developed as part of Google's Summer of Code 2007 program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#undef fflush
+
+int
+rpl_fflush(FILE *fp)
+{
+#if defined(__DragonFly__)
+ struct __FILE_public *fp_ = (struct __FILE_public *)fp;
+#else
+#define fp_ fp
+#endif
+ off_t pos;
+
+ /* NULL pointer or writeable stream: use normal fflush. */
+ if (fp == NULL || (fp_->_flags & (__SWR | __SRW)) != 0)
+ return fflush(fp);
+
+ /* Get current position, possibly different from file pointer. */
+ pos = ftello(fp);
+ if (pos == -1) {
+ errno = EBADF;
+ return -1;
+ }
+ /* Purge buffers. */
+ if (fpurge(fp) == EOF)
+ return -1;
+
+ /*
+ * Disable seek optimisation. This is forces the following
+ * fseeko to seek the actual position and not realign
+ * the file pointer on a block boundary.
+ */
+ fp_->_flags |= __SNPT;
+
+ return fseeko(fp, pos, SEEK_SET);
+}
diff --git a/devel/m4/patches/patch-ab b/devel/m4/patches/patch-ab
new file mode 100644
index 00000000000..4b8678eb88a
--- /dev/null
+++ b/devel/m4/patches/patch-ab
@@ -0,0 +1,13 @@
+$NetBSD: patch-ab,v 1.5 2007/07/29 14:36:46 joerg Exp $
+
+--- lib/freading.c.orig 2007-07-24 15:10:13.000000000 +0000
++++ lib/freading.c
+@@ -34,6 +34,8 @@ freading (FILE *fp)
+ return ((fp->_flags & _IO_NO_WRITES) != 0
+ || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+ && fp->_IO_read_base != NULL));
++#elif defined(__DragonFly__)
++ return (((struct __FILE_public *)fp)->_flags & __SRD) != 0;
+ #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
+ return (fp->_flags & __SRD) != 0;
+ #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
diff --git a/devel/m4/patches/patch-ac b/devel/m4/patches/patch-ac
new file mode 100644
index 00000000000..5571ed4ffa5
--- /dev/null
+++ b/devel/m4/patches/patch-ac
@@ -0,0 +1,24 @@
+$NetBSD: patch-ac,v 1.6 2007/07/29 14:36:47 joerg Exp $
+
+--- configure.orig 2007-07-29 13:25:52.000000000 +0000
++++ configure
+@@ -11711,10 +11711,17 @@ echo "${ECHO_T}$gl_cv_func_fflush_stdin"
+ if test $gl_cv_func_fflush_stdin = no; then
+
+ M4_LIBOBJS="$M4_LIBOBJS fflush.$ac_objext"
+- M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext"
+
+ REPLACE_FFLUSH=1
+- REPLACE_FSEEKO=1
++ case "$host_os" in
++ dragonfly*)
++ REPLACE_FSEEKO=0
++ ;;
++ *)
++ M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext"
++ REPLACE_FSEEKO=1
++ ;;
++ esac
+
+ fi
+