[Bug 264195] [cross] Cross-building from macOS improvements for newversh.sh and SDK identification

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 23 May 2022 23:52:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264195

            Bug ID: 264195
           Summary: [cross] Cross-building from macOS improvements for
                    newversh.sh and SDK identification
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: shantonusen@me.com

Created attachment 234167
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=234167&action=edit
macOS cross build improvements

I'm trying to follow the directions at
<https://wiki.freebsd.org/BuildingOnNonFreeBSD>

With

$ MAKEOBJDIRPREFIX=$HOME/Documents/freebsd/obj tools/build/make.py --debug
TARGET=amd64  TARGET_ARCH=amd64  --bootstrap-toolchain buildworld

On my particular setup, I noticed two things:

/Users/shantonu/Documents/freebsd/src/sys/conf/newvers.sh: line 138: return:
can only `return' from a function or sourced script
/Applications/Xcode.app/Contents/Developer/usr/bin/make: invalid option -- V
Usage: make [options] [target] ...
Options:
...
bmake[2]: "/Users/shantonu/Documents/freebsd/src/tools/build/Makefile" line 37:
You must install the macOS SDK (try xcode-select --install)

bmake[2]: stopped in /Users/shantonu/Documents/freebsd/src/tools/build
*** Error code 1


The first issue looks like non-POSIX shell usage which adds a bunch of noise at
the top of the build log. The second issue might be a me-specific issue that
can be improved  through the use of "xcrun -sdk macosx -show-sdk-path" to find
the macOS SDK, instead of having to hardcode paths for the command-line tools
install vs. Xcode from the Mac App Store.

I've attached a diff that fixes both these issues.

-- 
You are receiving this mail because:
You are the assignee for the bug.