From e074699bebaeea7013032324c841b63d92a90040 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Sat, 18 Feb 2023 22:44:26 -0800 Subject: [PATCH] Add extra arg to makeright to allow choice of arm64 or x64 on Darwin (MacOS) platform. Enables cross-compiles bertween x64 and arm64 Macs. --- bin/makefile-darwin.aarch64-x | 4 ++-- bin/makefile-darwin.x86_64-x | 3 ++- bin/makeright | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/bin/makefile-darwin.aarch64-x b/bin/makefile-darwin.aarch64-x index a92219f..0d513bd 100644 --- a/bin/makefile-darwin.aarch64-x +++ b/bin/makefile-darwin.aarch64-x @@ -1,6 +1,6 @@ -# Options for MacOS, x86 processor, X windows +# Options for MacOS, arm64 (aka aarch64) processor, X windows -CC = clang $(CLANG_CFLAGS) +CC = clang -target arm64-apple-darwin13 $(CLANG_CFLAGS) XFILES = $(OBJECTDIR)xmkicon.o \ $(OBJECTDIR)xbbt.o \ diff --git a/bin/makefile-darwin.x86_64-x b/bin/makefile-darwin.x86_64-x index e17f10b..46cad50 100644 --- a/bin/makefile-darwin.x86_64-x +++ b/bin/makefile-darwin.x86_64-x @@ -1,6 +1,6 @@ # Options for MacOS, x86 processor, X windows -CC = clang -m64 $(CLANG_CFLAGS) +CC = clang -target x86_64-apple-darwin13 $(CLANG_CFLAGS) XFILES = $(OBJECTDIR)xmkicon.o \ $(OBJECTDIR)xbbt.o \ @@ -26,3 +26,4 @@ LDELDFLAGS = -L/opt/X11/lib -lX11 -lm OBJECTDIR = ../$(RELEASENAME)/ default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex + diff --git a/bin/makeright b/bin/makeright index 1fde522..e8407a0 100755 --- a/bin/makeright +++ b/bin/makeright @@ -54,9 +54,30 @@ if test $# -gt 0 shift fi +target_arch="$1" + +if test $# -gt 0 + then + shift +fi + architecture=`machinetype` osversion=`osversion` + +if test "$osversion" != "darwin" + then + echo "WARNING: target architecture applies only to the Darwin (MacOS) platform": + echo "Ignoring target architecture argument: $target" +elif test "$target_arch" = "x86_64" + then + architecure=$target_arch +elif test "$target_arch" = "aarch64" + then + architecure=$target_arch +fi + echo "making so far for ${osversion} on ${architecture}." + case "$display" in init) display=single releasename=init-${osversion}.${architecture}