From be7c7903b63c0270977c8dd841fe0eeba7320a96 Mon Sep 17 00:00:00 2001 From: Nayu Date: Sun, 9 Jun 2024 03:59:44 +0200 Subject: [PATCH] On macOS, don't build native GUI if XCode is not installed. MacOS has two way to install tools you need to develop (make, git, cc, ...). Either install Xcode or something called Command Line Tools. But the Command Line Tools version doesn't include all the necessary programs to build Apple applications. For example xcodebuild, which if invoked without XCode installed will tell that xcode is not installed and exit with an non 0 exit code. --- src/Makefile.OCaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml index 3e2fdc3e3..a671951e6 100644 --- a/src/Makefile.OCaml +++ b/src/Makefile.OCaml @@ -70,9 +70,17 @@ else $(info GUI library lablgtk not found. GTK GUI will not be built.) endif + +# If XCode is not installed, xcodebuild is just a placeholder telling that XCode is not installed +# and any invocation of xcodebuild results in a non 0 exit code. .PHONY: macuimaybe ifeq ($(OSARCH), Darwin) - macuimaybe: macui + ifeq ($(shell xcodebuild -version > /dev/null; echo $$?), 0) + macuimaybe: macui + else + macuimaybe: + $(info Not building macOS native GUI because XCode is not installed.) + endif else macuimaybe: $(info Not on macOS. macOS native GUI will not be built.)