Annotation of wikisrc/pkgsrc/macos_porting_notes.mdwn, revision 1.2

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

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