Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Licensing

PureDarwin doesn’t have a single licence. It’s Apple’s open source, mostly under the Apple Public Source License, mixed with code from FreeBSD, Haiku, Cocotron, NeoDarwin, LLVM and other projects, plus the code we’ve written ourselves. That’s normal for a system built this way, but it means there’s no one answer to “what licence is PureDarwin under”, and anyone who packages or shares it needs the detail.

This page is a guide and isn’t legal advice. The licence of a file is the one stated in that file, in its SPDX line and copyright notice. NOTICE in the repository describes the whole tree, and nothing on this page changes the licence of any file.

PureDarwin’s Own Code

New code written for PureDarwin is, as a rule, under “MPL-2.0 OR BSD-2-Clause”. You may use it under either licence. Code added inside a component that has its own licence takes that component’s licence. The project’s BSD-style licence text is PUREDARWIN_LICENSE.txt in the repository.

This describes the project’s practice, and the notice in each file still decides its licence.

The Broad Shape

AreaUsually
src/Kernel/xnu, Apple’s kextsAPSL 2.0, Apple’s sources
src/Libraries/libSystem, objc4APSL 2.0
src/Libraries/libcxx, libcxxabi, libunwind, llvm-libcApache 2.0 with the LLVM exception
src/Libraries/mDNSResponderMostly Apache 2.0
src/Frameworks/CoreFoundationApache 2.0, from Apple’s Swift releases
src/Frameworks/FoundationMPL 2.0
src/Frameworks/AppKit, CoreGraphics, Onyx2D, CoreDataMIT, from Cocotron, with PureDarwin’s additions under PureDarwin’s licence
src/Userspace BSD commandsBSD licences, from FreeBSD and NetBSD
src/Kernel/fbsdkpi and the FreeBSD driversBSD from FreeBSD, MIT from Haiku
external/corecryptoMPL 2.0
ext4, libDER and other PureDarwin codeMPL-2.0 OR BSD-2-Clause

XPC as an Example

src/Libraries/XPC shows why one answer doesn’t work, because it’s one directory with parts under different licences:

PartLicence
libinfo, notifyAPSL 2.0, from Apple
launchd, launchctlAPSL 2.0
libnvBSD-2-Clause, from FreeBSD
libxpcBSD-2-Clause, from NextBSD

Putting code with different licences in one directory doesn’t give it a shared licence. Each part keeps its own.

GPL Code

Some kernel files are offered by their authors under a choice of licences, such as “GPL-2.0 OR BSD-3-Clause”. We use them under the permissive choice.

The Linux GPU drivers in drm-kmod are GPL only. The build fetches them and builds them as optional kernel extensions, which keeps GPL code out of PureDarwin’s sources. Anyone who distributes those extensions, or an image that includes them, has to decide for themselves whether that’s compatible with the GPL and the other licences.

The same idea applies elsewhere. fbDOOM is GPL, so it’s kept outside the tree and built only when asked for. Keeping it optional means the default build has one less licence to think about.

Published Is Not the Same as Licensed

Some source Apple has published carries no usable licence. The pattern is a repository where only some files have a licence header and there’s no licence for the repository as a whole. The files without a header then have no licence at all.

CommonCrypto is one example. Nearly all of Apple’s published CommonCrypto carries the APSL, but a few files had no licence. We rewrote those from their public interfaces. Apple’s libDER had the same gap, so we wrote our own libDER.

Check licences file by file before you build a port around an Apple component. Finding out late is expensive, because by then somebody has read the code.

Credit

Licences decide what you must do. Credit is a separate question, and we hold ourselves to the same rule we ask of anyone who builds on our work:

  • Keep every copyright notice, licence notice and SPDX line in the files you take.
  • Say plainly, wherever you describe your work, what you took from other projects and what you wrote yourself.
  • Don’t describe someone else’s work as your own, in code or in announcements.

The Credits page is how we do this for our own sources. The rule for forks is in Contributing.

Contributing Code

What the project can accept, and the rules for writing drivers from datasheets, are in Contributing and in CONTRIBUTING.md. Every contribution has to be yours to give under a compatible licence, and code whose licence is unknown can’t be accepted or even looked at.