I don’t claim responsibility for this; as a matter of fact, this is merely a trivial update to David Krause’ patch offered previously. If it works for you, joy!
OpenBSD ships with a pre-GNU version of patch, and most diffs nowadays balk on it. It’s tiresome to try to make them work with this antiquated patch, and to live without a recent release.
I configured my own copy with —prefix=/usr —program-prefix=g (for gpatch, rather than conflicting with OpenBSD’s own patch), and /usr to ensure it stays in my tree. I would let it default to /usr/local, but truthfully, I can’t really afford to do that.
On with the patch! You’ll probably want to chdir into patch-2.5.4, and apply with patch -p1 – this will ONLY work if you apply it BEFORE you run configure – the patch to config.hin is required for the modified definitions for HAVE_MKSTEMP, and HAVE_MKTEMP – conversely, without this patch, configure will be wrong. You can execute, patch, clean, then reconfig, or hand patch it – either way, if your config.h doesn’t resemble this ‘config.hin’ file for the HAVE_MKSTEMP and HAVE_MKTEMP, make it so. ;)
Update: I’ve found that GNU’s BETA patch of 2.5.8 does compile on OpenBSD, but I’ve not tested that build, nor trust it. ;) (Since GNU.org’s FTP was compromised, they’ve yet to put everything ‘back in order’. This means that several things are still missing. This referenced beta being one of them.)
diff -r -N patch-2.5.4/config.hin patch-2.5.4-OpenBSD/config.hin —- patch-2.5.4/config.hin Sun Aug 29 23:53:17 1999 +++ patch-2.5.4-OpenBSD/config.hin Thu Sep 4 15:48:55 2003 -71,8 +71,13 /* Define if you have the mkdir function. */ #undef HAVE_MKDIR
+/* Define if you have the mkstemp function. */
+#undef HAVE_MKSTEMP
/* Define if you have the pathconf function. */ #undef HAVE_PATHCONF diff -r -N patch-2.5.4/configure patch-2.5.4-OpenBSD/configure —- patch-2.5.4/configure Sun Aug 29 23:44:34 1999 +++ patch-2.5.4-OpenBSD/configure Thu Sep 4 15:48:55 2003 -2448,7 +2448,7 fi
-for ac_func in _doprintf isascii fseeko memcmp mktemp \
+for ac_func in _doprintf isascii fseeko memcmp mktemp mkstemp \ pathconf raise setmode sigaction sigprocmask sigsetmask strerror do echo $ac_n “checking for $ac_func”“… $ac_c” 1>&6
diff -r -N patch-2.5.4/configure.in patch-2.5.4-OpenBSD/configure.in
—- patch-2.5.4/configure.in Sun Aug 29 23:20:08 1999
+++ patch-2.5.4-OpenBSD/configure.in Thu Sep 4 15:48:55 2003
-45,7 +45,7
AC_CHECK_FUNC(getopt_long, , [LIBOBJS=”$LIBOBJS getopt1\U.o getopt\U.o”]) AC_SUBST(LIBOBJS) -AC_CHECK_FUNCS(_doprintf isascii fseeko memcmp mktemp \ +AC_CHECK_FUNCS(_doprintf isascii fseeko memcmp mktemp mkstemp \ pathconf raise setmode sigaction sigprocmask sigsetmask strerror) AC_REPLACE_FUNCS(memchr mkdir rename rmdir) jm_FUNC_MALLOC diff -r -N patch-2.5.4/patch.c patch-2.5.4-OpenBSD/patch.c —- patch-2.5.4/patch.c Sun Aug 29 23:20:08 1999 +++ patch-2.5.4-OpenBSD/patch.c Thu Sep 4 15:50:15 2003 -1307,6 +1307,10 char *mktemp PARAMS ((char *)); #endif
+#if HAVE_MKSTEMP
#define INITHUNKMAX 125 /* initial dynamic allocation size */
-105,7 +106,7 if (!filename || !*filename || strEQ (filename, “-”)) { file_offset stdin_pos;
-#if HAVE_SETMODE
+#if defined(HAVE_SETMODE) && (!(defined(BSD) && BSD >= 199306)) if (binary_transput) { if (isatty (STDIN_FILENO))