From 68d7908ee651d05bd2dfeddd0eaea2f73bdff8f3 Mon Sep 17 00:00:00 2001 From: Alex Segura <34669489+alex-segura@users.noreply.github.com> Date: Mon, 11 Jan 2021 18:10:57 -0700 Subject: [PATCH] Support building on OpenBSD, x86-64 (#207) * Support building on OpenBSD, x86-64 * Clean up OpenBSD Makefile * Add OpenBSD to cmake build * Use clang as CC for OpenBSD Co-authored-by: Alex Segura --- CMakeLists.txt | 5 ++++ bin/machinetype | 1 + bin/makefile-openbsd.x86_64-x | 52 +++++++++++++++++++++++++++++++++++ inc/version.h | 2 +- 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 bin/makefile-openbsd.x86_64-x diff --git a/CMakeLists.txt b/CMakeLists.txt index d9956f9..9ab4af2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,11 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") "-DFREEBSD" "-DNOFORN" ) +ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + LIST(APPEND MAIKO_DEFINITIONS + "-DOPENBSD" + "-DNOFORN" + ) ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") LIST(APPEND MAIKO_DEFINITIONS "-DAIX" # This is temporary diff --git a/bin/machinetype b/bin/machinetype index 5577b50..8d836e6 100755 --- a/bin/machinetype +++ b/bin/machinetype @@ -20,6 +20,7 @@ case "$os" in x86_64-apple-darwin15*) echo 386 ;; x86_64-*) echo x86_64 ;; powerpc-*) echo ppc ;; + amd64-*) echo x86_64 ;; esac ### Don't leave the variables set. diff --git a/bin/makefile-openbsd.x86_64-x b/bin/makefile-openbsd.x86_64-x new file mode 100644 index 0000000..46f1114 --- /dev/null +++ b/bin/makefile-openbsd.x86_64-x @@ -0,0 +1,52 @@ +# Options for OpenBSD, Intel x86_64 and X-Window + +CC = clang -m64 $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)xmkicon.o \ + $(OBJECTDIR)xbbt.o \ + $(OBJECTDIR)dspif.o \ + $(OBJECTDIR)xinit.o \ + $(OBJECTDIR)xscroll.o \ + $(OBJECTDIR)xcursor.o \ + $(OBJECTDIR)xlspwin.o \ + $(OBJECTDIR)xrdopt.o \ + $(OBJECTDIR)xwinman.o + + +XFLAGS = -I/usr/X11R6/include -DXWINDOW -DNOPIXRECT + +# This is to make the %$#@! Apollo cc happy +OEXT = .o +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 -g3 +DISPOPTFLAGS = -O2 -g3 +FPFLAGS = +DFLAGS = -DOPENBSD -DAIX -DOLD_CURSOR \ + -DBYTESWAP -DFORKCOMM -DNOFORN -DLOGINT $(XFLAGS) \ + -DRELEASE=351 + +LDFLAGS = -L/usr/X11R6/lib -lX11 -lc -lm +LDELDFLAGS = -L/usr/X11R6/lib -lX11 -lc -lm + +INLINE = # $(SRCDIR)dspSPARC.il +BITBLTFILE = # $(OBJECTDIR)bbtSPARC.o +BYTESWAPFILES = $(OBJECTDIR)byteswap.o + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/lde + +############ +# +# SPECIAL xc.o for debugging +# +############ +$(OBJECTDIR)xc.o: $(SRCDIR)xc.c $(INCDIR)lispemul.h $(INCDIR)emlglob.h \ + $(INCDIR)address.h \ + $(INCDIR)adr68k.h $(INCDIR)stack.h $(INCDIR)lspglob.h \ + $(INCDIR)lsptypes.h $(INCDIR)lispmap.h $(INCDIR)cell.h \ + $(INCDIR)initatms.h $(INCDIR)gcdata.h \ + $(INCDIR)arith.h $(INCDIR)stream.h \ + $(INCDIR)tos1defs.h $(INCDIR)tosret.h \ + $(INCDIR)tosfns.h $(INCDIR)inlineC.h + $(CC) $(DISPRFLAGS) -UOPDISP $(SRCDIR)xc.c -I$(INCDIR) -o $(OBJECTDIR)xc.o diff --git a/inc/version.h b/inc/version.h index f918099..f6fee5d 100644 --- a/inc/version.h +++ b/inc/version.h @@ -263,7 +263,7 @@ typedef signed char s_char; /********************************************************/ /* */ /********************************************************/ -#if defined(MACOSX) || defined(FREEBSD) +#if defined(MACOSX) || defined(FREEBSD) || defined(OPENBSD) /* MacOS X, FreeBSD - mostly POSIX-compliant Unix */ typedef signed char s_char; #endif /* MACOSX || FREEBSD */