From 79a788279b75083b065785793822bcf38aad1a62 Mon Sep 17 00:00:00 2001 From: Hayley Patton Date: Mon, 13 Nov 2023 15:18:49 +1100 Subject: [PATCH 01/47] Add Emscripten/WASM support --- .gitignore | 2 ++ bin/makefile-emscripten.wasm-wasm | 19 +++++++++++++++++++ bin/makeright | 5 +++++ inc/maiko/platform.h | 13 +++++++++++++ src/timer.c | 5 +++++ src/unixfork.c | 5 +++++ src/xc.c | 10 ++++++++++ 7 files changed, 59 insertions(+) create mode 100644 bin/makefile-emscripten.wasm-wasm diff --git a/.gitignore b/.gitignore index 0111213f..306defa9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ cmake-build-*/** *.x86_64-x/** *.x86_64-sdl/** *.x86_64/** +*.wasm/** +*.wasm-wasm/** *.armv7l-x/** *.armv7l/** *.aarch64-x/** diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm new file mode 100644 index 00000000..2007eec6 --- /dev/null +++ b/bin/makefile-emscripten.wasm-wasm @@ -0,0 +1,19 @@ +# Options for Emscripten, WASM and SDL + +CC = emcc -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 -g3 +DFLAGS = $(XFLAGS) -DRELEASE=351 + +LD = emcc +LDFLAGS = -sUSE_SDL=2 --preload-file $(SYSOUT)@full.sysout +LDELDFLAGS = + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl.js diff --git a/bin/makeright b/bin/makeright index 1fde522a..156685c4 100755 --- a/bin/makeright +++ b/bin/makeright @@ -74,6 +74,11 @@ case "$display" in sdl) releasename=${osversion}.${architecture}-${display} ldename=ldesdl ;; + wasm) osversion=emscripten + architecture=wasm + releasename=${osversion}.${architecture}-${display} + ldename=ldesdl.js + ;; *) echo "display-option: $display is not supported." exit ;; diff --git a/inc/maiko/platform.h b/inc/maiko/platform.h index 2fa747e9..a69b21fe 100644 --- a/inc/maiko/platform.h +++ b/inc/maiko/platform.h @@ -83,6 +83,19 @@ # define MAIKO_OS_DETECTED 1 #endif +#ifdef __EMSCRIPTEN__ +# define MAIKO_OS_LINUX 1 +# define MAIKO_OS_EMSCRIPTEN 1 +# define MAIKO_OS_NAME "Emscripten" +# define MAIKO_EMULATE_TIMER_INTERRUPTS 1 +# define MAIKO_EMULATE_ASYNC_INTERRUPTS 1 +# define MAIKO_OS_UNIX_LIKE 1 +# define MAIKO_OS_DETECTED +# define MAIKO_ARCH_NAME "WebAssembly" +# define MAIKO_ARCH_WORD_BITS 32 +# define MAIKO_ARCH_DETECTED 1 +#endif + /* __x86_64__: GNU C, __x86_64: Sun Studio, _M_AMD64: Visual Studio */ #if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64) # define MAIKO_ARCH_X86_64 1 diff --git a/src/timer.c b/src/timer.c index 5d75bb2c..2cb14c2a 100644 --- a/src/timer.c +++ b/src/timer.c @@ -73,6 +73,11 @@ extern int ether_fd; extern DspInterface currentdsp; #endif /* XWINDOW */ +#ifdef MAIKO_OS_EMSCRIPTEN +/* We can't touch the system clock */ +#define settimeofday(tv, tz) +#endif + #define LISP_UNIX_TIME_DIFF 29969152 #define LISP_ALTO_TIME_MASK 0x80000000 #define UNIX_ALTO_TIME_DIFF 2177452800U diff --git a/src/unixfork.c b/src/unixfork.c index 3b9dce1a..b35f1ef6 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -45,6 +45,11 @@ int flushing = 0; #endif +#ifdef MAIKO_OS_EMSCRIPTEN +/* We don't have any shell */ +#define getusershell() NULL +#endif + /* Used to communicate between Unix subprocesses and LISP */ static long StartTime; /* Time, for creating pipe filenames */ diff --git a/src/xc.c b/src/xc.c index 51400420..644e00d9 100644 --- a/src/xc.c +++ b/src/xc.c @@ -33,6 +33,10 @@ #include #endif /* DOS */ +#ifdef __EMSCRIPTEN__ +#include /* Defines emscripten_sleep */ +#endif /* __EMSCRIPTEN__ */ + #include "lispemul.h" #include "emlglob.h" #include "address.h" @@ -183,6 +187,9 @@ static int pseudoTimerAsyncCountdown = MAIKO_TIMER_ASYNC_EMULATION_INSNS_COUNTDO void dispatch(void) { InstPtr pccache; +#ifdef __EMSCRIPTEN__ + int cycles = 0; +#endif #if defined(OPDISP) static const void* optable[256] = { @@ -261,6 +268,9 @@ op_ufn : { /* DISPATCH "LOOP" */ nextopcode: +#ifdef __EMSCRIPTEN__ + if (++cycles % 1000000 == 0) emscripten_sleep(1); +#endif #ifdef MYOPTRACE if ((struct fnhead *)NativeAligned4FromLAddr(0x2ed600) == FuncObj) { quick_stack_check(); From 7b2cf44c7cca62e5faf2efa5b4912da79cee0ffc Mon Sep 17 00:00:00 2001 From: Hayley Patton Date: Mon, 13 Nov 2023 15:30:19 +1100 Subject: [PATCH 02/47] Add ldesdl.html --- .gitignore | 1 + emscripten.wasm/ldesdl.html | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 emscripten.wasm/ldesdl.html diff --git a/.gitignore b/.gitignore index 306defa9..8e0d861a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ cmake-build-*/** *.x86_64-sdl/** *.x86_64/** *.wasm/** +!emscripten.wasm/ldesdl.html *.wasm-wasm/** *.armv7l-x/** *.armv7l/** diff --git a/emscripten.wasm/ldesdl.html b/emscripten.wasm/ldesdl.html new file mode 100644 index 00000000..3ddffcdb --- /dev/null +++ b/emscripten.wasm/ldesdl.html @@ -0,0 +1,20 @@ + + + + + + + + +
+ +
+ + + + From d933ba88b7abaf02a25527ade4960a514832f70a Mon Sep 17 00:00:00 2001 From: Matt Heffron Date: Sat, 16 Dec 2023 15:14:02 -0800 Subject: [PATCH 03/47] XFree(mapping) was called *before* mapping was referenced in DEBUG conditional code. (#486) This is only a potential issue in DEBUG build. A problem hasn't occurred, that I know of, but it seemed best just to be safe. Moved the DEBUG code to precede the XFree(mapping) call. (Equivalent to moving the XFree down.) --- src/initkbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/initkbd.c b/src/initkbd.c index 39612f39..8a455280 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -375,8 +375,6 @@ static u_char *make_X_keymap(void) { table[xcode - 7] = code; } - XFree(mapping); /* No locking required? */ - #ifdef DEBUG printf("\n\n\tXGetKeyboardMapping table\n\n"); for (i = 0; i < codecount * symspercode; i += symspercode) { @@ -394,6 +392,8 @@ static u_char *make_X_keymap(void) { } #endif /* DEBUG */ + XFree(mapping); /* No locking required? */ + return (table); } From b666b1b2deb73abda4e2d46d757e22ec3e1ba89f Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 10:36:13 -0800 Subject: [PATCH 04/47] Add stubs for X11 IOErrorHandler and IOErrorExitHandler (#487) Adds stub procedures and hooks them in to the X11 error handlers as an example of how we may be able to handle lost X connections and gracefully terminate the session. --- src/xinit.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/xinit.c b/src/xinit.c index 9278a2f8..e429d428 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -16,6 +16,7 @@ #include // for sig_atomic_t #include // for false, bool, true #include // for NULL +#include // for exit #include "adr68k.h" // for NativeAligned4FromLAddr #include "dbprint.h" // for TPRINT #include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S... @@ -200,6 +201,27 @@ void Open_Display(DspInterface dsp) init_Xevent(dsp); /* Turn on the event reporting */ } /* end OpenDisplay */ +int X_FatalErrorHandler(Display *display) +{ + /* when the fatal error handler gets called it can do cleanup + * and either exit, or return. If it returns, the + * FatalErrorExitHandler will be called + */ + /* If we could do a SAVEVM in the interrupt context we would mark it + * as needed here. Returning will cause the FatalErrorExitHandler + * hook to be called. + */ + return 0; +} + +void X_FatalErrorExitHandler(Display *display, void *userdata) +{ + /* If we were invoking a SAVEVM/LOGOUT in the interrupt context we + * would not exit here, as the Lisp VM needs to continue to run + */ + exit(1); +} + /*********************************************************************/ /* */ /* X _ i n i t */ @@ -236,6 +258,10 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u /* Try to open the X display. If this isn't possible, we just */ /* return FALSE. */ if ((dsp->display_id = XOpenDisplay(dsp->identifier)) == NULL) return (NULL); + + XSetIOErrorHandler(X_FatalErrorHandler); + XSetIOErrorExitHandler(dsp->display_id, X_FatalErrorExitHandler, NULL); + /* Load the dsp structure */ Xscreen = ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id)); From e82b47a9e73ee31ba3d493b18c4705a7edcf2657 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 13:13:32 -0800 Subject: [PATCH 05/47] Give emcc link-time flags only to the link phase not the compile phase --- bin/makefile-emscripten.wasm-wasm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm index 2007eec6..f092375d 100644 --- a/bin/makefile-emscripten.wasm-wasm +++ b/bin/makefile-emscripten.wasm-wasm @@ -1,6 +1,6 @@ # Options for Emscripten, WASM and SDL -CC = emcc -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH $(CLANG_CFLAGS) +CC = emcc $(CLANG_CFLAGS) XFILES = $(OBJECTDIR)sdl.o @@ -11,9 +11,9 @@ OPTFLAGS = -O2 -g3 DFLAGS = $(XFLAGS) -DRELEASE=351 LD = emcc -LDFLAGS = -sUSE_SDL=2 --preload-file $(SYSOUT)@full.sysout +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH --preload-file $(SYSOUT)@full.sysout LDELDFLAGS = OBJECTDIR = ../$(RELEASENAME)/ -default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl.js +default : ../$(OSARCHNAME)/ldesdl.js From f208fd33028d25220ea43916dccc371ff05fe83a Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 13:18:20 -0800 Subject: [PATCH 06/47] Rename/move ldesdl.html out of emscripten.wasm (which gets cleared on rebuild) to src/lde.html --- emscripten.wasm/ldesdl.html => src/lde.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename emscripten.wasm/ldesdl.html => src/lde.html (100%) diff --git a/emscripten.wasm/ldesdl.html b/src/lde.html similarity index 100% rename from emscripten.wasm/ldesdl.html rename to src/lde.html From bee6a2f33eb98fd625a68b7bc47442f92327ae49 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 13:27:05 -0800 Subject: [PATCH 07/47] amend! Give emcc link-time flags only to the link phase not the compile phase Give emcc link-time flags only to the link phase not the compile phase Remove target "lde" which is not used in the emscripten configuration. From 0cc8e4d71c51663590537d92466b5b1c0d9b0f81 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 13:35:33 -0800 Subject: [PATCH 08/47] Revert/update unixfork.c since it is no longer used in emscripten based builds --- src/unixfork.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/unixfork.c b/src/unixfork.c index b35f1ef6..366495fc 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -45,11 +45,6 @@ int flushing = 0; #endif -#ifdef MAIKO_OS_EMSCRIPTEN -/* We don't have any shell */ -#define getusershell() NULL -#endif - /* Used to communicate between Unix subprocesses and LISP */ static long StartTime; /* Time, for creating pipe filenames */ @@ -103,7 +98,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar if (SlaveFD == -1) { perror("Slave Open"); perror(PtySlave); - exit(0); + exit(1); } #ifdef OS5 @@ -137,7 +132,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar for (userShell = getusershell(); userShell != NULL && strcmp(shell, userShell) != 0; userShell = getusershell()); if (userShell == NULL) { perror("$(SHELL) not found in /etc/shells"); - exit(0); + exit(1); } /* argvec entries initialized to NULL */ @@ -151,7 +146,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar /* Should never get here */ perror("execv"); - exit(0); + exit(1); } /* fork_Unix is the secondary process spawned right after LISP is @@ -269,12 +264,14 @@ int fork_Unix(void) { while (1) { ssize_t len; len = SAFEREAD(LispPipeIn, IOBuf, 6); + if (len == 0) + exit(0); if (len < 0) { perror("Error reading packet by slave"); - exit(0); + exit(1); } else if (len != 6) { DBPRINT(("Input packet wrong length: %zd", len)); - exit(0); + exit(1); } slot = IOBuf[3]; IOBuf[3] = 1; /* Start by signalling success in return-code */ @@ -350,7 +347,7 @@ int fork_Unix(void) { sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { perror("slave socket"); - exit(0); + exit(1); } sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot); memset(&addr, 0, sizeof(struct sockaddr_un)); @@ -362,7 +359,7 @@ int fork_Unix(void) { perror("slave connect"); printf("Name = %s.\n", PipeName); fflush(stdout); - exit(0); + exit(1); } else { DBPRINT(("Slave connected on %s.\n", PipeName)); } From b21fbcbcb1ad5907675b59cf1001c5a9f4f3928f Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 18:15:18 -0800 Subject: [PATCH 09/47] subr_settime should avoid settimeofday() completely in Emscripten environment --- src/timer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/timer.c b/src/timer.c index 2cb14c2a..08a58740 100644 --- a/src/timer.c +++ b/src/timer.c @@ -73,11 +73,6 @@ extern int ether_fd; extern DspInterface currentdsp; #endif /* XWINDOW */ -#ifdef MAIKO_OS_EMSCRIPTEN -/* We can't touch the system clock */ -#define settimeofday(tv, tz) -#endif - #define LISP_UNIX_TIME_DIFF 29969152 #define LISP_ALTO_TIME_MASK 0x80000000 #define UNIX_ALTO_TIME_DIFF 2177452800U @@ -293,6 +288,8 @@ void subr_settime(LispPTR args[]) dosday.year = uxtime.tm_year; dosday.dayofweek = uxtime.tm_wday; _dos_setdate(&dosday); +#elif defined(MAIKO_OS_EMSCRIPTEN) + (void)args[0]; #else struct timeval timev; timev.tv_sec = *((int *)NativeAligned4FromLAddr(args[0])) - UNIX_ALTO_TIME_DIFF; From 4b0032e1b60ac191d23beb072ac7c5fdea31d826 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 18:17:02 -0800 Subject: [PATCH 10/47] Piggyback on existing async timer emulation instruction countdown for periodic emscripten_sleep() call. There is no need for an additional Emscripten-specific counter to periodically call emscripten_sleep(). Make test for Emscripten environment check MAIKO_OS_EMSCRIPTEN rather than checking __EMSCRIPTEN__, which is localized in the maiko/platform.h include. --- src/xc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/xc.c b/src/xc.c index 644e00d9..907b16b2 100644 --- a/src/xc.c +++ b/src/xc.c @@ -20,6 +20,9 @@ /* */ /************************************************************************/ +#ifdef MAIKO_OS_EMSCRIPTEN +#include +#endif #include #include #include @@ -33,10 +36,6 @@ #include #endif /* DOS */ -#ifdef __EMSCRIPTEN__ -#include /* Defines emscripten_sleep */ -#endif /* __EMSCRIPTEN__ */ - #include "lispemul.h" #include "emlglob.h" #include "address.h" @@ -187,9 +186,6 @@ static int pseudoTimerAsyncCountdown = MAIKO_TIMER_ASYNC_EMULATION_INSNS_COUNTDO void dispatch(void) { InstPtr pccache; -#ifdef __EMSCRIPTEN__ - int cycles = 0; -#endif #if defined(OPDISP) static const void* optable[256] = { @@ -268,9 +264,6 @@ op_ufn : { /* DISPATCH "LOOP" */ nextopcode: -#ifdef __EMSCRIPTEN__ - if (++cycles % 1000000 == 0) emscripten_sleep(1); -#endif #ifdef MYOPTRACE if ((struct fnhead *)NativeAligned4FromLAddr(0x2ed600) == FuncObj) { quick_stack_check(); @@ -296,6 +289,9 @@ op_ufn : { Irq_Stk_End = 0; #if defined(MAIKO_EMULATE_ASYNC_INTERRUPTS) IO_Signalled = TRUE; +#endif +#ifdef MAIKO_OS_EMSCRIPTEN + emscripten_sleep(1); #endif pseudoTimerAsyncCountdown = insnsCountdownForTimerAsyncEmulation; } From 7c1d2081c850101d41c61b1174e0296c3554e036 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 22 Dec 2023 19:21:59 -0800 Subject: [PATCH 11/47] Ignore all wasm generated directories, lde[sdl].html has moved to src directory --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8e0d861a..306defa9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ cmake-build-*/** *.x86_64-sdl/** *.x86_64/** *.wasm/** -!emscripten.wasm/ldesdl.html *.wasm-wasm/** *.armv7l-x/** *.armv7l/** From 7bb23936375de78eba7c9d37494bfe6787cde691 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 27 Dec 2023 17:20:11 -0800 Subject: [PATCH 12/47] Adjustments to WAsm file system layout and compilation options Moves the full.sysout from the root of tle system to /medley/loadups/full.sysout, adds /medley/lispusers/BACKGROUND-YIELD.LCOM and an Emscripten/WAsm specific site init file at /usr/local/lde/site-init.lisp Adjusts options so that the options are in the correct place for the compiler and loader. --- bin/makefile-emscripten.wasm-wasm | 12 +++++++++--- src/lde.html | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm index f092375d..64b631a5 100644 --- a/bin/makefile-emscripten.wasm-wasm +++ b/bin/makefile-emscripten.wasm-wasm @@ -4,14 +4,20 @@ CC = emcc $(CLANG_CFLAGS) XFILES = $(OBJECTDIR)sdl.o -XFLAGS = -DSDL +XFLAGS = -DSDL -sUSE_SDL=2 # OPTFLAGS is normally -O2. -OPTFLAGS = -O2 -g3 +OPTFLAGS = -O2 DFLAGS = $(XFLAGS) -DRELEASE=351 +MEDLEY?=../../medley +SYSOUT?=$(MEDLEY)/loadups/full.sysout + LD = emcc -LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH --preload-file $(SYSOUT)@full.sysout +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH \ + --preload-file $(SYSOUT)@medley/loadups/full.sysout \ + --preload-file $(MEDLEY)/greetfiles/EMSCRIPTEN-INIT.LCOM@usr/local/lde/site-init.lisp \ + --preload-file $(MEDLEY)/lispusers/BACKGROUND-YIELD.LCOM@medley/lispusers/BACKGROUND-YIELD.LCOM LDELDFLAGS = OBJECTDIR = ../$(RELEASENAME)/ diff --git a/src/lde.html b/src/lde.html index 3ddffcdb..3c7f8ccf 100644 --- a/src/lde.html +++ b/src/lde.html @@ -11,7 +11,7 @@ From 29fdf4c40be7c84acfd4f235358313daa849a06a Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 1 Jan 2024 16:58:23 -0800 Subject: [PATCH 13/47] Adapt to window geometry, set up a fake environment variable MEDLEYDIR Passes the window width/height as the requested geometry to lde at startup. Since we control the directory structure of the file-system, we can pass the known fixed location of the Medley directories in the MEDLEYDIR environment variable. Sets up the NetHub host as localhost - not currenty functional, but a WebSocket server could be added to communicate with the NetHub gateway to enable local networking from the browser version of Medley. --- src/lde.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lde.html b/src/lde.html index 3c7f8ccf..d429eb41 100644 --- a/src/lde.html +++ b/src/lde.html @@ -1,5 +1,6 @@ + @@ -10,8 +11,11 @@ From e93e3c895e968f21ff1e5a815f652fe37c52cd77 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 1 Jan 2024 17:30:01 -0800 Subject: [PATCH 14/47] Update preloaded directories, allow Emscripten runtime to exit, set MAIKO_ENABLE_NETHUB Compiling with -DMAIKO_ENABLE_NETHUB makes it possible to test out having a WebSocket server that could pass packets back and forth to the Dodo NetHub. Setting Emscripten link-time option for EXIT_RUNTIME allows the runtime code to shutdown when you exit Medley via a (LOGOUT) Set up preloads for all the parts of the Medley directory that MEDLEYDIR-INIT expects to be there. The resulting ldesdl.data is (at this time) 128 MB. It can be installed gzipped if using nginx or some other web server that supports pre-zipped static files. It would be better to have these as lazy-loading files, but the setup for that is complicated. Another alternative to embedding all the data would be if a WebSocket to XNS/Nethub gateway were written and deployed. --- bin/makefile-emscripten.wasm-wasm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm index 64b631a5..8d884231 100644 --- a/bin/makefile-emscripten.wasm-wasm +++ b/bin/makefile-emscripten.wasm-wasm @@ -8,16 +8,25 @@ XFLAGS = -DSDL -sUSE_SDL=2 # OPTFLAGS is normally -O2. OPTFLAGS = -O2 -DFLAGS = $(XFLAGS) -DRELEASE=351 +DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB MEDLEY?=../../medley SYSOUT?=$(MEDLEY)/loadups/full.sysout LD = emcc -LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH \ +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 \ --preload-file $(SYSOUT)@medley/loadups/full.sysout \ - --preload-file $(MEDLEY)/greetfiles/EMSCRIPTEN-INIT.LCOM@usr/local/lde/site-init.lisp \ - --preload-file $(MEDLEY)/lispusers/BACKGROUND-YIELD.LCOM@medley/lispusers/BACKGROUND-YIELD.LCOM + --preload-file $(MEDLEY)/loadups/whereis.hash@medley/loadups/whereis.hash \ + --preload-file $(MEDLEY)/greetfiles/MEDLEYDIR-INIT.LCOM@usr/local/lde/site-init.lisp \ + --preload-file $(MEDLEY)/docs/@medley/docs \ + --preload-file $(MEDLEY)/doctools/@medley/doctools \ + --preload-file $(MEDLEY)/greetfiles/@medley/greetfiles \ + --preload-file $(MEDLEY)/internal/@medley/internal \ + --preload-file $(MEDLEY)/sources/@medley/sources \ + --preload-file $(MEDLEY)/library/@medley/library \ + --preload-file $(MEDLEY)/lispusers/@medley/lispusers \ + --preload-file $(MEDLEY)/fonts/@medley/fonts + LDELDFLAGS = OBJECTDIR = ../$(RELEASENAME)/ From 8c54c0fbe0bfa39ea69994ceb633e7e8f7d22cde Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 12:55:49 -0800 Subject: [PATCH 15/47] First pass at workflow to build maiko for emscripten --- .github/workflows/buildRelease.yml | 316 ++---------------------- .gitignore | 2 + bin/makefile-emscripten.wasm_nl-wasm_nl | 23 ++ bin/makeright | 5 + 4 files changed, 54 insertions(+), 292 deletions(-) create mode 100644 bin/makefile-emscripten.wasm_nl-wasm_nl diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 333bc596..ec1a3504 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -107,7 +107,7 @@ jobs: echo "linux=true" >> $GITHUB_OUTPUT; echo "macos=true" >> $GITHUB_OUTPUT; echo "windows=true" >> $GITHUB_OUTPUT; - + ###################################################################################### @@ -137,12 +137,12 @@ jobs: with: tag: "release_docker" + ###################################################################################### - # Linux: build and push multi-platform docker image for Linux - # Use docker images to create and push release assets to github + # Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser) - linux: + emscripten: needs: [inputs, sentry] if: | @@ -155,6 +155,7 @@ jobs: runs-on: ubuntu-latest steps: + # Checkout the actions for this repo owner - name: Checkout Actions uses: actions/checkout@v3 @@ -163,316 +164,47 @@ jobs: path: ./Actions_${{ github.sha }} - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} - # Checkout the branch - - name: Checkout - uses: actions/checkout@v3 - - # Setup release tag - - name: Setup Release Tag - id: tag - uses: ./../actions/release-tag-action + # Install SDL2 + - name: Install SDL2 + run: DEBIAN_FRONTEND=noninteractive apt-get install -y libsdl2-dev libsdl2-2.0-0 - # Setup docker environment variables - - name: Setup Docker Environment Variables - id: docker_env - run: | - DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV} - DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }} - DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}" - echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT - echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT - - # Setup the Docker Machine Emulation environment. - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: linux/amd64,linux/arm64,linux/arm/v7 - - # Setup the Docker Buildx funtion - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - # Do the Docker Build using the Dockerfile in the repository we - # checked out. Save the results in a directory under /tmp to be used - # for creating release tars. Does not creatre a docker image and does not - # push anything to Docker Hub. - # - # NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE - # DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE - # Dockerfile, NOT HERE IN THE WORKFLOW. - # - - name: Build Docker Image and Save It Locally - uses: docker/build-push-action@v4 - with: - builder: ${{ steps.buildx.outputs.name }} - build-args: | - BUILD_DATE=${{ steps.docker_env.outputs.build_time }} - RELEASE_TAG=${{ steps.tag.outputs.release_tag }} - context: . - file: ./.github/workflows/Dockerfile_maiko - platforms: linux/amd64,linux/arm64,linux/arm/v7 - # Put the results out to the local file system - outputs: type=local,dest=/tmp/docker_images - tags: ${{ steps.docker_env.outputs.docker_tags }} - - # Use docker results to create releases for github. - # Docker results are in /tmp/docker_images. One subdir for each platform. - - name: Make release tars for each platform - env: - RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} + # Install Emscripten SDK + - name: Install Empscripten run: | - mkdir -p /tmp/release_tars - for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \ - do \ - pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \ - /usr/bin/tar -c -z \ - -f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \ - maiko/bin/osversion \ - maiko/bin/machinetype \ - maiko/bin/config.guess \ - maiko/bin/config.sub \ - maiko/${OSARCH%%:*}/lde* \ - ; \ - popd >/dev/null ; \ - done - - # Push Release to github - - name: Push the release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz - tag: ${{ steps.tag.outputs.release_tag }} - draft: ${{ needs.inputs.outputs.draft }} - token: ${{ secrets.GITHUB_TOKEN }} + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\" >> ~/.bash_profile + echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile -###################################################################################### - - # MacOS: build for MacOS (x86_64, aarch64, universal) and use results to - # create and push release assets to github - macos: - - needs: [inputs, sentry] - if: | - needs.inputs.outputs.macos == 'true' - && ( - needs.sentry.outputs.release_not_built == 'true' - || needs.inputs.outputs.force == 'true' - ) - - runs-on: macos-latest - - steps: - - # Checkout the branch + # Checkout the maiko branch - name: Checkout uses: actions/checkout@v3 - # Checkout the actions for this repo owner - - name: Checkout Actions - uses: actions/checkout@v3 - with: - repository: ${{ github.repository_owner }}/.github - path: ./Actions_${{ github.sha }} - - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} - # Setup release tag - name: Setup Release Tag id: tag uses: ./../actions/release-tag-action - # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies - - name: Unistall X components already on the runner - run: | - brew uninstall --ignore-dependencies libxft - brew uninstall --ignore-dependencies libxrender - brew uninstall --ignore-dependencies libxext - brew uninstall --ignore-dependencies libx11 - brew uninstall --ignore-dependencies xorgproto - brew uninstall --ignore-dependencies libxdmcp - brew uninstall --ignore-dependencies libxau - - - name: Install X11 dependencies on MacOS - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release download XQuartz-2.8.5 --repo XQuartz/XQuartz --pattern XQuartz-2.8.5.pkg - sudo installer -pkg ./XQuartz-2.8.5.pkg -target / - - # Install SDL dependencies - - name: Install SDL2 dependencies on MacOS - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.dmg - hdiutil attach SDL2-2.26.5.dmg - sudo ditto /Volumes/SDL2/SDL2.framework /Library/Frameworks/SDL2.framework - hdiutil detach /Volumes/SDL2/ - - # Build maiko - - name: Build ldeinit + # Compile maiko using Emscripten (no load build) + - name: Compile Maiko using Emscripten working-directory: ./bin run: | - export LDEARCH=x86_64-apple-darwin - ./makeright init - export LDEARCH=aarch64-apple-darwin - ./makeright init - mkdir -p ../darwin.universal - exe=ldeinit - lipo -create \ - -arch arm64 ../darwin.aarch64/${exe} \ - -arch x86_64 ../darwin.x86_64/${exe} \ - -output ../darwin.universal/${exe} - - - name: Build lde, ldex, & ldesdl - run: | - mkdir build - cd build - # -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 - cmake .. \ - -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ - -DMAIKO_DISPLAY_SDL=ON \ - -DMAIKO_DISPLAY_X11=ON \ - -DCMAKE_BUILD_TYPE=Release - cmake --build . --config Release - for exe in lde ldex ldesdl - do - lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64 - lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64 - cp -p ${exe} ../darwin.universal/${exe} - done - - # Create release tar for github. - - name: Make release tar(s) - env: - RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} - run: | - mkdir -p /tmp/release_tars - cd ${GITHUB_WORKSPACE}/../ - for arch in x86_64 aarch64 universal - do - tar -c -z \ - -f /tmp/release_tars/${RELEASE_TAG}-darwin.${arch}.tgz \ - maiko/bin/osversion \ - maiko/bin/machinetype \ - maiko/bin/config.guess \ - maiko/bin/config.sub \ - maiko/darwin.${arch}/lde* - done - - # Push Release - - name: Push the release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.aarch64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.universal.tgz - tag: ${{ steps.tag.outputs.release_tag }} - draft: ${{ needs.inputs.outputs.draft }} - token: ${{ secrets.GITHUB_TOKEN }} - -###################################################################################### - - # Windows: build for Windows-Cygwin via Docker build and use results to - # create and push release assets to github - - windows: - - needs: [inputs, sentry] - if: | - needs.inputs.outputs.windows == 'true' - && ( - needs.sentry.outputs.release_not_built == 'true' - || needs.inputs.outputs.force == 'true' - ) - - runs-on: windows-2022 - - defaults: - run: - shell: powershell + ./makeright wasm_nl + tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * - steps: - - # setup git to not mess up line endings - - name: git config - run: git config --global core.autocrlf input - - # Retrieve Cygwin setup and install cygwin - - name: Install cygwin - id: cygwin - run: | - wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe - Unblock-File setup-x86_64.exe - Start-Process setup-x86_64.exe -Wait -ArgumentList @("--root", ".\cygwin", "--quiet-mode", "--no-admin", "--wait", "--no-shortcuts", "--no-write-registry", "--verbose", "--site", "http://www.gtlib.gatech.edu/pub/cygwin/", "--packages", "nano,binutils,make,cmake,gcc,clang") - cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab' - - # Retrieve SDL2 and install in cygwin - - name: Install SDL2 - id: sdl2 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz - cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz' - - # Checkout the branch - - name: Checkout - uses: actions/checkout@v3 - with: - path: cygwin\maiko - - # Checkout the actions for this repo owner - - name: Checkout Actions - uses: actions/checkout@v3 - with: - repository: ${{ github.repository_owner }}/.github - path: ./Actions_${{ github.sha }} - - run: | - mv ./Actions_${{ github.sha }}/actions ../actions - rm -recurse -force ./Actions_${{ github.sha }} - - # Setup release tag - - name: Setup Release Tag - id: tag - uses: ./../actions/release-tag-action - with: - path: cygwin/maiko - - # Build maiko TODO-cleanup - - name: Build Cygwin-SDL Maiko - run: | - cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl' - cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64' - cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin' - cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin' - cygwin\bin\bash -login -c 'cp /maiko/cygwin.x86_64/* /tmp/maiko/cygwin.x86_64; cp /usr/local/bin/SDL2.DLL /tmp/maiko/cygwin.x86_64' - cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*' - cygwin\bin\bash -login -c 'echo lde > /tmp/maiko/cygwin.x86_64/lde.exe.local; echo ldesdl > /tmp/maiko/cygwin.x86_64/ldesdl.exe.local' - cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars' - cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko' - - # Push Release to github + # Push Release to github - name: Push the release uses: ncipollo/release-action@v1 with: allowUpdates: true - artifacts: - cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz + artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz tag: ${{ steps.tag.outputs.release_tag }} draft: ${{ needs.inputs.outputs.draft }} token: ${{ secrets.GITHUB_TOKEN }} - - ###################################################################################### # Use set-sentry-action to determine set the sentry that says this release has @@ -485,7 +217,7 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, linux, macos, windows] + needs: [inputs, sentry, emscripten] steps: # Checkout the actions for this repo owner diff --git a/.gitignore b/.gitignore index 306defa9..dd4fecfd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ cmake-build-*/** *.x86_64/** *.wasm/** *.wasm-wasm/** +*.wasm_nl/** +*.wasm_nl-wasm_nl/** *.armv7l-x/** *.armv7l/** *.aarch64-x/** diff --git a/bin/makefile-emscripten.wasm_nl-wasm_nl b/bin/makefile-emscripten.wasm_nl-wasm_nl new file mode 100644 index 00000000..1bb48f4f --- /dev/null +++ b/bin/makefile-emscripten.wasm_nl-wasm_nl @@ -0,0 +1,23 @@ +# Options for Emscripten, WASM and SDL + +CC = emcc $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL -sUSE_SDL=2 + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 +DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB + +MEDLEY?=../../medley +SYSOUT?=$(MEDLEY)/loadups/full.sysout + +LD = emcc +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM + +LDELDFLAGS = + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/ldesdl.js diff --git a/bin/makeright b/bin/makeright index 156685c4..25f21f18 100755 --- a/bin/makeright +++ b/bin/makeright @@ -79,6 +79,11 @@ case "$display" in releasename=${osversion}.${architecture}-${display} ldename=ldesdl.js ;; + wasm_nl) osversion=emscripten + architecture=wasm_nl + releasename=${osversion}.${architecture}-${display} + ldename=ldesdl.js + ;; *) echo "display-option: $display is not supported." exit ;; From 696ac9a675f41b698f5a5a6590c58a3dafa733b3 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:08:39 -0800 Subject: [PATCH 16/47] Fix install of SDL2 --- .github/workflows/buildRelease.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index ec1a3504..bb553726 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -166,7 +166,9 @@ jobs: # Install SDL2 - name: Install SDL2 - run: DEBIAN_FRONTEND=noninteractive apt-get install -y libsdl2-dev libsdl2-2.0-0 + run: | + export DEBIAN_FRONTEND=noninteractive + sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0 # Install Emscripten SDK - name: Install Empscripten From 75c815f5851cbbaa72a8667c9524d6d62a23354b Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:13:04 -0800 Subject: [PATCH 17/47] Fix typo in emscripten install --- .github/workflows/buildRelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index bb553726..49f93e35 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,7 +177,7 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\" >> ~/.bash_profile + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bash_profile echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile From e657b2e1dc15a0537c31b0f51a9d2e655861075f Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:21:01 -0800 Subject: [PATCH 18/47] Debugging emscriten build --- .github/workflows/buildRelease.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 49f93e35..ff1196f6 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -194,6 +194,8 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | + echo $(pwd) + ls ../src ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From 400f3b7835994ef08269640e994f50d435d13981 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 16:49:26 -0800 Subject: [PATCH 19/47] Fix emscripten install PATH updates --- .github/workflows/buildRelease.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index ff1196f6..5967294c 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,8 +177,8 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bash_profile - echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bashrc + echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bashrc # Checkout the maiko branch From 640f69877f46e0776797867659fa8a7e7394b831 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 16:57:04 -0800 Subject: [PATCH 20/47] More on fixing emscripten install PATH updates --- .github/workflows/buildRelease.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 5967294c..20cd1a24 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,9 +177,6 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bashrc - echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bashrc - # Checkout the maiko branch - name: Checkout @@ -194,8 +191,10 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | - echo $(pwd) - ls ../src + echo "${GITHUB_WORKSPACE}" + ls "${GITHUB_WORKSPACE}" + source "${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh" + export PATH="${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:${PATH}" ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From efd200dbf70a8711467a7bfd673af155b868caa1 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:02:21 -0800 Subject: [PATCH 21/47] Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 20cd1a24..22015b3b 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -173,8 +173,10 @@ jobs: # Install Emscripten SDK - name: Install Empscripten run: | + echo "$(pwd)" git clone https://github.com/emscripten-core/emsdk.git cd emsdk + ls ./emsdk install latest ./emsdk activate latest From b841a44427263aecb2667a3111d1f6cbca431f1c Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:10:01 -0800 Subject: [PATCH 22/47] 2 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 22015b3b..699bff01 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -172,13 +172,14 @@ jobs: # Install Emscripten SDK - name: Install Empscripten + working-directory: ../ run: | - echo "$(pwd)" git clone https://github.com/emscripten-core/emsdk.git cd emsdk - ls ./emsdk install latest ./emsdk activate latest + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> $HOME/.bashrc + echo "export PATH=\"${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc # Checkout the maiko branch - name: Checkout @@ -193,10 +194,6 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | - echo "${GITHUB_WORKSPACE}" - ls "${GITHUB_WORKSPACE}" - source "${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh" - export PATH="${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:${PATH}" ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From 587ce1983a7fdec8ae271381c320b7bdb965ebec Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:14:16 -0800 Subject: [PATCH 23/47] 3 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 699bff01..3d4fd083 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -178,8 +178,9 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> $HOME/.bashrc - echo "export PATH=\"${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc + CWD="$(pwd)" + echo "source \"${CWD}/emsdk_env.sh\"" >> $HOME/.bashrc + echo "export PATH=\"${CWD}/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc # Checkout the maiko branch - name: Checkout From ebe4babbe1e85e4953bd22c2e615d818612e44fb Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:23:40 -0800 Subject: [PATCH 24/47] 4 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 3d4fd083..abcb478d 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -179,8 +179,9 @@ jobs: ./emsdk install latest ./emsdk activate latest CWD="$(pwd)" - echo "source \"${CWD}/emsdk_env.sh\"" >> $HOME/.bashrc - echo "export PATH=\"${CWD}/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc + source "${CWD}/emsdk_env.sh" + export PATH="${CWD}/upstream/emscripten/tools:\${PATH}" + echo "PATH=${PATH}" >> ${GITHUB_ENV} # Checkout the maiko branch - name: Checkout From 3d341e3bbde6c7ce462d67457642f30ac1ed3768 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:53:53 -0800 Subject: [PATCH 25/47] 5 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index abcb478d..502c5464 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -179,9 +179,10 @@ jobs: ./emsdk install latest ./emsdk activate latest CWD="$(pwd)" - source "${CWD}/emsdk_env.sh" - export PATH="${CWD}/upstream/emscripten/tools:\${PATH}" - echo "PATH=${PATH}" >> ${GITHUB_ENV} + echo "${CWD}" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten/tools" >> ${GITHUB_PATH} + echo "${CWD}/node/$(ls -d node/*64bit | tail -1)/bin" >> ${GITHUB_PATH} # Checkout the maiko branch - name: Checkout From df6dd883a630c44f5fc4959aeac9ad250c777d4c Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:01:36 -0800 Subject: [PATCH 26/47] fix tar of emscripten files --- .github/workflows/buildRelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 502c5464..1655b0f5 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -198,7 +198,7 @@ jobs: working-directory: ./bin run: | ./makeright wasm_nl - tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * + tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz . # Push Release to github - name: Push the release From 52a3512379efe620699bef1b0a8b88cb265ac469 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:09:39 -0800 Subject: [PATCH 27/47] additional fix to tar of emscripten files --- .github/workflows/buildRelease.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 1655b0f5..7bdc64b2 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -198,7 +198,8 @@ jobs: working-directory: ./bin run: | ./makeright wasm_nl - tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz . + cd ../emscripten.wasm_nl + tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * # Push Release to github - name: Push the release From 3ae25f81f86b0aef088a93e71a31144ee1095559 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:29:22 -0800 Subject: [PATCH 28/47] update actions to later versions to account for githiubs move from node16 to node20 --- .github/workflows/buildRelease.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 7bdc64b2..3e9680d0 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -123,7 +123,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -158,7 +158,7 @@ jobs: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -186,7 +186,7 @@ jobs: # Checkout the maiko branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup release tag - name: Setup Release Tag @@ -228,7 +228,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} From 0b0c82ce181b611c934a99735820aa4f69633d1b Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:37:47 -0800 Subject: [PATCH 29/47] Returning buildRelease to full builds --- .github/workflows/buildRelease.yml | 338 ++++++++++++++++++++++++++++- 1 file changed, 337 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 3e9680d0..e57c3adf 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -137,6 +137,341 @@ jobs: with: tag: "release_docker" +###################################################################################### + + # Linux: build and push multi-platform docker image for Linux + # Use docker images to create and push release assets to github + + linux: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.linux == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: ubuntu-latest + + steps: + # Checkout the actions for this repo owner + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/.github + path: ./Actions_${{ github.sha }} + - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Setup docker environment variables + - name: Setup Docker Environment Variables + id: docker_env + run: | + DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV} + DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }} + DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}" + echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT + + # Setup the Docker Machine Emulation environment. + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + # Setup the Docker Buildx funtion + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + # Do the Docker Build using the Dockerfile in the repository we + # checked out. Save the results in a directory under /tmp to be used + # for creating release tars. Does not creatre a docker image and does not + # push anything to Docker Hub. + # + # NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE + # DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE + # Dockerfile, NOT HERE IN THE WORKFLOW. + # + - name: Build Docker Image and Save It Locally + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + build-args: | + BUILD_DATE=${{ steps.docker_env.outputs.build_time }} + RELEASE_TAG=${{ steps.tag.outputs.release_tag }} + context: . + file: ./.github/workflows/Dockerfile_maiko + platforms: linux/amd64,linux/arm64,linux/arm/v7 + # Put the results out to the local file system + outputs: type=local,dest=/tmp/docker_images + tags: ${{ steps.docker_env.outputs.docker_tags }} + + # Use docker results to create releases for github. + # Docker results are in /tmp/docker_images. One subdir for each platform. + - name: Make release tars for each platform + env: + RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} + run: | + mkdir -p /tmp/release_tars + for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \ + do \ + pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \ + /usr/bin/tar -c -z \ + -f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \ + maiko/bin/osversion \ + maiko/bin/machinetype \ + maiko/bin/config.guess \ + maiko/bin/config.sub \ + maiko/${OSARCH%%:*}/lde* \ + ; \ + popd >/dev/null ; \ + done + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + +###################################################################################### + + # MacOS: build for MacOS (x86_64, aarch64, universal) and use results to + # create and push release assets to github + macos: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.macos == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: macos-latest + + steps: + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + + # Checkout the actions for this repo owner + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/.github + path: ./Actions_${{ github.sha }} + - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies + - name: Unistall X components already on the runner + run: | + brew uninstall --ignore-dependencies libxft + brew uninstall --ignore-dependencies libxrender + brew uninstall --ignore-dependencies libxext + brew uninstall --ignore-dependencies libx11 + brew uninstall --ignore-dependencies xorgproto + brew uninstall --ignore-dependencies libxdmcp + brew uninstall --ignore-dependencies libxau + + - name: Install X11 dependencies on MacOS + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download XQuartz-2.8.5 --repo XQuartz/XQuartz --pattern XQuartz-2.8.5.pkg + sudo installer -pkg ./XQuartz-2.8.5.pkg -target / + + # Install SDL dependencies + - name: Install SDL2 dependencies on MacOS + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.dmg + hdiutil attach SDL2-2.26.5.dmg + sudo ditto /Volumes/SDL2/SDL2.framework /Library/Frameworks/SDL2.framework + hdiutil detach /Volumes/SDL2/ + + # Build maiko + - name: Build ldeinit + working-directory: ./bin + run: | + export LDEARCH=x86_64-apple-darwin + ./makeright init + export LDEARCH=aarch64-apple-darwin + ./makeright init + mkdir -p ../darwin.universal + exe=ldeinit + lipo -create \ + -arch arm64 ../darwin.aarch64/${exe} \ + -arch x86_64 ../darwin.x86_64/${exe} \ + -output ../darwin.universal/${exe} + + - name: Build lde, ldex, & ldesdl + run: | + mkdir build + cd build + # -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 + cmake .. \ + -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ + -DMAIKO_DISPLAY_SDL=ON \ + -DMAIKO_DISPLAY_X11=ON \ + -DCMAKE_BUILD_TYPE=Release + cmake --build . --config Release + for exe in lde ldex ldesdl + do + lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64 + lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64 + cp -p ${exe} ../darwin.universal/${exe} + done + + # Create release tar for github. + - name: Make release tar(s) + env: + RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} + run: | + mkdir -p /tmp/release_tars + cd ${GITHUB_WORKSPACE}/../ + for arch in x86_64 aarch64 universal + do + tar -c -z \ + -f /tmp/release_tars/${RELEASE_TAG}-darwin.${arch}.tgz \ + maiko/bin/osversion \ + maiko/bin/machinetype \ + maiko/bin/config.guess \ + maiko/bin/config.sub \ + maiko/darwin.${arch}/lde* + done + + # Push Release + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.aarch64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.universal.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + +###################################################################################### + + # Windows: build for Windows-Cygwin via Docker build and use results to + # create and push release assets to github + + windows: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.windows == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: windows-2022 + + defaults: + run: + shell: powershell + + steps: + + # setup git to not mess up line endings + - name: git config + run: git config --global core.autocrlf input + + # Retrieve Cygwin setup and install cygwin + - name: Install cygwin + id: cygwin + run: | + wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe + Unblock-File setup-x86_64.exe + Start-Process setup-x86_64.exe -Wait -ArgumentList @("--root", ".\cygwin", "--quiet-mode", "--no-admin", "--wait", "--no-shortcuts", "--no-write-registry", "--verbose", "--site", "http://www.gtlib.gatech.edu/pub/cygwin/", "--packages", "nano,binutils,make,cmake,gcc,clang") + cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab' + + # Retrieve SDL2 and install in cygwin + - name: Install SDL2 + id: sdl2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz + cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz' + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + with: + path: cygwin\maiko + + # Checkout the actions for this repo owner + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/.github + path: ./Actions_${{ github.sha }} + - run: | + mv ./Actions_${{ github.sha }}/actions ../actions + rm -recurse -force ./Actions_${{ github.sha }} + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + with: + path: cygwin/maiko + + # Build maiko TODO-cleanup + - name: Build Cygwin-SDL Maiko + run: | + cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl' + cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64' + cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin' + cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin' + cygwin\bin\bash -login -c 'cp /maiko/cygwin.x86_64/* /tmp/maiko/cygwin.x86_64; cp /usr/local/bin/SDL2.DLL /tmp/maiko/cygwin.x86_64' + cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*' + cygwin\bin\bash -login -c 'echo lde > /tmp/maiko/cygwin.x86_64/lde.exe.local; echo ldesdl > /tmp/maiko/cygwin.x86_64/ldesdl.exe.local' + cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars' + cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko' + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + ###################################################################################### @@ -211,6 +546,7 @@ jobs: draft: ${{ needs.inputs.outputs.draft }} token: ${{ secrets.GITHUB_TOKEN }} + ###################################################################################### # Use set-sentry-action to determine set the sentry that says this release has @@ -223,7 +559,7 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, emscripten] + needs: [inputs, sentry, linux, macos, windows, emscripten] steps: # Checkout the actions for this repo owner From ce7deadad3e85fa958b5f2c9447e505beeef5fa1 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Sat, 10 Feb 2024 00:40:20 -0800 Subject: [PATCH 30/47] Added LZ4 compression to wasm_nl --- bin/makefile-emscripten.wasm_nl-wasm_nl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/makefile-emscripten.wasm_nl-wasm_nl b/bin/makefile-emscripten.wasm_nl-wasm_nl index 1bb48f4f..b9f57364 100644 --- a/bin/makefile-emscripten.wasm_nl-wasm_nl +++ b/bin/makefile-emscripten.wasm_nl-wasm_nl @@ -14,7 +14,7 @@ MEDLEY?=../../medley SYSOUT?=$(MEDLEY)/loadups/full.sysout LD = emcc -LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4 LDELDFLAGS = From 9f02ce05909014043c797ac402bd318c73aac604 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 12 Feb 2024 09:30:46 -0800 Subject: [PATCH 31/47] Emscripten/wasm does not support getrusage() system call Updating the MiscStats data can at best provide the time of day and attribute all elapsed time to total CPU time. Closes issue #1537 --- src/timer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/timer.c b/src/timer.c index 08a58740..ef91303f 100644 --- a/src/timer.c +++ b/src/timer.c @@ -118,6 +118,19 @@ void update_miscstats(void) { MiscStats->diskiotime = 0; /* ?? not available ?? */ MiscStats->diskops = 0; MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF); +#elif defined(MAIKO_OS_EMSCRIPTEN) + /* Emscripten does not provide getrusage() functionality */ + struct timeval timev; + + MiscStats->totaltime = gettime(0) - MiscStats->starttime; + MiscStats->swapwaittime = 0; + MiscStats->pagefaults = 0; + MiscStats->swapwrites = 0; + MiscStats->diskiotime = 0; + MiscStats->diskops = 0; + + gettimeofday(&timev, NULL); + MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF); #else struct timeval timev; struct rusage ru; From 258f70a82bc103be806966e5f0736df56d22ca1a Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Fri, 16 Feb 2024 00:03:39 -0800 Subject: [PATCH 32/47] Fix Issue#1541: IL:LOGOUT does not work running Medley on emscripten maiko --- src/vmemsave.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vmemsave.c b/src/vmemsave.c index 00c371bb..a031b63d 100644 --- a/src/vmemsave.c +++ b/src/vmemsave.c @@ -354,7 +354,7 @@ LispPTR vmem_save(char *sysout_file_name) TIMEOUT(sysout = open(sysout_file_name, O_WRONLY, 0666)); if (sysout == -1) { /* No file error skip return. */ - if (errno != 2) return (FILECANNOTOPEN); /* No such file error.*/ + if (errno != ENOENT) return (FILECANNOTOPEN); /* No such file error.*/ } else TIMEOUT(rval = close(sysout)); @@ -481,7 +481,7 @@ LispPTR vmem_save(char *sysout_file_name) TIMEOUT(rval = unlink(sysout_file_name)); if (rval == -1) { /* No file error skip return. */ - if (errno != 2) /* No such file error.*/ + if (errno != ENOENT) /* No such file error.*/ return (FILECANNOTOPEN); } From 55591557b629fd73d9e81c8e684421bfb52c6f10 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 7 Mar 2024 09:30:59 -0800 Subject: [PATCH 33/47] Clarify the expected size/packing of bit fields in stack structures While packing is not guaranteed, and most compilers will combine adjacent bit fields regardless of the alignment requirements of the datatype that is being divided, here we can be clearer that we expect packing into 16-bit fields and we do not require (and must not have) 32-bit alignment of the collections of bitfields. --- inc/stack.h | 102 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/inc/stack.h b/inc/stack.h index f93be91d..721c15df 100644 --- a/inc/stack.h +++ b/inc/stack.h @@ -79,22 +79,22 @@ typedef struct fnhead { } FNHEAD; typedef struct frameex1 { - unsigned flags : 3; - unsigned fast : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned incall : 1; - unsigned validnametable : 1; + unsigned short flags : 3; + unsigned short fast : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short incall : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned nopush : 1; - unsigned usecount : 8; + unsigned short nopush : 1; + unsigned short usecount : 8; DLword alink; /* alink pointer (Low addr) */ #ifdef BIGVM LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ #else DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ - unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ - unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ + unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ + unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ #endif /* BIGVM */ DLword nextblock; /* pointer to FreeStackBlock */ DLword pc; /* Program counter */ @@ -102,23 +102,23 @@ typedef struct frameex1 { LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */ #else DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */ - unsigned hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */ - unsigned hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */ + unsigned short hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */ + unsigned short hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */ #endif /* BIGVM */ DLword blink; /* blink pointer (Low addr) */ DLword clink; /* clink pointer (Low addr) */ } FX; typedef struct frameex2 { - unsigned flags : 3; - unsigned fast : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned incall : 1; - unsigned validnametable : 1; + unsigned short flags : 3; + unsigned short fast : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short incall : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned nopush : 1; - unsigned usecount : 8; + unsigned short nopush : 1; + unsigned short usecount : 8; DLword alink; /* alink pointer (Low addr) */ LispPTR fnheader; /* pointer to FunctionHeader */ DLword nextblock; /* pointer to FreeStackBlock */ @@ -135,11 +135,11 @@ typedef struct fxblock { } FXBLOCK; typedef struct basic_frame { - unsigned flags : 3; - unsigned nil : 3; - unsigned residual : 1; - unsigned padding : 1; - unsigned usecnt : 8; + unsigned short flags : 3; + unsigned short nil : 3; + unsigned short residual : 1; + unsigned short padding : 1; + unsigned short usecnt : 8; DLword ivar; /* stk offset of IVARs for this frame ?? */ } Bframe; @@ -185,33 +185,33 @@ typedef struct fnhead { unsigned nil3 : 2; /* not used */ unsigned nil2 : 2; /* not used */ #endif /* BIGVM */ - unsigned argtype : 2; /* ?? */ - unsigned byteswapped : 1; /* code was reswapped. */ - unsigned nil4 : 1; /* not used, prev: native translated? */ - unsigned fvaroffset : 8; + unsigned short argtype : 2; /* ?? */ + unsigned short byteswapped : 1; /* code was reswapped. */ + unsigned short nil4 : 1; /* not used, prev: native translated? */ + unsigned short fvaroffset : 8; /* DLword offset from head of NameTable */ - unsigned nlocals : 8; /* ?? */ + unsigned short nlocals : 8; /* ?? */ DLword ntsize; /* size of NameTable */ /* NameTable of variable length is following with this structure. */ } FNHEAD; typedef struct frameex1 { DLword alink; /* alink pointer (Low addr) */ - unsigned usecount : 8; - unsigned nopush : 1; - unsigned validnametable : 1; + unsigned short usecount : 8; + unsigned short nopush : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned incall : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned fast : 1; - unsigned flags : 3; /* hi word */ + unsigned short incall : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short fast : 1; + unsigned short flags : 3; /* hi word */ #ifdef BIGVM LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ #else - unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ - unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ + unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ + unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ #endif /* BIGVM */ @@ -221,8 +221,8 @@ typedef struct frameex1 { #ifdef BIGVM LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */ #else - unsigned hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */ - unsigned hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */ + unsigned short hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */ + unsigned short hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */ DLword lonametable; /* pointer to NameTable of this FX (Low addr) */ #endif /* BIGVM */ @@ -232,15 +232,15 @@ typedef struct frameex1 { typedef struct frameex2 { DLword alink; /* alink pointer (Low addr) */ - unsigned usecount : 8; - unsigned nopush : 1; - unsigned validnametable : 1; + unsigned short usecount : 8; + unsigned short nopush : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned incall : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned fast : 1; - unsigned flags : 3; + unsigned short incall : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short fast : 1; + unsigned short flags : 3; LispPTR fnheader; /* pointer to FunctionHeader (swapped) */ @@ -261,11 +261,11 @@ typedef struct fxblock { typedef struct basic_frame { DLword ivar; - unsigned usecnt : 8; - unsigned padding : 1; - unsigned residual : 1; - unsigned nil : 3; - unsigned flags : 3; + unsigned short usecnt : 8; + unsigned short padding : 1; + unsigned short residual : 1; + unsigned short nil : 3; + unsigned short flags : 3; } Bframe; From 939c23c03bb645efc71b334293fdb714a477c861 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 7 Mar 2024 10:01:19 -0800 Subject: [PATCH 34/47] Additional check for bad stack offset calculation Pointer difference calculations on an inappropriate stack pointer could result in a negative offset, not just an offset that is too large to fit in 16 bits. Complain if either case occurs. --- inc/adr68k.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/adr68k.h b/inc/adr68k.h index 9799780b..42cae9c2 100644 --- a/inc/adr68k.h +++ b/inc/adr68k.h @@ -63,8 +63,8 @@ static inline DLword StackOffsetFromNative(void *SAddr) { /* Stack offsets are expressed as an offset in DLwords from the stack base */ ptrdiff_t hoffset = (DLword *)SAddr - Stackspace; - if (hoffset > 0xffff) { - printf("Stack offset is too large: 0x%tx\n", hoffset); + if (hoffset > 0xffff || hoffset < 0) { + printf("Stack offset is out of range: 0x%tx\n", hoffset); } return (DLword)hoffset; } From 68baf6fb30f8c19c4dd7a15bd9beb6a28d7307c2 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 7 Mar 2024 10:45:38 -0800 Subject: [PATCH 35/47] Use ...FromStackOffset functions where appropriate Rather than adding/or-ing the STK_OFFSET constant into a stack offset to convert it to a pointer in general Lisp memory and then converting from that to a native address... use the functions specifically present to do those conversions with embedded checks on stack offset validity. --- inc/return.h | 4 ++-- src/bbtsub.c | 2 +- src/dbgtool.c | 8 ++++---- src/findkey.c | 2 +- src/loopsops.c | 4 ++-- src/main.c | 4 ++-- src/return.c | 2 +- src/testtool.c | 14 +++++++------- src/ufn.c | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/inc/return.h b/inc/return.h index 90749fb4..e4930321 100644 --- a/inc/return.h +++ b/inc/return.h @@ -37,7 +37,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ @@ -47,7 +47,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ diff --git a/src/bbtsub.c b/src/bbtsub.c index af07f147..e824b09d 100644 --- a/src/bbtsub.c +++ b/src/bbtsub.c @@ -1664,7 +1664,7 @@ void ccfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ /* XXX: is it really only 2-byte aligned? */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/dbgtool.c b/src/dbgtool.c index 70ee8f4b..3f0dad7c 100644 --- a/src/dbgtool.c +++ b/src/dbgtool.c @@ -303,14 +303,14 @@ int sf(struct frameex1 *fx_addr68k) { if (((fx_addr68k)->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr(((fx_addr68k)->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset((fx_addr68k)->blink); } /* Print IVARs */ printf("IVAR -------\n"); BT_morep; - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); i = 0; while (ptr != (DLword *)bf) { ptrlo = ptr + 1; @@ -475,7 +475,7 @@ int sf(struct frameex1 *fx_addr68k) { i++; } if (fx_addr68k->alink == 11) /* for contextsw */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); else next68k = CurrentStackPTR; @@ -493,7 +493,7 @@ int sf(struct frameex1 *fx_addr68k) { return (-1); } - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); ptr = (DLword *)(fx_addr68k + 1); i = 0; diff --git a/src/findkey.c b/src/findkey.c index 88d250a1..f456f36b 100644 --- a/src/findkey.c +++ b/src/findkey.c @@ -45,7 +45,7 @@ LispPTR N_OP_findkey(LispPTR tos, int byte) { #endif if (CURRENTFX->alink & 1) { /* slow case */ - find_end = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | (CURRENTFX->blink - 4)); + find_end = NativeAligned2FromStackOffset(CURRENTFX->blink - 4); } else { /* Fast cae */ find_end = ((DLword *)CURRENTFX) - 2 - 4; } diff --git a/src/loopsops.c b/src/loopsops.c index 3544905f..90e2c1e7 100644 --- a/src/loopsops.c +++ b/src/loopsops.c @@ -26,7 +26,7 @@ #include "gcarraydefs.h" // for get_package_atom #include "gcdata.h" // for FRPLPTR #include "lispemul.h" // for LispPTR, state, CurrentStackPTR, NIL_PTR, NIL -#include "lispmap.h" // for S_POSITIVE, STK_OFFSET +#include "lispmap.h" // for S_POSITIVE #include "loopsopsdefs.h" // for lcfuncall, LCFetchMethod, LCFetchMethodOrHelp #include "lspglob.h" #include "lsptypes.h" // for GetDTD, GetTypeNumber, dtd, Listp, GETWORD @@ -358,7 +358,7 @@ LispPTR lcfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/main.c b/src/main.c index 4d231072..b6e05a8e 100644 --- a/src/main.c +++ b/src/main.c @@ -727,9 +727,9 @@ void start_lisp(void) { TopOfStack = 0; Error_Exit = 0; - PVar = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | InterfacePage->currentfxp) + FRAMESIZE; + PVar = NativeAligned2FromStackOffset(InterfacePage->currentfxp) + FRAMESIZE; - freeptr = next68k = NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + freeptr = next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("Starting Lisp: Next stack block isn't free!"); diff --git a/src/return.c b/src/return.c index 0b8a23be..fe87cf6c 100644 --- a/src/return.c +++ b/src/return.c @@ -129,7 +129,7 @@ void contextsw(DLword fxnum, DLword bytenum, DLword flags) Midpunt(fxnum); /* exchanging FX */ - next68k = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("contextsw(): MP9316"); freeptr = next68k; diff --git a/src/testtool.c b/src/testtool.c index 1f49fd0a..bf6b8a73 100644 --- a/src/testtool.c +++ b/src/testtool.c @@ -57,7 +57,7 @@ #include "gcarraydefs.h" // for aref1 #include "kprintdefs.h" // for print, prindatum #include "lispemul.h" // for DLword, LispPTR, DLbyte, state, T, ConsCell -#include "lispmap.h" // for STK_OFFSET, ATOMS_HI +#include "lispmap.h" // for ATOMS_HI #include "lspglob.h" // for Package_from_Index_word, Stackspace #include "lsptypes.h" // for GETWORD, dtd, GETBYTE, NEWSTRINGP, GetType... #include "mkatomdefs.h" // for compare_chars, make_atom @@ -852,7 +852,7 @@ void dump_bf(Bframe *bf) { if (BFRAMEPTR(bf)->residual) { goto printflags; } - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); if ((((DLword *)bf - ptr) > 512) || (((UNSIGNED)ptr & 1) != 0)) { printf("\nInvalid basic frame"); return; @@ -910,7 +910,7 @@ void dump_fx(struct frameex1 *fx_addr68k) { /* should pay attention to the name table like RAID does */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); if (fx_addr68k == CURRENTFX) { next68k = CurrentStackPTR + 2; } if ((next68k < ptr) || (((UNSIGNED)next68k & 1) != 0)) { @@ -937,7 +937,7 @@ void dump_stackframe(struct frameex1 *fx_addr68k) { if ((fx_addr68k->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr((fx_addr68k->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset(fx_addr68k->blink); } dump_bf(bf); dump_fx((struct frameex1 *)fx_addr68k); @@ -1104,12 +1104,12 @@ void all_stack_dump(DLword start, DLword end, DLword silent) if (start == 0) start68k = Stackspace + InterfacePage->stackbase; else - start68k = NativeAligned2FromLAddr(STK_OFFSET | start); + start68k = NativeAligned2FromStackOffset(start); if (end == 0) end68k = Stackspace + InterfacePage->endofstack; else - end68k = NativeAligned2FromLAddr(STK_OFFSET | end); + end68k = NativeAligned2FromStackOffset(end); stkptr = (STKH *)start68k; @@ -1156,7 +1156,7 @@ void all_stack_dump(DLword start, DLword end, DLword silent) printf(" <-***current***"); size = EndSTKP - (DLword *)stkptr; } else { - size = NativeAligned2FromLAddr(STK_OFFSET | ((FX *)stkptr)->nextblock) - (DLword *)stkptr; + size = NativeAligned2FromStackOffset(((FX *)stkptr)->nextblock) - (DLword *)stkptr; } goto checksize; default: diff --git a/src/ufn.c b/src/ufn.c index 3f64be20..93eeff71 100644 --- a/src/ufn.c +++ b/src/ufn.c @@ -107,7 +107,7 @@ void ufn(DLword bytecode) (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (entry68k->arg_num << 1) + 2 /** +1 **/; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); #ifdef LISPTRACE print(entry68k->atom_name); From 559ba779b26d6b1232b7b4fbe96437a871d2bc03 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 19 Mar 2024 09:09:36 -0700 Subject: [PATCH 36/47] Missing definition for taking_mouse_up() --- inc/keyeventdefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/keyeventdefs.h b/inc/keyeventdefs.h index eafd012e..da5a6997 100644 --- a/inc/keyeventdefs.h +++ b/inc/keyeventdefs.h @@ -4,6 +4,7 @@ void process_io_events(void); void kb_trans(u_short keycode, u_short upflg); void taking_mouse_down(void); +void taking_mouse_up(int newx, int newy); void copy_cursor(int newx, int newy); void cursor_hidden_bitmap(int x, int y); #endif From 3c3fc94246b7573ffcdb3dd73acdd6c60378d320 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 19 Mar 2024 09:10:29 -0700 Subject: [PATCH 37/47] Clean up rawcolor code so it at least compiles without error --- src/rawcolor.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/rawcolor.c b/src/rawcolor.c index 9019c6df..8bb35a12 100644 --- a/src/rawcolor.c +++ b/src/rawcolor.c @@ -37,9 +37,11 @@ #include "gcarraydefs.h" #include "testtooldefs.h" +#include "lineblt8defs.h" #include "lsthandldefs.h" #include "car-cdrdefs.h" #include "keyeventdefs.h" +#include "rawcolordefs.h" #define IMIN(x, y) (((x) > (y)) ? (y) : (x)) #define IMAX(x, y) (((x) > (y)) ? (x) : (y)) @@ -72,6 +74,15 @@ LispPTR SLOWBLTCHAR_index; return; \ } +static void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, + BITMAP *dBM, DLword dXOffset, DLword dYOffset, + DLword width, DLword height, u_char col0, u_char col1, + LispPTR sourcetype, LispPTR operation); +static void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, + BIGBM *dBM, DLword dXOffset, DLword dYOffset, + DLword width, DLword height, u_char col0, u_char col1, + LispPTR sourcetype, LispPTR operation); + /***********************************************************/ /* C_slowbltchar @@ -302,7 +313,7 @@ void C_slowbltchar(LispPTR *args) u_int ColorizedFont8CACHE[MAXFONTHEIGHT / BITSPERNIBBLE * MAXFONTWIDTH / BITSPERNIBBLE]; -void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, +static void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, LispPTR sourcetype, LispPTR operation) { DLword *nbase; @@ -312,10 +323,10 @@ void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, D sYOffset = sBM->bmheight - (sYOffset + height); dYOffset = dBM->bmheight - (dYOffset + height); - nbase = (DLword *)NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); - (DLword *)dbase = (DLword *)NativeAligned2FromLAddr(dBM->bmbase) + (dBM->bmrasterwidth * dYOffset); + nbase = NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); + dbase = (u_char *)NativeAligned2FromLAddr(dBM->bmbase) + (dBM->bmrasterwidth * dYOffset); for (i = 0, dbase += dXOffset; /* 8bpp */ - i < height; i++, nbase += sBM->bmrasterwidth, ((DLword *)dbase) += dBM->bmrasterwidth) { + i < height; i++, nbase += sBM->bmrasterwidth, dbase += dBM->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(nbase, (int)sXOffset, dbase, (int)width, col0, col1, sourcetype, operation); } /* for end */ @@ -332,7 +343,7 @@ void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, D /* */ /************************************************************************/ -void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, +static void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, LispPTR sourcetype, LispPTR operation) { DLword *nbase; @@ -375,14 +386,13 @@ void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *d dest_h = dest_fragbottom - (dest_fragtop + dest_yoffset); } /* end if */ - dbase = - (DLword *)NativeAligned2FromLAddr(dest_frag->bmbase) + (dest_frag->bmrasterwidth * dest_yoffset); - nbase = (DLword *)NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); + dbase = (u_char *)NativeAligned2FromLAddr(dest_frag->bmbase) + (dest_frag->bmrasterwidth * dest_yoffset); + nbase = NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); sYOffset += (DLword)dest_h; /* next src yoffset */ for (i = 0, dbase += dXOffset; i < dest_h; - i++, nbase += sBM->bmrasterwidth, ((DLword *)dbase) += dest_frag->bmrasterwidth) { + i++, nbase += sBM->bmrasterwidth, dbase += dest_frag->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(nbase, (int)sXOffset, dbase, (int)width, col0, col1, sourcetype, operation); } @@ -415,8 +425,8 @@ void newColorizeFont8(PILOTBBT *pbt, u_char backcolor, u_char forecolor, LispPTR u_char *dbase; int i; - nbase = (DLword *)NativeAligned2FromLAddr((pbt->pbtsourcehi << 16) | (pbt->pbtsourcelo)); - (DLword *)dbase = (DLword *)NativeAligned2FromLAddr((pbt->pbtdesthi << 16) | (pbt->pbtdestlo)); + nbase = NativeAligned2FromLAddr((pbt->pbtsourcehi << 16) | (pbt->pbtsourcelo)); + dbase = (u_char *)NativeAligned2FromLAddr((pbt->pbtdesthi << 16) | (pbt->pbtdestlo)); dbase += pbt->pbtdestbit; for (i = 0; i < pbt->pbtheight; i++, nbase += pbt->pbtsourcebpl / 16, dbase += pbt->pbtdestbpl / 8) { @@ -494,7 +504,7 @@ void Uncolorize_Bitmap(LispPTR args[]) if ((x & 0xF) != 0) *(d_base++) = word; - if (y != (s_height - 1)) { (DLword *)s_base += s_rasterwidth; } /* end if( y ) */ + if (y != (s_height - 1)) { s_base += s_rasterwidth * BYTESPER_DLWORD; } /* end if( y ) */ } /* end for( y ) */ @@ -532,11 +542,11 @@ LispPTR Colorize_Bitmap(LispPTR args[]) s_base = (DLword *)NativeAligned2FromLAddr(s_bitmap->bmbase) + s_bitmap->bmrasterwidth * (s_bitmap->bmheight - (s_bottom + height)); - (DLword *)d_base = (DLword *)NativeAligned2FromLAddr(d_bitmap->bmbase) + + d_base = (u_char *)NativeAligned2FromLAddr(d_bitmap->bmbase) + d_bitmap->bmrasterwidth * (d_bitmap->bmheight - (d_bottom + height)); for (i = 0, d_base += d_left; i < height; - i++, s_base += s_bitmap->bmrasterwidth, (DLword *)d_base += d_bitmap->bmrasterwidth) { + i++, s_base += s_bitmap->bmrasterwidth, d_base += d_bitmap->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(s_base, s_left, d_base, width, (u_char)color0, (u_char)color1, INPUT_atom, REPLACE_atom); From 95f4ac816724040b2dd3fca99cfd4abe78ea71a6 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 25 Mar 2024 15:26:31 -0700 Subject: [PATCH 38/47] Update UNIX-GETPARM to return values for OSNAME and ARCH (#495) Calls to UNIX-GETPARM with argument "OSNAME" or "ARCH" now return values derived from the compile-time settings in inc/maiko/platform.h The current return values are OSNAME: "macOS" "Cygwin" "DragonFly BSD" "FreeBSD" "Linux" "NetBSD" "OpenBSD" "AmigaOS 3" "Solaris" "Windows" "Emscripten" ARCH: "WebAssembly" "x86_64" "arm" "arm64" "x86" "PowerPC" "RISC-V" "SPARC" "Motorola68K" --- src/uutils.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/uutils.c b/src/uutils.c index e3a58b29..77fe0460 100644 --- a/src/uutils.c +++ b/src/uutils.c @@ -204,18 +204,10 @@ LispPTR unix_getparm(LispPTR *args) { #else envvalue = "mc68020"; #endif - + } else if (strcmp(envname, "OSNAME") == 0) { + envvalue = MAIKO_OS_NAME; } else if (strcmp(envname, "ARCH") == 0) { -#if defined(sparc) - envvalue = "sun4"; -#elif defined(DOS) - envvalue = "dos"; -#elif defined(MAIKO_OS_MACOS) - envvalue = "i386"; -#else - envvalue = "sun3"; -#endif - + envvalue = MAIKO_ARCH_NAME; } else if (strcmp(envname, "DISPLAY") == 0) { #if defined(XWINDOW) envvalue = "X"; From 400ccab637375811880fb3ee20d041b24c51a8bf Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Sun, 31 Mar 2024 09:55:26 -0700 Subject: [PATCH 39/47] exit with non-zero status if unable to open sysout or... (#496) --- src/xrdopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xrdopt.c b/src/xrdopt.c index 55a1c3bd..3759ea6e 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -133,7 +133,7 @@ void print_Xusage(const char *prog) -nh-loglevel level Loglevel for Dodo networking (0..2, optional, default: 0)\n\n"); #endif fprintf(stderr, "Please refer to the manual for further information.\n\n"); - exit(0); + exit(EXIT_FAILURE); } /* end print_Xusage() */ /************************************************************************/ From 2e86450fad80b5b82a047d873e68dce395c2fb80 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 3 Apr 2024 21:10:54 -0700 Subject: [PATCH 40/47] Improve the file lookup performance for {DSK} files (#498) The directory caching for file lookup on {DSK} was disabled due to a bug in SunOS - this is no longer relevant, so the cache can be reenabled. --- src/dsk.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/src/dsk.c b/src/dsk.c index ff349d3e..6df5c740 100644 --- a/src/dsk.c +++ b/src/dsk.c @@ -3053,10 +3053,8 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr FileName *svarray; DIR *dirp; struct dirent *dp; - /* Used in commented out code below: int rval; struct stat sbuf; - */ /* * First of all, prepare a lower cased file name for the case insensitive @@ -3066,20 +3064,14 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr separate_version(lcased_file, ver, 1); DOWNCASE(lcased_file); - /* - TIMEOUT(rval = stat(dir, &sbuf)); - if (rval == -1) { - *Lisp_errno = errno; - return(0); - } - */ - - /* - * If the cached version array is still valid, we can return immediately. - */ + TIMEOUT(rval = stat(dir, &sbuf)); + if (rval == -1) { + *Lisp_errno = errno; + return(0); + } /* - * Cache mechanism is not used now, because of the bug of Sun OS. + * Cache mechanism was not used because of a bug in Sun OS. * Sometimes just after unlinking a file on a directory, the st_mtime * of the directory does not change. This will make Maiko believe * cached version array is still valid, although it is already invalid. @@ -3087,9 +3079,12 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr */ /* - if ((sbuf.st_mtime == cache->mtime) && strcmp(dir, cache->path) == 0 - && strcmp(lcased_file, cache->file) == 0) return(1); - */ + * If the cached version array is still valid, we can return immediately. + */ + + if ((sbuf.st_mtime == cache->mtime) && strcmp(dir, cache->path) == 0 + && strcmp(lcased_file, cache->file) == 0) return(1); + errno = 0; TIMEOUT0(dirp = opendir(dir)); if (dirp == NULL) { @@ -3140,11 +3135,9 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr /* * Update cache information. */ - /* - strcpy(cache->path, dir); - strcpy(cache->file, lcased_file); - cache->mtime = sbuf.st_mtime; - */ + strcpy(cache->path, dir); + strcpy(cache->file, lcased_file); + cache->mtime = sbuf.st_mtime; TIMEOUT(closedir(dirp)); return (1); #endif /* DOS */ From e2e2c7e3946b93e8c2fddc0248de6861dc4aff6d Mon Sep 17 00:00:00 2001 From: Anarchos Date: Thu, 11 Apr 2024 05:14:46 +0200 Subject: [PATCH 41/47] Haiku OS port (#485) * Haiku OS port * haiku with X11 backend * haiku has stpncpy * Haiku is not Linux. * X not stable enough on Haiku * Haiku : settimeofday is a no-op * Haiku : no need to define settimeofday at all (pointed by nbriggs) --------- Signed-off-by: Anarchos --- bin/makefile-haiku.x86_64-sdl | 19 +++++++++++++++++++ bin/osversion | 1 + inc/maiko/platform.h | 6 ++++++ src/inet.c | 29 +++++++++++++++++++++++++---- src/initsout.c | 4 ++-- src/ldeboot.c | 1 + src/timer.c | 16 ++++++++++++++-- src/tty.c | 4 ++++ src/unixfork.c | 2 ++ src/uraid.c | 2 ++ src/uutils.c | 5 ++++- 11 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 bin/makefile-haiku.x86_64-sdl diff --git a/bin/makefile-haiku.x86_64-sdl b/bin/makefile-haiku.x86_64-sdl new file mode 100644 index 00000000..1e68a871 --- /dev/null +++ b/bin/makefile-haiku.x86_64-sdl @@ -0,0 +1,19 @@ +# Options for Haiku, Intel x86_64 and SDL + +CC = gcc -m64 $(GCC_CFLAGS) +# CC = clang -m64 $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 -g3 +DFLAGS = $(XFLAGS) -DRELEASE=351 + +LDFLAGS = -lSDL2 -lnetwork +LDELDFLAGS = -lnetwork -lbsd + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl diff --git a/bin/osversion b/bin/osversion index 19f6eaea..80bf6bdd 100755 --- a/bin/osversion +++ b/bin/osversion @@ -12,6 +12,7 @@ case "$os" in *-*-openbsd*) echo openbsd ;; *-*-freebsd*) echo freebsd ;; *-*-cygwin*) echo cygwin ;; + *-*-haiku*) echo haiku ;; esac ### Don't leave the variable set. unset os diff --git a/inc/maiko/platform.h b/inc/maiko/platform.h index a69b21fe..725db07a 100644 --- a/inc/maiko/platform.h +++ b/inc/maiko/platform.h @@ -166,6 +166,12 @@ # define MAIKO_ARCH_DETECTED 1 #endif +#ifdef __HAIKU__ +# define MAIKO_OS_HAIKU 1 +# define MAIKO_OS_NAME "Haiku" +# define MAIKO_OS_UNIX_LIKE 1 +# define MAIKO_OS_DETECTED 1 +#endif /* Modern GNU C, Clang, Sun Studio provide __BYTE_ORDER__ * Older GNU C (ca. 4.0.1) provides __BIG_ENDIAN__/__LITTLE_ENDIAN__ */ diff --git a/src/inet.c b/src/inet.c index 0231d3a9..ecdbab6c 100644 --- a/src/inet.c +++ b/src/inet.c @@ -107,8 +107,14 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li addr_class = LispNumToCInt(nameConn); protocol = LispNumToCInt(proto); result = socket(addr_class, protocol, 0); +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); +#endif return (GetSmallp(result)); case TCPconnect: /* args: hostname or (fixp)address, socket# */ @@ -131,7 +137,9 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li return (NIL); } fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); +#endif return (GetSmallp(result)); @@ -197,13 +205,20 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li sigset_t signals; sigemptyset(&signals); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); - +#endif sigprocmask(SIG_BLOCK, &signals, NULL); +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); - fcntl(result, F_SETOWN, getpid()); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN + fcntl(result, F_SETOWN, getpid()); +#endif if (listen(result, 5) == -1) { perror("TCP Listen"); close(result); @@ -225,8 +240,9 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li return (NIL); } fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); - +#endif return (GetSmallp(result)); case INETpeername: /* socket#, buffer for name string */ @@ -259,9 +275,14 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li close(result); return (NIL); } +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); - +#endif FD_SET(result, &LispIOFds); /* so we get interrupts */ FD_SET(result, &LispReadFds); DBPRINT(("LispIOFds = %p\n", (void *)&LispIOFds)); diff --git a/src/initsout.c b/src/initsout.c index dc70e7af..ff4a6784 100644 --- a/src/initsout.c +++ b/src/initsout.c @@ -140,9 +140,9 @@ void init_ifpage(unsigned sysout_size) { #endif /* BIGVM */ /* unfortunately, Lisp only looks at a 16 bit serial number */ -#ifndef DOS +#if !defined(DOS) && !defined(MAIKO_OS_HAIKU) InterfacePage->serialnumber = 0xffff & gethostid(); -#endif /* DOS */ +#endif /* DOS MAIKO_OS_HAIKU */ /* get user name and stuff into vmem; this is the VMEM buffer; This is a BCPL string -- it starts with a length count. C strings diff --git a/src/ldeboot.c b/src/ldeboot.c index 6e189272..88708e5d 100644 --- a/src/ldeboot.c +++ b/src/ldeboot.c @@ -201,6 +201,7 @@ int main(int argc, char *argv[]) { } else { /* copy up to and including the final "/" in the path */ dirsepp = stpncpy(filetorunpath, argv[0], dirsepp + 1 - argv[0]); + /* dirsepp now points to the trailing null in the copy */ strncpy(dirsepp, filetorun, PATH_MAX - (dirsepp - filetorunpath)); argv[0] = filetorunpath; diff --git a/src/timer.c b/src/timer.c index ef91303f..fed42f74 100644 --- a/src/timer.c +++ b/src/timer.c @@ -47,6 +47,10 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */ #include #endif /* DOS */ +#ifdef MAIKO_OS_HAIKU +#include +#endif + #if defined(USE_DLPI) #include extern int ether_fd; @@ -301,6 +305,8 @@ void subr_settime(LispPTR args[]) dosday.year = uxtime.tm_year; dosday.dayofweek = uxtime.tm_wday; _dos_setdate(&dosday); +#elif defined(MAIKO_OS_HAIKU) + (void)args[0]; #elif defined(MAIKO_OS_EMSCRIPTEN) (void)args[0]; #else @@ -556,17 +562,19 @@ static void int_io_service(int sig) /************************************************************************/ static void int_io_init(void) { -#ifndef DOS +#if !defined(DOS) || !defined(MAIKO_OS_HAIKU) struct sigaction io_action; io_action.sa_handler = int_io_service; sigemptyset(&io_action.sa_mask); io_action.sa_flags = 0; +#ifndef MAIKO_OS_HAIKU if (sigaction(SIGIO, &io_action, NULL) == -1) { perror("sigaction: SIGIO"); } else { DBPRINT(("I/O interrupts enabled\n")); } +#endif #if defined(USE_DLPI) DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); @@ -578,7 +586,7 @@ static void int_io_init(void) { return; } #endif /* USE_DLPI */ -#endif /* DOS */ +#endif /* DOS MAIKO_OS_HAIKU */ } /************************************************************************/ @@ -600,7 +608,9 @@ void int_block(void) { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); #ifdef FLTINT @@ -628,7 +638,9 @@ void int_unblock(void) { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); #ifdef FLTINT diff --git a/src/tty.c b/src/tty.c index f00643fb..e628cfd5 100644 --- a/src/tty.c +++ b/src/tty.c @@ -51,7 +51,11 @@ void tty_open(void) if (TTY_Fd < 0) { if ((TTY_Fd = open(TTY_Dev, O_RDWR)) >= 0) { tcgetattr(TTY_Fd, &options); +#ifndef MAIKO_OS_HAIKU options.c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR); +#else + options.c_iflag &= ~(IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR); +#endif options.c_iflag |= IGNBRK; options.c_oflag &= ~OPOST; options.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP); diff --git a/src/unixfork.c b/src/unixfork.c index 366495fc..767f2a3c 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -219,7 +219,9 @@ int fork_Unix(void) { /* interrupts need to be blocked here so subprocess won't see them */ sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); sigaddset(&signals, SIGFPE); diff --git a/src/uraid.c b/src/uraid.c index df9ecab9..3b311b8d 100644 --- a/src/uraid.c +++ b/src/uraid.c @@ -864,7 +864,9 @@ int device_before_raid(void) { #ifdef XWINDOW /* So X events still get recognized. */ sigemptyset(&signals); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigprocmask(SIG_UNBLOCK, &signals, NULL); #endif diff --git a/src/uutils.c b/src/uutils.c index 77fe0460..e011229a 100644 --- a/src/uutils.c +++ b/src/uutils.c @@ -231,10 +231,13 @@ LispPTR unix_getparm(LispPTR *args) { struct passwd *pwd; if ((pwd = getpwuid(getuid())) == NULL) return NIL; envvalue = pwd->pw_gecos; - } else if (strcmp(envname, "HOSTID") == 0) { + } +#ifndef MAIKO_OS_HAIKU + else if (strcmp(envname, "HOSTID") == 0) { snprintf(result, sizeof(result), "%lx", gethostid()); envvalue = result; } +#endif /* MAIKO_OS_HAIKU */ #endif /* DOS */ else return NIL; From 8d34f0869af633d4d9fe126d41873045d5ba5662 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Sat, 13 Apr 2024 11:12:10 -0700 Subject: [PATCH 42/47] Problem with directory caching, #1661, disable until it is solved. --- src/dsk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dsk.c b/src/dsk.c index 6df5c740..516c0611 100644 --- a/src/dsk.c +++ b/src/dsk.c @@ -3082,8 +3082,11 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr * If the cached version array is still valid, we can return immediately. */ +#if 0 + /* there is a (different?) problem (#1661) with the caching - disable until it's solved */ if ((sbuf.st_mtime == cache->mtime) && strcmp(dir, cache->path) == 0 && strcmp(lcased_file, cache->file) == 0) return(1); +#endif errno = 0; TIMEOUT0(dirp = opendir(dir)); From 38862ddb088b41e0f15d4a59ce91a6241920361b Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 23 Apr 2024 21:49:38 -0700 Subject: [PATCH 43/47] Ignore snprintf() result where OK to do so, convert sprintf() to snprintf() --- src/unixfork.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/unixfork.c b/src/unixfork.c index 767f2a3c..1292a90f 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -236,19 +236,23 @@ int fork_Unix(void) { /* JRB - fork_Unix is now called in ldeboot; leave UnixPipe{In,Out} open and put their numbers in the environment so parent can find them */ /* JDS - NB that sprintf doesn't always return a string! */ - + /* NHB - if the return value of snprintf() is greater than or equal to the + * size argument, the string was too short and some of the printed + * characters were discarded. However we're printing numbers, so we know + * that the buffer is big enough + */ char tempstring[30]; - snprintf(tempstring, sizeof(tempstring), "%d", UnixToLisp[0]); + (void)snprintf(tempstring, sizeof(tempstring), "%d", UnixToLisp[0]); setenv("LDEPIPEIN", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%d", LispToUnix[1]); + (void)snprintf(tempstring, sizeof(tempstring), "%d", LispToUnix[1]); setenv("LDEPIPEOUT", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%ld", StartTime); + (void)snprintf(tempstring, sizeof(tempstring), "%ld", StartTime); setenv("LDESTARTTIME", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%d", UnixPID); + (void)snprintf(tempstring, sizeof(tempstring), "%d", UnixPID); setenv("LDEUNIXPID", tempstring, 1); close(LispToUnix[0]); @@ -275,7 +279,7 @@ int fork_Unix(void) { DBPRINT(("Input packet wrong length: %zd", len)); exit(1); } - slot = IOBuf[3]; + slot = (int)IOBuf[3]; IOBuf[3] = 1; /* Start by signalling success in return-code */ switch (IOBuf[0]) { @@ -351,7 +355,7 @@ int fork_Unix(void) { perror("slave socket"); exit(1); } - sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot); + (void)snprintf(PipeName, sizeof(PipeName), "/tmp/LPU%ld-%d", StartTime, slot); memset(&addr, 0, sizeof(struct sockaddr_un)); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, PipeName); From c3916416910a9c8007f57c30c8bf616fd5030962 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 24 Apr 2024 11:41:46 -0700 Subject: [PATCH 44/47] Eliminate warnings for ignored fprintf() result when printing messages to stderr --- src/common.c | 6 +++--- src/dlpi.c | 14 ++++++------- src/dspif.c | 8 ++++---- src/initsout.c | 2 +- src/ldeboot.c | 8 ++++---- src/ldsout.c | 16 +++++++-------- src/main.c | 54 +++++++++++++++++++++++++------------------------- src/perrno.c | 6 +++--- src/tstsout.c | 2 +- src/uraid.c | 6 +++--- src/vesainit.c | 4 ++-- src/vgainit.c | 2 +- src/vmemsave.c | 2 +- src/xmkicon.c | 4 ++-- src/xrdopt.c | 38 +++++++++++++++++------------------ 15 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/common.c b/src/common.c index 785941d2..06722d4f 100644 --- a/src/common.c +++ b/src/common.c @@ -64,14 +64,14 @@ LispPTR Uraid_mess = NIL; int error(const char *cp) { char *ptr; if (device_before_raid() < 0) { - fprintf(stderr, "Can't Enter URAID.\n"); + (void)fprintf(stderr, "Can't Enter URAID.\n"); exit(-1); } /* comm read */ URaid_errmess = cp; - fprintf(stderr, "\n*Error* %s\n", cp); + (void)fprintf(stderr, "\n*Error* %s\n", cp); fflush(stdin); - fprintf(stderr, "Enter the URaid\n"); + (void)fprintf(stderr, "Enter the URaid\n"); print(Uraid_mess); putchar('\n'); /* XXX: make sure output is flushed so we can see where we are */ diff --git a/src/dlpi.c b/src/dlpi.c index abeffd15..61b88abf 100644 --- a/src/dlpi.c +++ b/src/dlpi.c @@ -188,7 +188,7 @@ int setup_dlpi_dev(char *device) dlbindreq(fd, 0x0600, 0, DL_CLDLS, 0, 0); if (dlbindack(fd, buf) < 0) { - fprintf(stderr, "%s: dlbindack failed.\n", pname); + (void)fprintf(stderr, "%s: dlbindack failed.\n", pname); return (-1); } @@ -202,14 +202,14 @@ int setup_dlpi_dev(char *device) dlpromisconreq(fd, DL_PROMISC_SAP); if (dlokack(fd, buf) < 0) { - fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname); + (void)fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname); return (-1); } dlpromisconreq(fd, DL_PROMISC_MULTI); if (dlokack(fd, buf) < 0) { - fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname); + (void)fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname); return (-1); } @@ -329,8 +329,8 @@ int dlpi_devtype(int fd) case DL_FDDI: return (DLT_FDDI); #endif default: - fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type); - fprintf(stderr, "assuming ethernet.\n"); + (void)fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type); + (void)fprintf(stderr, "assuming ethernet.\n"); return (DLT_EN10MB); } } @@ -585,7 +585,7 @@ static int strgetmsg(int fd, struct strbuf *ctlp, struct strbuf *datap, int *fla /* * sigalrm - handle alarms. */ -static void sigalrm(int sig) { (void)fprintf(stderr, "dlpi: timeout\n"); } +static void sigalrm(int sig) { (void)(void)fprintf(stderr, "dlpi: timeout\n"); } /* * savestr - save string in dynamic memory. @@ -595,7 +595,7 @@ static char *savestr(char *s) char *t; if ((t = malloc(strlen(s) + 1)) == NULL) { - (void)fprintf(stderr, "%s: out of memory.\n", pname); + (void)(void)fprintf(stderr, "%s: out of memory.\n", pname); (void)exit(1); } diff --git a/src/dspif.c b/src/dspif.c index 808f8e3c..7f8ec498 100644 --- a/src/dspif.c +++ b/src/dspif.c @@ -59,8 +59,8 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h } else if (VGA_p()) { VGA_init(dsp, 0, 0, 0, depth_hint); } else { /* Can't set *ANY* video mode! */ - (void)fprintf(stderr, "No portable graphics mode supported by this host.\n"); - (void)fprintf(stderr, "\n-Expected VESA or VGA.\n"); + (void)(void)fprintf(stderr, "No portable graphics mode supported by this host.\n"); + (void)(void)fprintf(stderr, "\n-Expected VESA or VGA.\n"); exit(1); } break; @@ -69,7 +69,7 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h #elif XWINDOW /* lispbitmap is 0 when we call X_init the first time. */ if (X_init(dsp, 0, LispDisplayRequestedWidth, LispDisplayRequestedHeight, depth_hint) == NULL) { - fprintf(stderr, "Can't open display."); + (void)fprintf(stderr, "Can't open display."); exit(-1); } #endif /* DOS | XWINDOW */ @@ -87,7 +87,7 @@ void GenericReturnVoid(void *d) {(void)d; return; } void GenericPanic(void *d) { (void)d; TPRINT(("Enter GenericPanic\n")); - fprintf(stderr, "Panic! Call to uninitialized display slot!"); + (void)fprintf(stderr, "Panic! Call to uninitialized display slot!"); exit(0); } diff --git a/src/initsout.c b/src/initsout.c index ff4a6784..aed42612 100644 --- a/src/initsout.c +++ b/src/initsout.c @@ -124,7 +124,7 @@ void init_ifpage(unsigned sysout_size) { new_lastvmem = (sysout_size * PAGES_IN_MBYTE) - 1; if ((!Storage_expanded) && (InterfacePage->dllastvmempage != new_lastvmem)) { - fprintf(stderr, "You can't expand VMEM\n"); + (void)fprintf(stderr, "You can't expand VMEM\n"); exit(-1); } else { /* Set value which will be set to \\LASTVMEMFILEPAGE in LISP */ InterfacePage->dllastvmempage = new_lastvmem; diff --git a/src/ldeboot.c b/src/ldeboot.c index 88708e5d..e850ee1f 100644 --- a/src/ldeboot.c +++ b/src/ldeboot.c @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { for (i = 1; i < argc; i++) { if ((strcmp(argv[i], "-d") == 0) || (strcmp(argv[i], "-display") == 0)) { if (i == argc - 1) { - fprintf(stderr, "Missing argument to -display option.\n"); + (void)fprintf(stderr, "Missing argument to -display option.\n"); exit(1); } displayName = argv[++i]; @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) { filetorun = LDEX; goto run; } else { - fprintf(stderr, "Unable to open X11 display %s\n", + (void)fprintf(stderr, "Unable to open X11 display %s\n", displayName ? displayName : "from DISPLAY"); exit(1); } @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { #ifdef USESUNSCREEN if ((FrameBufferFd = open("/dev/fb", O_RDWR)) < 0) { - fprintf(stderr, "lde: can't open FrameBuffer\n"); + (void)fprintf(stderr, "lde: can't open FrameBuffer\n"); exit(1); } if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) < 0) { @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) { run: if (filetorun == NULL) { - fprintf(stderr, "Unable to determine what display program to run.\n"); + (void)fprintf(stderr, "Unable to determine what display program to run.\n"); exit(1); } diff --git a/src/ldsout.c b/src/ldsout.c index 5860a0a4..e9afd7ee 100644 --- a/src/ldsout.c +++ b/src/ldsout.c @@ -121,14 +121,14 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { */ #ifndef NOVERSION if (ifpage.lversion < LVERSION) { - fprintf(stderr, "Lisp VM is too old for this emulator.\n"); - fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION); + (void)fprintf(stderr, "Lisp VM is too old for this emulator.\n"); + (void)fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION); exit(-1); } if (ifpage.minbversion > MINBVERSION) { - fprintf(stderr, "Emulator is too old for this Lisp VM.\n"); - fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion); + (void)fprintf(stderr, "Emulator is too old for this Lisp VM.\n"); + (void)fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion); exit(-1); } #endif /* NOVERSION */ @@ -157,9 +157,9 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { /* Hence we have to observe the display protocol. */ VESA_errorexit(tmp); #else - fprintf(stderr, "sysout_loader: You can't specify the process size.\n"); - fprintf(stderr, "Because, secondary space is already used.\n"); - fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size); + (void)fprintf(stderr, "sysout_loader: You can't specify the process size.\n"); + (void)fprintf(stderr, "Because, secondary space is already used.\n"); + (void)fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size); exit(-1); #endif /* DOS */ } @@ -176,7 +176,7 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { lispworld_scratch = mmap(0, sys_size * MBYTE, PROT_READ|PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (lispworld_scratch == MAP_FAILED) { - fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size); + (void)fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size); exit(-1); } diff --git a/src/main.c b/src/main.c index b6e05a8e..1d554dbe 100644 --- a/src/main.c +++ b/src/main.c @@ -364,7 +364,7 @@ int main(int argc, char *argv[]) } if (argv[i] && ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "-HELP") == 0))) { - fprintf(stderr, "%s%s", helpstring, nethubHelpstring); + (void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring); exit(0); } @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) } if (access(sysout_name, R_OK)) { perror("Couldn't find a sysout to run"); - fprintf(stderr, "%s%s", helpstring, nethubHelpstring); + (void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring); exit(1); } /* OK, sysout name is now in sysout_name, and i is moved past a supplied name */ @@ -403,11 +403,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { TIMER_INTERVAL = tmpint; } else { - fprintf(stderr, "Bad value for -t (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -t (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -t\n"); + (void)fprintf(stderr, "Missing argument after -t\n"); exit(1); } } @@ -419,11 +419,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { sysout_size = (unsigned)tmpint; } else { - fprintf(stderr, "Bad value for -m (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -m (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -m\n"); + (void)fprintf(stderr, "Missing argument after -m\n"); exit(1); } } @@ -462,22 +462,22 @@ int main(int argc, char *argv[]) if (argc > ++i) { int read = sscanf(argv[i], "%dx%d", &width, &height); if(read != 2) { - fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]); + (void)fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]); exit(1); } } else { - fprintf(stderr, "Missing argument after -sc\n"); + (void)fprintf(stderr, "Missing argument after -sc\n"); exit(1); } } else if ((strcmp(argv[i], "-pixelscale") == 0) || (strcmp(argv[i], "-PIXELSCALE") == 0)) { if (argc > ++i) { int read = sscanf(argv[i], "%d", &pixelscale); if(read != 1) { - fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]); + (void)fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]); exit(1); } } else { - fprintf(stderr, "Missing argument after -pixelscale\n"); + (void)fprintf(stderr, "Missing argument after -pixelscale\n"); exit(1); } } else if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "-T") == 0) @@ -485,7 +485,7 @@ int main(int argc, char *argv[]) if (argc > ++i) { windowtitle = argv[i]; } else { - fprintf(stderr, "Missing argument after -title\n"); + (void)fprintf(stderr, "Missing argument after -title\n"); exit(1); } } @@ -511,7 +511,7 @@ int main(int argc, char *argv[]) ether_host[4] = b4; ether_host[5] = b5; } else { - fprintf(stderr, "Missing or bogus -E argument\n"); + (void)fprintf(stderr, "Missing or bogus -E argument\n"); ether_fd = -1; exit(1); } @@ -524,7 +524,7 @@ int main(int argc, char *argv[]) if (argc > ++i) { setNethubHost(argv[i]); } else { - fprintf(stderr, "Missing argument after -nh-host\n"); + (void)fprintf(stderr, "Missing argument after -nh-host\n"); exit(1); } } @@ -535,11 +535,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { setNethubPort(tmpint); } else { - fprintf(stderr, "Bad value for -nh-port\n"); + (void)fprintf(stderr, "Bad value for -nh-port\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-port\n"); + (void)fprintf(stderr, "Missing argument after -nh-port\n"); exit(1); } } @@ -549,11 +549,11 @@ int main(int argc, char *argv[]) if (sscanf(argv[i], "%x-%x-%x-%x-%x-%x", &b0, &b1, &b2, &b3, &b4, &b5) == 6) { setNethubMac(b0, b1, b2, b3, b4, b5); } else { - fprintf(stderr, "Invalid argument for -nh-mac\n"); + (void)fprintf(stderr, "Invalid argument for -nh-mac\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-mac\n"); + (void)fprintf(stderr, "Missing argument after -nh-mac\n"); exit(1); } } @@ -564,11 +564,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint >= 0) { setNethubLogLevel(tmpint); } else { - fprintf(stderr, "Bad value for -nh-loglevel\n"); + (void)fprintf(stderr, "Bad value for -nh-loglevel\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-loglevel\n"); + (void)fprintf(stderr, "Missing argument after -nh-loglevel\n"); exit(1); } } @@ -582,11 +582,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 1000) { insnsCountdownForTimerAsyncEmulation = tmpint; } else { - fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n"); + (void)fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -intr-emu-insns\n"); + (void)fprintf(stderr, "Missing argument after -intr-emu-insns\n"); exit(1); } } @@ -600,11 +600,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { maxpages = (unsigned)tmpint; } else { - fprintf(stderr, "Bad value for -xpages (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -xpages (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -xpages\n"); + (void)fprintf(stderr, "Missing argument after -xpages\n"); exit(1); } } @@ -615,9 +615,9 @@ int main(int argc, char *argv[]) probemouse(); /* See if the mouse is connected. */ #else if (getuid() != geteuid()) { - fprintf(stderr, "Effective user is not real user. Resetting uid\n"); + (void)fprintf(stderr, "Effective user is not real user. Resetting uid\n"); if (setuid(getuid()) == -1) { - fprintf(stderr, "Unable to reset user id to real user id\n"); + (void)fprintf(stderr, "Unable to reset user id to real user id\n"); exit(1); } } @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) if (FindUnixPipes()) /* must call the routine to allocate storage, */ { /* in case we're re-starting a savevm w/open ptys */ - if (please_fork) fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n"); + if (please_fork) (void)fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n"); } #endif /* DOS */ @@ -665,7 +665,7 @@ int main(int argc, char *argv[]) /* file system directory enumeration stuff */ if (!init_finfo()) { - fprintf(stderr, "Cannot allocate internal data.\n"); + (void)fprintf(stderr, "Cannot allocate internal data.\n"); exit(1); } #ifdef RS232 diff --git a/src/perrno.c b/src/perrno.c index c7aa4c50..b2ed83fa 100644 --- a/src/perrno.c +++ b/src/perrno.c @@ -25,8 +25,8 @@ /************************************************************************/ void perrorn(char *s, int n) { - if (s != NULL && *s != '\0') { fprintf(stderr, "%s: ", s); } - fprintf(stderr, "%s\n", strerror(n)); + if (s != NULL && *s != '\0') { (void)fprintf(stderr, "%s: ", s); } + (void)fprintf(stderr, "%s\n", strerror(n)); } /************************************************************************/ @@ -42,7 +42,7 @@ void err_mess(char *from, int no) { int save_errno = errno; /* Save errno around OSMESSAGE_PRINT */ OSMESSAGE_PRINT({ - fprintf(stderr, "System call error: %s errno=%d ", from, no); + (void)fprintf(stderr, "System call error: %s errno=%d ", from, no); perror(""); }); diff --git a/src/tstsout.c b/src/tstsout.c index 2e9a0808..03b41156 100644 --- a/src/tstsout.c +++ b/src/tstsout.c @@ -73,7 +73,7 @@ void check_sysout(char *sysout_file_name, int verbose) { } void usage(char *prog) { - fprintf(stderr, "Usage: %s [-v] sysout-filename\n", prog); + (void)fprintf(stderr, "Usage: %s [-v] sysout-filename\n", prog); exit(-1); } diff --git a/src/uraid.c b/src/uraid.c index 3b311b8d..abf2e492 100644 --- a/src/uraid.c +++ b/src/uraid.c @@ -776,7 +776,7 @@ LispPTR uraid_commands(void) { break; case 's': /* SHELL */ switch (vfork()) { - case -1: (void)fprintf(stderr, "uraid: Fork failed.\n"); exit(1); + case -1: (void)(void)fprintf(stderr, "uraid: Fork failed.\n"); exit(1); case 0: (void)execl("/bin/sh", "sh", "-i", NULL); exit(1); @@ -903,7 +903,7 @@ char *alloc_hideDISP(int size) { case SFS_NOTSWITCHABLE : if((retaddr =malloc(size)) ==0){ - fprintf(stderr,"can't alloc hide space\n"); + (void)fprintf(stderr,"can't alloc hide space\n"); } break; case 0 : @@ -927,7 +927,7 @@ char *alloc_hideDISP(int size) printf("Hidespace inside Lisp(4)\n"); } else if((retaddr=malloc(size)) ==0){ - fprintf(stderr,"can't alloc hide disp\n"); + (void)fprintf(stderr,"can't alloc hide disp\n"); } printf("Hidespace new\n"); break; diff --git a/src/vesainit.c b/src/vesainit.c index 3c24827d..e531df28 100644 --- a/src/vesainit.c +++ b/src/vesainit.c @@ -235,7 +235,7 @@ void VESA_enter(DspInterface dsp) if (VESA_describemode(dsp->graphicsmode) != 0) { _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN); - fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); + (void)fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); exit(0); } /* Get the segaddr. An addr. is a seg shifted 4 bits! */ @@ -326,7 +326,7 @@ VESA_errorexit(char *s, int errno) { _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN); - fprintf(stderr, s); + (void)fprintf(stderr, s); fflush(stderr); exit(errno); } diff --git a/src/vgainit.c b/src/vgainit.c index b00cca4c..03619fdd 100644 --- a/src/vgainit.c +++ b/src/vgainit.c @@ -34,7 +34,7 @@ void VGA_setmax(DspInterface dsp) struct videoconfig vc; if (!_setvideomode(_MAXRESMODE)) { - fprintf(stderr, "Can't set graphics mode.\n"); + (void)fprintf(stderr, "Can't set graphics mode.\n"); exit(1); } _getvideoconfig(&vc); diff --git a/src/vmemsave.c b/src/vmemsave.c index a031b63d..3ea6f09f 100644 --- a/src/vmemsave.c +++ b/src/vmemsave.c @@ -487,7 +487,7 @@ LispPTR vmem_save(char *sysout_file_name) TIMEOUT(rval = rename(tempname, sysout_file_name)); if (rval == -1) { - fprintf(stderr, "sysout is saved to temp file, %s.", tempname); + (void)fprintf(stderr, "sysout is saved to temp file, %s.", tempname); return (FILECANNOTWRITE); } diff --git a/src/xmkicon.c b/src/xmkicon.c index ef313e83..20c4a485 100644 --- a/src/xmkicon.c +++ b/src/xmkicon.c @@ -136,8 +136,8 @@ Pixmap make_Xicon(DspInterface dsp) Lisp_icon_height); } else if (value == BitmapFileInvalid) - fprintf(stderr, "Iconpixmapfile %s contains invalid bitmap data\n", iconpixmapfile); + (void)fprintf(stderr, "Iconpixmapfile %s contains invalid bitmap data\n", iconpixmapfile); else if (value == BitmapNoMemory) - fprintf(stderr, "Not enough memory to allocate icon pixmap\n"); + (void)fprintf(stderr, "Not enough memory to allocate icon pixmap\n"); return (IconPixmap); } /* end make_Xicon */ diff --git a/src/xrdopt.c b/src/xrdopt.c index 3759ea6e..8f1c3c5c 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -110,29 +110,29 @@ extern struct sockaddr_nit snit; void print_Xusage(const char *prog) { - fprintf(stderr, " %s options:\n", prog); - fprintf(stderr, " [-sysout] [] -path to the Medley image\n"); - fprintf(stderr, " -h[elp] -prints this text\n"); - fprintf(stderr, " -info -prints configuration info\n"); - fprintf(stderr, " -d[isplay] :.\n"); - fprintf(stderr, + (void)fprintf(stderr, " %s options:\n", prog); + (void)fprintf(stderr, " [-sysout] [] -path to the Medley image\n"); + (void)fprintf(stderr, " -h[elp] -prints this text\n"); + (void)fprintf(stderr, " -info -prints configuration info\n"); + (void)fprintf(stderr, " -d[isplay] :.\n"); + (void)fprintf(stderr, " -g[eometry] -size & placement for the medley window on your X " "screen\n"); - fprintf(stderr, + (void)fprintf(stderr, " -sc[reen] -size & placement for the medley display\n"); - fprintf(stderr, " -t[itle] -titlebar text for the window manager\n"); - fprintf(stderr, " -icontitle | -it -text for the medley icon\n"); - fprintf(stderr, " -iconbitmap | -ibm -bitmap for the medley icon\n"); - fprintf(stderr, + (void)fprintf(stderr, " -t[itle] -titlebar text for the window manager\n"); + (void)fprintf(stderr, " -icontitle | -it -text for the medley icon\n"); + (void)fprintf(stderr, " -iconbitmap | -ibm -bitmap for the medley icon\n"); + (void)fprintf(stderr, " -xsync -turn XSynchronize on. (default is off)\n\n"); #if defined(MAIKO_ENABLE_NETHUB) - fprintf(stderr,"\ + (void)fprintf(stderr,"\ -nh-host dodo-host Hostname for Dodo Nethub (no networking if missing)\n\ -nh-port port-number Port for Dodo Nethub (optional, default: 3333)\n\ -nh-mac XX-XX-XX-XX-XX-XX Machine-ID for Maiko-VM (optional, default: CA-FF-EE-12-34-56) \n\ -nh-loglevel level Loglevel for Dodo networking (0..2, optional, default: 0)\n\n"); #endif - fprintf(stderr, "Please refer to the manual for further information.\n\n"); + (void)fprintf(stderr, "Please refer to the manual for further information.\n\n"); exit(EXIT_FAILURE); } /* end print_Xusage() */ @@ -206,9 +206,9 @@ void read_Xoption(int *argc, char *argv[]) if (XrmGetResource(commandlineDB, "ldex.display", "Ldex.Display", str_type, &value) == True) { (void)strncpy(Display_Name, value.addr, value.size); } else if (getenv("DISPLAY") == (char *)NULL) { - fprintf(stderr, "Can't find a display. Either set the shell\n"); - fprintf(stderr, "variable DISPLAY to an appropriate display\n"); - fprintf(stderr, "or provide a -display argument.\n"); + (void)fprintf(stderr, "Can't find a display. Either set the shell\n"); + (void)fprintf(stderr, "variable DISPLAY to an appropriate display\n"); + (void)fprintf(stderr, "or provide a -display argument.\n"); print_Xusage(argv[0]); } else { envname = getenv("DISPLAY"); @@ -228,7 +228,7 @@ void read_Xoption(int *argc, char *argv[]) } XCloseDisplay(xdisplay); } else { - fprintf(stderr, "Open_Display: cannot connect to display %s.", XDisplayName(Display_Name)); + (void)fprintf(stderr, "Open_Display: cannot connect to display %s.", XDisplayName(Display_Name)); exit(-1); } @@ -248,7 +248,7 @@ void read_Xoption(int *argc, char *argv[]) (void)strncpy(sysout_name, value.addr, value.size); } if (sysout_name[0] == '\0') { - fprintf(stderr, "Couldn't find a sysout to run;\n"); + (void)fprintf(stderr, "Couldn't find a sysout to run;\n"); print_Xusage(argv[0]); } @@ -329,7 +329,7 @@ void read_Xoption(int *argc, char *argv[]) ether_host[4] = b4; ether_host[5] = b5; } else { - fprintf(stderr, "Missing or bogus -E argument\n"); + (void)fprintf(stderr, "Missing or bogus -E argument\n"); ether_fd = -1; exit(1); } From 143c0f67cf5cc2ea977c024e25422aa5ba43b94b Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Mon, 6 May 2024 16:12:59 -0700 Subject: [PATCH 45/47] In buildRelease workflow, MacOS job - fix issue with uninstall of casks that have not actually been installed. result of changes to github runner in MacOS-lastest --- .github/workflows/buildRelease.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index e57c3adf..13459fd4 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -290,13 +290,13 @@ jobs: # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies - name: Unistall X components already on the runner run: | - brew uninstall --ignore-dependencies libxft - brew uninstall --ignore-dependencies libxrender - brew uninstall --ignore-dependencies libxext - brew uninstall --ignore-dependencies libx11 - brew uninstall --ignore-dependencies xorgproto - brew uninstall --ignore-dependencies libxdmcp - brew uninstall --ignore-dependencies libxau + brew uninstall --ignore-dependencies --force libxft + brew uninstall --ignore-dependencies --force libxrender + brew uninstall --ignore-dependencies --force libxext + brew uninstall --ignore-dependencies --force libx11 + brew uninstall --ignore-dependencies --force xorgproto + brew uninstall --ignore-dependencies --force libxdmcp + brew uninstall --ignore-dependencies --force libxau - name: Install X11 dependencies on MacOS env: From 3979cdd60dfe289cb5fd84af28ed8baff7d4bb60 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 6 May 2024 22:57:16 -0700 Subject: [PATCH 46/47] Update config.guess, config.sub to current GNU versions (#500) --- bin/config.guess | 1239 +++++++++++++++++++++++++--------------------- bin/config.sub | 310 ++++++++---- 2 files changed, 897 insertions(+), 652 deletions(-) diff --git a/bin/config.guess b/bin/config.guess index 9aff91cf..f6d217a4 100755 --- a/bin/config.guess +++ b/bin/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2020 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. -timestamp='2020-08-17' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -27,17 +29,25 @@ timestamp='2020-08-17' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of the system \`$me' is run on. +Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit @@ -50,13 +60,13 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2020 Free Software Foundation, Inc. +Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" -Try \`$me --help' for more information." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -84,13 +94,16 @@ if test $# != 0; then exit 1 fi +# Just in case it came from the environment. +GUESS= + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. @@ -102,7 +115,7 @@ set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || @@ -112,7 +125,7 @@ set_cc_for_build() { ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" + CC_FOR_BUILD=$driver break fi done @@ -133,40 +146,57 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -178,12 +208,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; @@ -192,13 +222,13 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; @@ -219,7 +249,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` @@ -230,7 +260,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; @@ -241,51 +271,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; *:OS108:*:*) - echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; *:Twizzler:*:*) - echo "$UNAME_MACHINE"-unknown-twizzler - exit ;; + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -299,7 +335,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -336,68 +372,69 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 @@ -406,47 +443,50 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -456,41 +496,41 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -518,29 +558,29 @@ EOF dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -549,44 +589,45 @@ EOF if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build @@ -603,16 +644,16 @@ EOF EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then @@ -621,48 +662,48 @@ EOF IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 @@ -729,12 +770,12 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -764,36 +805,36 @@ EOF EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -801,17 +842,18 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -819,112 +861,153 @@ EOF -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi - exit ;; + ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-pc-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix - exit ;; + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -937,60 +1020,72 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 @@ -1035,123 +1130,135 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) set_cc_for_build + CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_X32 >/dev/null - then - LIBCABI="$LIBC"x32 - fi + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac fi - echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" - exit ;; + GUESS=$CPU-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility + # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1159,12 +1266,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1174,11 +1281,11 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1186,31 +1293,31 @@ EOF # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1235,116 +1342,119 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then - echo mips-nec-sysv"$UNAME_RELEASE" + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; arm64:Darwin:*:*) - echo aarch64-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in @@ -1380,109 +1490,122 @@ EOF # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - # shellcheck disable=SC2154 - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; *:Unleashed:*:*) - echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" </dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. @@ -1622,7 +1745,7 @@ test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 + echo "Invalid configuration '$1': more than four components" >&2 exit 1 ;; *-*-*-*) @@ -134,7 +145,8 @@ case $1 in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; @@ -163,6 +175,10 @@ case $1 in basic_machine=$field1 basic_os=$field2 ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ @@ -922,11 +938,13 @@ case $basic_machine in *-*) # shellcheck disable=SC2162 + saved_IFS=$IFS IFS="-" read cpu vendor <&2 + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 exit 1 ;; esac @@ -1278,34 +1287,45 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if test x$basic_os != x +if test x"$basic_os" != x then -# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. +obj= case $basic_os in gnu/linux*) kernel=linux - os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'` + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto - os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'` + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 + saved_IFS=$IFS IFS="-" read kernel os <&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; *) - echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. -case $kernel-$os in - linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) +case $kernel-$os-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) ;; - -dietlibc* | -newlib* | -musl* | -uclibc* ) + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. - echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; - kfreebsd*-gnu* | kopensolaris*-gnu*) + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 ;; - nto-qnx*) + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) ;; - *-eabi* | *-gnueabi*) + os2-emx-) ;; - -*) + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) # Blank kernel with real OS is always fine. ;; - *-*) - echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac @@ -1840,7 +1960,7 @@ case $vendor in ;; esac -echo "$cpu-$vendor-${kernel:+$kernel-}$os" +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: From de361e0258afa77e46afad5a90fc874bb0a95eea Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 6 May 2024 22:57:39 -0700 Subject: [PATCH 47/47] IPv4 host network addresses convert with htonl() not htons() (#501) --- src/inet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/inet.c b/src/inet.c index ecdbab6c..1526a572 100644 --- a/src/inet.c +++ b/src/inet.c @@ -26,6 +26,7 @@ #include #include #include +/* if using inet_ntop you must #include */ #endif /* DOS */ #if (defined(OS5) || defined(__CYGWIN__)) && !defined(O_ASYNC) @@ -93,7 +94,8 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li LispStringToCString(nameConn, namestring, 100); host = gethostbyname(namestring); if (!host) return (NIL); - N_ARITH_SWITCH(ntohl(*(long *)host->h_addr)); + res = ntohl(*(in_addr_t *)host->h_addr); + N_ARITH_SWITCH(res); break; case TCPservicelookup: @@ -120,7 +122,7 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li case TCPconnect: /* args: hostname or (fixp)address, socket# */ memset(&farend, 0, sizeof farend); N_GETNUMBER(nameConn, res, string_host); - farend.sin_addr.s_addr = htons(res); + farend.sin_addr.s_addr = htonl(res); goto host_ok; string_host: LispStringToCString(nameConn, namestring, 100);