[darwinbuild-dev] Modifying build dependencies, + more questions

William Siegrist wsiegrist at apple.com
Wed Jan 6 13:50:24 PST 2010

On Jan 6, 2010, at 1:12 PM, Thomas Engelmeier wrote:

> Am 06.01.2010 um 20:13 schrieb William Siegrist:
> Hi Bill, 
> thanks for your help. The Tokend build process works far better than last year.
>>> Q1: I extended the 10A432.plist with the additional dependency, but it does not seem the get read with a simple "darwinbuild Tokend".
>>> I need additionally CoreServices.framework. How can I force re-reading of the 10A432.plist? darwinxref? 
>> You should create a new plist that inherits from one of the provided plists (see 10B504.plist for how it inherits fro 10A432.plist). Then just add the differences to your plist. In order to see CoreServices.framework during the build, you need to pass the "-nochroot" option to darwinbuild (which means nothing in BuildRoot will be used) or copy CoreServices.framework into your BuildRoot/ (this is the best approach).  If you need to reload a plist, use "darwinxref loadIndex <path-to-plist>". 
> OK, do I understand correctly that there is no root for CoreServices.framework? And copying to BuildRoot means (in the case of an "default" inited build-system copying to /Volumes/BuildRoot_10A432_{someHash}/System/Library/Frameworks/ ?

CoreServices is not open source, so you have to copy it from your own copy of Mac OS X.

As far as where darwinbuild puts things, the directory you run "darwinbuild -init" in is usually referred to as your "darwinbuild environment". It has several subdirectories for storing roots, tarballs, etc. The metadata is under the .build/ directory if you want to dig into the internals. When you build a project, the build process happens in the "build root", which is the BuildRoot/ directory. That root is analogous to "/" of a Mac OS X system, so you'll find /System and /Applications there, etc.  The source you build from is copied from a tarball in Sources/ into BuildRoot/SourceCache/ and the working root directories (OBJROOT, SYMROOT, etc) are under BuildRoot/var/tmp/.

Now, depending on options you passed to "darwinbuild -init", you have 1 of three storage types for the BuildRoot. If you passed no options, you get the default "sparse disk image" storage, which means there is a .build/buildroot.sparsebundle disk image that gets mounted on demand. The name of the volume when it mounts is what you mentioned,  BuildRoot_<build>_<timestamp>. We then add a symlink from BuildRoot/ to this volume. If you reboot, the disk image will need to be remounted, but running any darwinbuild command should trigger the on-demand remount. If it doesn't, or you find it is not sufficient, file a bug. 

The next storage option is "nfs loopback" (darwinbuild -init -nfs) for people who don't want to use a diskimage, which sets up an NFS export and mounts it from localhost. And finally, if you use the "-nodmg" option, BuildRoot/ is just a regular directory.  The reason why the sparse disk image is the default is it used to work around a bug in Xcode, but we kept it as the default since having things neatly packaged in a disk image was deemed useful. 

So bottom line, I recommend you copy CoreServices.framework into BuildRoot/System/Library/Framework. For extra safely and sanity, I recommend you use darwinup to install it so you can easily track and uninstall it later. Once you successfully build your new tokend, use "/usr/local/share/darwinbuild/packageRoots" to generate a tarball of the Tokend root. Then you can use darwinup to install that tarball onto your real system. If you get into trouble, boot onto another partition and use darwinup to uninstall your Tokend. Look for the "-p" option in darwinup. 


More information about the darwinbuild-dev mailing list