File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / macos_porting_notes.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Fri Apr 8 01:04:07 2022 UTC (4 months, 1 week ago) by schmonz
Branches: MAIN
CVS tags: HEAD
Extract historical notes from pkgsrc/bootstrap/README.macOS.

    1: # Darwin vs macOS
    2: 
    3: macOS consists of Darwin (kernel/userland) plus Mac stuff on top.
    4: pkgsrc used to target Darwin, but given the tools issued discussed
    5: below it is not clear that it works on Darwin without macOS.  Darwin
    6: from Apple is no longer open source.
    7: 
    8: Users of non-macOS Darwin are invited to submit patches to this file.
    9: The only known project is:
   10:   http://www.puredarwin.org/
   11: 
   12: Until then, this file remains macOS-centric.
   13: 
   14: # system tools issues
   15: 
   16: ## native headers vs SDK
   17: 
   18: macOS used to include system headers in /usr/include, so that one
   19: could treat it like a relatively normal POSIX system.  Starting at
   20: approximately 10.9, headers were no longer available at the standard
   21: location, and one has to use an SDK that puts headers someplace else.
   22: pkgsrc supports this, but there has been some confusion where a 10.9
   23: system produced binaries for 10.10, which only mostly works.  The
   24: confusion is believed to be resolved.
   25: 
   26: ### SDK version issues
   27: 
   28: The SDK supported versions and default versions do are not always the
   29: same as the current system version.  The following may be useful in
   30: understanding one's situation:
   31: 
   32:   /usr/bin/xcrun --show-sdk-version
   33:   sw_vers -productVersion
   34: 
   35: pkgsrc attempts to query the system version, and then ask the sdk to
   36: use that version.  See mk/platform/Darwin.mk for the code.
   37: 
   38: ## gcc vs clang
   39: 
   40: Older versions of OS X (when XCode is installed) provided gcc, and
   41: pkgsrc defaulted to using gcc.  With 10.9, gcc is no longer present.
   42: 
   43: ## i386 vs x86_64 ABI issue
   44: 
   45: This entire section is only about Intel Macs.
   46: 
   47: OS X 10.6 and higher supports x86-64 binaries on Intel Macs with
   48: x86-64 processors, which is now most of them.  i386 binaries are also
   49: supported on most (all?) Intel machines.
   50: 
   51: ### issues related to ABI 32 vs 64
   52: 
   53: Note that a pkgsrc package built in x86_64 mode will not run on an
   54: Intel Mac that is i386 only.  For a longer discussion, see:
   55: http://mail-index.NetBSD.org/pkgsrc-users/2009/09/24/msg010817.html
   56: 
   57: Somewhat separately from pkgsrc's ABI choice, there have been issues
   58: with packages which get confused because "MACHINE_ARCH" is in some OS
   59: versions set to "i386" (on a 64-bit system!).  As of 2016 this should
   60: be mostly resolved.
   61:   version:  uname -m : uname -p
   62:   10.6: i386 : i386
   63:   10.9: x86_64 : i386
   64: 
   65: ### default ABI
   66: 
   67: The ABI is chosen at bootstrap time and encoded into mk.conf.  So a
   68: change in the default is about what a new bootstrap will do;
   69: already-bootstrapped systems should remain unchanged.  They should be
   70: able to build and run new packages using the old ABI value.
   71: 
   72: pkgsrc used to set the default ABI as i386, both on systems with i386
   73: processors and on systems with x86_64 processors.  On 2015-11-09 the
   74: default was changed so that ABI=64 is chosen on machines where "uname
   75: -m" reports x86_64.  (It remains i386 on others, which are not capable
   76: of running x86_64 binaries.)
   77: 
   78: Generally, users will not need to deal with the default ABI change,
   79: except that packages are mostly only portable across machines with the
   80: same bootstrapping parameters.
   81: 
   82: If one unpacks a new binary bootstrap kit over an existing
   83: installation, one can end up with a mix. The standard advice is not to
   84: do this, and to rrebuild/reinstall all packages from scratch or a
   85: compatible binary package set.  But, one could also mark packages with
   86: the wrong ABI as rebuild=YES and use pkg_rolling-replace.
   87: 
   88: ### change in storage of ABI information
   89: 
   90: On 2016-01-24, the way ABI information was stored in pkgsrc was
   91: rationalized and simplified.  The new code could compute the wrong ABI
   92: for some previously-bootstrapped installations.  The problem can be
   93: resolved by building bmake with MACHINE_ARCH=x86_64 and updating that
   94: package, as described in mail archives:
   95: 
   96:   https://mail-index.netbsd.org/pkgsrc-users/2016/01/25/msg022870.html
   97: 
   98: (One would expect to be able to use make replace to do this.  One
   99: minor issue is that it requires pkg_tarup, although that will be
  100: present on systems of those who use make replace.  There also may be
  101: an error with architecture mismatch from pkg_install requiring a "-f"
  102: option.  Repeatable data about recovery is somewhat hard to obtain, as
  103: most are past this issue already and no longer interested in
  104: experimenting.)
  105: 
  106: # Developer tools and prerequisites
  107: 
  108: ## XCode
  109: 
  110: This section applies to 10.6 through 11.
  111: 
  112: If you haven't already, you will need to install the macOS
  113: Developer Tools package (XCode) to obtain a compiler, etc.  The
  114: procedure depends on the version of macOS; recent versions use the
  115: App Store.
  116: 
  117: ### Command-line Tools
  118: 
  119: If one installs "Commmand Line Tools", then pkgsrc can use the
  120: compiler.
  121: 
  122: Since Xcode 7 (installed from the Apple Store) the development
  123: environment can upgrade itself without interaction from the user, but
  124: will not automatically update the Command Line Tools.  This will
  125: cause system header files like stdlib.h not to be found by pkgsrc.
  126: The command `xcode-select --install' will install the Command Line
  127: Tools for Xcode.
  128: 
  129: In the past at least, Command Line Tools for Xcode could be obtained
  130: from https://developer.apple.com/downloads/
  131: 
  132: ## cvs
  133: 
  134: Note that as of 10.9, cvs is no longer provided by Apple.  You can build
  135: devel/scmcvs.  To obtain pkgsrc in order to bootstrap and build cvs,
  136: it may be useful to `git clone https://github.com/NetBSD/pkgsrc.git`.
  137: 
  138: ## X11
  139: 
  140: X11 used to be built into macOS, but as of 10.8 it is no longer
  141: included.  You can install XQuartz from
  142: https://www.xquartz.org, or try the newly-added pkgsrc
  143: version.
  144: 
  145: # macOS Versions
  146: 
  147: Because Apple drops support for previous hardware faster than the
  148: hardware fails, many machines cannot be upgraded to recent versions of
  149: macOS, creating a greater than usual desire to support old systems.
  150: Because of the particular history of deprecation, most systems tend to
  151: run relatively recent versions or specific older versions.
  152: 
  153: The stance of pkgsrc is generally to avoid breaking older systems
  154: unless keeping support would cause difficulty, and to accept clean
  155: patches when there is no harm to non-deprecated versions.  This
  156: section is partly to document what versions tend to be used and why,
  157: and partly to enable cleaning up bug reports without fixes for very
  158: old systems.
  159: 
  160: pkgsrc PRs about 10.12 or older that do not contain fixes may be closed
  161: without fixing.
  162: 
  163: macOS 11 (major versions are now just digits) is the current version;
  164: hardware before 2013 cannot be upgraded to this version. Also this
  165: version introduces support for Apple M1 processors, using the aarch64
  166: instruction set.
  167: 
  168: macOS 10.15 is maintained and supports the same hardware as 10.14.
  169: 
  170: macOS 10.14 is somewhat old but still maintained.  It cannot be run on
  171: hardware before 2012 and Macbooks before 2015.
  172: 
  173: macOS 10.13 is old; Apple ended support in January of 2021.
  174: Significant amounts of entirely functional hardware cannot be upgraded
  175: beyond this version.
  176: 
  177: macOS 10.12 is very old.  There is no known reason to run it, as all
  178: (most?) hardware that runs 10.12 can run 10.13.
  179: 
  180: OS X 10.11 is very old; some hardware cannot be upgraded beyond this
  181: version, but most of it is old and slow, dating from approximately
  182: 2010 or earlier.
  183: 
  184: OS X 10.10, 10.9 and 10.8 are extremely old; most hardware that can
  185: run them can probably run 10.11.
  186: 
  187: OS X 10.7 is the last version that works on a few Intel Macs, e.g. the
  188: Mac Pro 1.1 and 2.1 and some Mac Minis.
  189: 
  190: OS X 10.6 is the last version that works on Intel Macs lacking amd64
  191: support, e.g. Mac Minis and Macbooks with Core Duo.
  192: 
  193: OS X 10.5 is the last version that works on PowerPC Macs.
  194: 
  195: OS X 10.4 (Darwin 8.11.0) is the last version that works on PowerPC G3
  196: and slower G4 Macs.
  197: 
  198: # Bulk builds
  199: 
  200: Clearly, it is desirable for a bulk build to be useful on as many
  201: computers as possible.  The main issues are which ABI and which macOS
  202: version.  Targeting older versions makes a build run on more systems,
  203: and targeting newer versions makes the build closer to what would be
  204: obtained from bootstrapping on a newer version and thus avoids some
  205: issues.   This section has pointers to active bulk builds.
  206: 
  207: ## 10.4, --abi=32 powerpc, gcc
  208: 
  209: Sevan Janiyan <Sevan@NetBSD.org> provides a bulk build for the -current branch
  210: (--abi=32, OS X 10.4/PowerPC, gcc 4.0.1 from Xcode 2.5, X11_TYPE=modular):
  211:   https://www.geeklan.co.uk/?p=1579
  212:   US repo: http://sevan.mit.edu/packages
  213:   Euro mirror: http://pkgsrc.geeklan.co.uk/packages/current/Darwin-8
  214:   See
  215:   https://mail-index.netbsd.org/pkgsrc-bulk/2015/11/07/msg012171.html

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb