Prefix/Darwin

From Gentoo Wiki
< Prefix
Jump to:navigation Jump to:search

Prefix/Darwin brings the power of Gentoo to Darwin (macOS/OS X) based systems, similar to pkgsrc, macports, and homebrew.

General

  • macOS follows the normal bootstrap procedure
  • Bootstraps currently done via GCC (DARWIN_USE_GCC=1 is set by default)
    • host/Apple Clang from xcode tools is used then GCC is built as soon as possible
    • Using GCC as the "system" compiler within Prefix has problems
    • We use the system (host) linker because we can't build Apple's linker independently within our prefix without Clang, because it uses Blocks
  • Possibility of bootstrapping via Clang (DARWIN_USE_GCC=0)
    • It's possible but doesn't work yet!
    • Needs some work to get sysroot, SDK paths right. See what e.g. macports does for hints.
    • bug #758167 is the meta bug for this work.
    • Help very much welcome!
      • To attempt a full bootstrap using Clang (this won't work yet, but it'll do something): DARWIN_USE_GCC=0 ./bootstrap-prefix.sh
      • Suggestion: start with trying to build Clang, LLVM, and friends within a fully-built working GCC-bootstrapped Prefix and go from there
      • Suggestion: look at macports patches

Platforms

arm64-macos

M1 macs, etc.

It finally works! But is highly experimental, functionality of anything other than the base system is not guaranteed and will likely have issues. After extensive testing and fixing, arm64-macos can now be bootstrapped. However, support is still highly experimental and the possibility of a regression cannot be ruled out. Thus, a manual bootstrap is recommended. You should be prepared to debug and report any problem should it arise, see Prefix/Manual Bootstrap for more information.

By default, the "stable" snapshot is used, which was previously broken but is now known to work after several fixes. For now, it's recommended to use the default "stable" snapshot. Alternatively, export LATEST_TREE_YES=1 can be used to use the latest code from Portage upstream during bootstrapping. Depending on phase of the moon, export LATEST_TREE_YES=1 may either contain the latest fixes for new problems, or introduce new regressions. To track all the known bootstrap issues on macOS 13, we use "bug #886491 bootstrap-prefix.sh fails with macOS 13 (Ventura)". Make sure to watch it for any further development of the situation.

Again, since it's still highly experimental, unlike ~x64-macos, the vast majority of the packages are currently masked on ~arm64-macos. Almost everything needs to be unmasked manually right now (in case you see a masked package that prevents bootstrap from progressing, please report it at bug #904474).

Finally, the toolchain still needs to be worked on. As of early 2023, we're still waiting for GCC support to be merged upstream and in a release (GCC 12?). We currently use a snapshot from GCC maintainer Iain Sandoe's personal development branch in our scripts as a temporarily solution, see https://github.com/iains/gcc-darwin-arm64 - all ARM64 macOS systems use this same GCC fork, including nixOS and Homebrew. Furthermore, sys-devel/binutils-apple fails to build, so the linker from the host is used for now.

x64-macos

Historically works okay, with a mature set of packages with the ~x64-macos keyword.

But as of macOS 13, there were several problems. As of June 2023, all problems are believed to be fixed, and the bootstrap should work as expected by now.

To track all the known bootstrap issues on macOS 13, we use "bug #886491 bootstrap-prefix.sh fails with macOS 13 (Ventura)". Make sure to watch it for any further development of the situation.

ppc-macos

Still somewhat supported as the supported OS versions age. But it's likely untested for a long time, not for the faint-hearted. Recommended only for experienced Gentoo users, be prepared to report and debug problems on the go.

Non-platforms

x86-macos

Support was dropped recently due to lack of interest, but could be restored with a sponsor/cheerleader.