mpd: make this build on NetBSD/powerpc 10.0_BETA.

Seldom have I seen a program so crusty, e.g. wanting to declare
standard library functions on its own(!)  There are still *lots*
of warnings produced during the build.

"make test" has lots of tests failing for NetBSD/macppc, but at
least quite a few succeed as well.  That's at least something...
This commit is contained in:
he 2023-02-16 17:59:49 +00:00
parent a518c2283c
commit 8b8077162d
4 changed files with 118 additions and 7 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.11 2021/10/26 10:51:43 nia Exp $
$NetBSD: distinfo,v 1.12 2023/02/16 17:59:49 he Exp $
BLAKE2s (mpd-language/mpd.1.0.1.tgz) = beafa8fb9b4d0a1b35f99f72b1959a308dcb2f4c3348cbe087f640db5e20992e
SHA512 (mpd-language/mpd.1.0.1.tgz) = bbd3d99161b6e041042c5fbef42fd14ca46e7ebec00f945ae1d0e4f752b02d03f89cddc9615367105331af496a9f0908e375fe7f7bda15eeb3287752c6e4b61b
@ -8,7 +8,7 @@ SHA1 (patch-ab) = 2a086280fefb4acddd19cb3cbafd58f8de5b309e
SHA1 (patch-ar) = 2cb9c743870aa91edb77f83b4ce4c36424a6bb5b
SHA1 (patch-as) = e3ec11eace9d11349077adcf4e5bb16ac6e3e1a4
SHA1 (patch-at) = e96ef9ceee5edc32e33b6aa80b949e7ebd188b9a
SHA1 (patch-au) = 7d2ebdef6c007a286b0dc0ab007039d4dbca67ed
SHA1 (patch-au) = e90c5fe0f8e8b397ed2ac412013e0968606d0e9c
SHA1 (patch-av) = 49727b74c938e15d87447b4a7dcdc09840593351
SHA1 (patch-aw) = b7849bfaa2bbdf218d09147ef0461e4fcbd7e7f6
SHA1 (patch-ax) = 1ed20dc2f4f0fb086a267d60de85ef6c9f1629ee
@ -27,3 +27,5 @@ SHA1 (patch-bj) = c5123801140fbfdcbfdabbcd39fe70d2e71355fc
SHA1 (patch-bk) = b51a6e1ead24feee415dd875fb049b8071f7c229
SHA1 (patch-bl) = 80f35b366bb6ccf9eaf07ae772a6406cac8b24b9
SHA1 (patch-bm) = 3f5f3143451b8509b94188e5ce1c375f9bd2619f
SHA1 (patch-gen.h) = dd051c5adb4eb5b72ba899266283c9dbb9d2569a
SHA1 (patch-mpd_main.c) = ae71569e772314099d272e0d1860d4e6c3d9cb93

View File

@ -1,10 +1,8 @@
$NetBSD: patch-au,v 1.2 2015/12/29 23:34:52 dholland Exp $
$NetBSD: patch-au,v 1.3 2023/02/16 17:59:49 he Exp $
Context switch code for NetBSD.
--- csw/netbsd.c.orig 2005-03-02 13:00:06.000000000 +0000
--- csw/netbsd.c.orig 2023-02-16 17:24:05.920061403 +0000
+++ csw/netbsd.c
@@ -0,0 +1,112 @@
@@ -0,0 +1,138 @@
+/*
+ * netbsd.c -- context switch code for NetBSD 2.
+ *
@ -44,6 +42,32 @@ Context switch code for NetBSD.
+}
+#endif
+
+#ifdef __powerpc__
+void pthread__init(void);
+
+#define _setcontext_u(uc) (*_md_setcontext_u)(uc)
+#define _swapcontext_u(oc,nc) (*_md_swapcontext_u)(oc,nc)
+
+static void mpd_setcontext_u(ucontext_t *);
+static void mpd_swapcontext_u(ucontext_t *, ucontext_t *);
+
+void (*_md_getcontext_u) (ucontext_t *);
+void (*_md_setcontext_u) (ucontext_t *) = mpd_setcontext_u;
+void (*_md_swapcontext_u)(ucontext_t *, ucontext_t *) = mpd_swapcontext_u;
+
+static void
+mpd_setcontext_u(ucontext_t *uc) {
+ pthread__init();
+ setcontext(uc);
+}
+
+static void
+mpd_swapcontext_u(ucontext_t *oldc, ucontext_t *newc) {
+ pthread__init();
+ swapcontext(oldc, newc);
+}
+#endif
+
+
+/*
+ * mpd_build_context (func, buf, bufsize, arg1, arg2, arg3, arg4)

View File

@ -0,0 +1,39 @@
$NetBSD: patch-gen.h,v 1.1 2023/02/16 17:59:49 he Exp $
Don't declare library functions on your own on NetBSD,
instead, use standard headers.
--- gen.h.orig 2000-10-31 22:53:40.000000000 +0000
+++ gen.h
@@ -32,9 +32,15 @@
* Don't use protoypes here; increases conflicts with system include files.
*/
+#if defined(__NetBSD__)
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#else
char *getenv(), *getcwd();
char *strcat(), *strncat(), *strchr(), *strrchr(), *strcpy(), *strncpy();
void exit();
+#endif
/* int functions are not explicitly defined -- use implicit definitions */
/* This avoids conflicts on Solaris (at least) where strlen is a size_t fn */
@@ -43,11 +49,15 @@ void exit();
double fmod(); /* not in Sequent <math.h> */
#if defined(__STDC__) || defined(__sgi) || defined(_AIX) || defined(__alpha)
+# if !defined(__NetBSD__)
void *malloc(), *realloc();
void *memset(), *memcpy();
+# endif
#else
+# if !defined(__NetBSD__)
char *malloc(), *realloc();
char *memset(), *memcpy();
+# endif
#endif

View File

@ -0,0 +1,46 @@
$NetBSD: patch-mpd_main.c,v 1.1 2023/02/16 17:59:49 he Exp $
--- mpd/main.c.orig 2000-10-31 22:53:42.000000000 +0000
+++ mpd/main.c
@@ -11,7 +11,7 @@ static void dofile PARAMS ((char *filena
static int concrete PARAMS ((Nodeptr e));
static void genmake PARAMS ((Nodeptr e));
static void gmake PARAMS ((Nodeptr e, char *rtype, char *half));
-static void link PARAMS ((char *files[]));
+static void my_link PARAMS ((char *files[]));
@@ -42,6 +42,7 @@ static char *oname; /* output file nam
/* main program */
+int
main (argc, argv)
int argc;
char *argv[];
@@ -101,7 +102,7 @@ char *argv[];
} else {
if (!option_q)
fprintf (stderr, "linking:\n");
- link (argv + optind); /* exec mpdl to build executable file */
+ my_link (argv[optind]); /* exec mpdl to build executable file */
/*NOTREACHED*/
}
}
@@ -348,13 +349,13 @@ char *dir, *fname;
-/* link (files) -- run mpdl to link the components we have compiled
+/* my_link (files) -- run mpdl to link the components we have compiled
*
* "files" is portion of orig argv containing file names (including MPD files).
*/
static void
-link (files)
+my_link (files)
char *files[];
{
char path [MAX_PATH];