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 mktemp function. */
    +#ifndef HAVE_MKSTEMP #undef HAVE_MKTEMP
    +#endif

/* 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

  • int fd;
    +#endif
  • #ifndef TMPDIR #define TMPDIR “/tmp” #endif
    -1315,7 +1319,7 make_temp (int letter) { char *r;
    -#if HAVE_MKTEMP
    +#if defined(HAVE_MKSTEMP) || defined(HAVE_MKTEMP) char const tmpdir = getenv (“TMPDIR”); / Unix tradition */ if (!tmpdir) tmpdir = getenv (“TMP”); /* DOS tradition */ if (!tmpdir) tmpdir = getenv (“TEMP”); /* another DOS tradition */
    -1322,6 +1326,12 if (!tmpdir) tmpdir = TMPDIR; r = xmalloc (strlen (tmpdir) + 10); sprintf (r, “%s/p%cXXXXXX”, tmpdir, letter);
    +#endif
    +#ifdef HAVE_MKSTEMP
  • if ((fd = mkstemp ®) -1) + pfatal ("mkstemp"); +#else +#ifdef HAVE_MKTEMP mktemp (r); if (!*r) pfatal ("mktemp"); @@ -1329,6 +1339,7 @@ r = xmalloc (L_tmpnam); if (! (tmpnam (r) r && *r)) pfatal (“tmpnam”);
    +#endif #endif return r; }
    diff -r -N patch-2.5.4/pch.c patch-2.5.4-OpenBSD/pch.c
    —- patch-2.5.4/pch.c Sun Aug 29 23:20:08 1999
    +++ patch-2.5.4-OpenBSD/pch.c Thu Sep 4 15:53:04 2003
    -30,6 +30,7 #undef XTERN #define XTERN #include
    +#include

#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))

Previous Post Next Post