Revision: 552 http://trac.macosforge.org/projects/darwinbuild/changeset/552 Author: wsiegrist@apple.com Date: 2009-09-03 19:33:07 -0700 (Thu, 03 Sep 2009) Log Message: ----------- First pass at replacing chroots for Xcode projects with a Platform/SDK. The darwinbuild script looks to be getting it right, but the platform still needs some additional pieces. Modified Paths: -------------- trunk/darwinbuild/Makefile trunk/darwinbuild/darwinbuild.in trunk/darwinbuild/installXcode.in Added Paths: ----------- trunk/darwinbuild/Info.plist trunk/darwinbuild/SDKSettings.plist trunk/darwinbuild/installXcode32.in Removed Paths: ------------- trunk/darwinbuild/installXcode32 Added: trunk/darwinbuild/Info.plist =================================================================== --- trunk/darwinbuild/Info.plist (rev 0) +++ trunk/darwinbuild/Info.plist 2009-09-04 02:33:07 UTC (rev 552) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>org.macosforge.darwinbuild.platforms.%%PLATFORM%%</string> + <key>CFBundleName</key> + <string>%%PLATFORM%% SDKs</string> + <key>CFBundleShortVersionString</key> + <string>1</string> + <key>Description</key> + <string>%%PLATFORM%%</string> + <key>FamilyIdentifier</key> + <string>%%PLATFORM%%</string> + <key>FamilyName</key> + <string>%%PLATFORM%%</string> + <key>Identifier</key> + <string>org.macosforge.darwinbuild.platforms.%%PLATFORM%%</string> + <key>Name</key> + <string>%%PLATFORM%%</string> + <key>Type</key> + <string>Platform</string> + <key>Version</key> + <string>1</string> +</dict> +</plist> Modified: trunk/darwinbuild/Makefile =================================================================== --- trunk/darwinbuild/Makefile 2009-09-02 18:29:32 UTC (rev 551) +++ trunk/darwinbuild/Makefile 2009-09-04 02:33:07 UTC (rev 552) @@ -9,7 +9,8 @@ darwinmaster.sh \ packageRoots.sh \ thinPackages.sh \ - installXcode + installXcode \ + installXcode32 all: manifest prefixes @@ -33,6 +34,8 @@ $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode3 $(DATDIR) $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode31 $(DATDIR) $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode32 $(DATDIR) + $(INSTALL) $(INSTALL_DOC_FLAGS) Info.plist $(DATDIR) + $(INSTALL) $(INSTALL_DOC_FLAGS) SDKSettings.plist $(DATDIR) $(INSTALL) $(INSTALL_EXE_FLAGS) createChroot $(DATDIR) $(INSTALL) $(INSTALL_EXE_FLAGS) $(OBJROOT)/manifest $(DATDIR) @@ -53,6 +56,8 @@ rm -f $(DATDIR)/installXcode3 rm -f $(DATDIR)/installXcode31 rm -f $(DATDIR)/installXcode32 + rm -f $(DATDIR)/Info.plist + rm -f $(DATDIR)/SDKSettings.plist rm -f $(DATDIR)/createChroot rm -f $(DATDIR)/manifest rm -f $(DATDIR)/ditto Added: trunk/darwinbuild/SDKSettings.plist =================================================================== --- trunk/darwinbuild/SDKSettings.plist (rev 0) +++ trunk/darwinbuild/SDKSettings.plist 2009-09-04 02:33:07 UTC (rev 552) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CanonicalName</key> + <string>%%PLATFORM%%</string> + <key>DefaultProperties</key> + <dict> + <key>MACOSX_DEPLOYMENT_TARGET</key> + <string>10.6</string> + <key>PLATFORM_NAME</key> + <string>%%PLATFORM%%</string> + </dict> + <key>DisplayName</key> + <string>%%PLATFORM%%</string> + <key>MaximumDeploymentTarget</key> + <string>10.6</string> + <key>MinimalDisplayName</key> + <string>10.6</string> + <key>MinimumSupportedToolsVersion</key> + <string>3.2</string> + <key>Version</key> + <string>10.6</string> + <key>isBaseSDK</key> + <string>YES</string> +</dict> +</plist> Modified: trunk/darwinbuild/darwinbuild.in =================================================================== --- trunk/darwinbuild/darwinbuild.in 2009-09-02 18:29:32 UTC (rev 551) +++ trunk/darwinbuild/darwinbuild.in 2009-09-04 02:33:07 UTC (rev 552) @@ -497,15 +497,6 @@ REAL_OBJROOT="$BuildRoot/$vartmp/$projnam/$project.obj" REAL_SYMROOT="$BuildRoot/$vartmp/$projnam/$project.sym" REAL_DSTROOT="$BuildRoot/$vartmp/$projnam/$project.root" -if [ "$CHROOTED" == "YES" ]; then - prefix="$BuildRoot" -else - prefix="" -fi -export SRCROOT="${REAL_SRCROOT/$prefix/}" -export OBJROOT="${REAL_OBJROOT/$prefix/}" -export SYMROOT="${REAL_SYMROOT/$prefix/}" -export DSTROOT="${REAL_DSTROOT/$prefix/}" if [ "$nosource" != "YES" ]; then ### @@ -600,10 +591,11 @@ ### ### Look for the build tool: make, xcodebuild ### - numfiles=$(echo *.pbxproj *.pbproj *.xcode *.xcodeproj 2> /dev/null ) if [ -n "$numfiles" ]; then buildtool="xcodebuild" + # we use a platform/sdk instead of chrooting for Xcode projects + export CHROOTED="NO" else buildtool="make" fi @@ -616,7 +608,11 @@ ### ### Also install CoreOSMakefiles and Perl for make based projects ### -if [ "$CHROOTED" == "YES" -a "$noload" != "YES" ]; then +if [ "$CHROOTED" == "YES" -o $buildtool == "xcodebuild" ]; then + chroot_or_xcode="YES" +fi + +if [ $chroot_or_xcode == "YES" -a "$noload" != "YES" ]; then echo "*** Installing Roots ..." receipts="$BuildRoot/usr/local/darwinbuild/receipts" mkdir -p "$receipts" @@ -659,6 +655,7 @@ if [ "$buildtool" == "xcodebuild" -a ! -f "$receipts/xcodebuild" ]; then echo "*** Installing Xcode Tools ..." "$DATADIR/installXcode" "$BuildRoot" + platform=$(cat "${DARWIN_BUILDROOT}/.build/platform") touch "$receipts/xcodebuild" fi @@ -679,6 +676,16 @@ TRACELOG="$BuildRoot/private/var/tmp/$projnam/$project.trace~$build_version" mkdir -p "$DARWIN_BUILDROOT/Logs/$projnam" +if [ "$CHROOTED" == "YES" ]; then + prefix="$BuildRoot" +else + prefix="" +fi +export SRCROOT="${REAL_SRCROOT/$prefix/}" +export OBJROOT="${REAL_OBJROOT/$prefix/}" +export SYMROOT="${REAL_SYMROOT/$prefix/}" +export DSTROOT="${REAL_DSTROOT/$prefix/}" + # Hide this variable from the unset export -n SRCROOT OBJROOT SYMROOT DSTROOT export -n DARWIN_BUILDROOT DARWINBUILD_BUILD DARWINXREF_DB_FILE @@ -699,12 +706,6 @@ export CHROOTED export PATH=/bin:/sbin:/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin - -# sets the install path to xcode tools if we're chrooted -if [ "$CHROOTED" == "YES" ]; then - export DEVELOPER_DIR="/XCD/loper" -fi - export SHELL="/bin/sh" export HOME="/var/root" export LOGNAME="root" @@ -713,7 +714,7 @@ build_string="" if [ "$buildtool" == "xcodebuild" -a "$target" != "" ]; then - build_string="-target $target" + build_string="-sdk $platform -target $target" elif [ "$target" != "" ]; then action="$target" fi @@ -923,9 +924,8 @@ ### ### Actually invoke the build tool here ### - chroot -u root -g wheel $BuildRoot $vartmp/$projnam/build-$project~$build_version.sh 2>&1 | tee -a "$LOG" + chroot -u root -g wheel $BuildRoot $vartmp/$projnam/build-$project~$build_version.sh 2>&1 | tee -a "$LOG"; EXIT_STATUS="${PIPESTATUS[0]}" - else ### ### Actually invoke the build tool here Modified: trunk/darwinbuild/installXcode.in =================================================================== --- trunk/darwinbuild/installXcode.in 2009-09-02 18:29:32 UTC (rev 551) +++ trunk/darwinbuild/installXcode.in 2009-09-04 02:33:07 UTC (rev 552) @@ -10,7 +10,12 @@ then if [ "$VER" -gt "1000" ]; then - "$BINDIR/installXcode31" "$BROOT"; + if [ "$VER" -gt "1600" ]; + then + "$BINDIR/installXcode32" "$BROOT"; + else + "$BINDIR/installXcode31" "$BROOT"; + fi else "$BINDIR/installXcode3" "$BROOT"; fi Deleted: trunk/darwinbuild/installXcode32 =================================================================== --- trunk/darwinbuild/installXcode32 2009-09-02 18:29:32 UTC (rev 551) +++ trunk/darwinbuild/installXcode32 2009-09-04 02:33:07 UTC (rev 552) @@ -1,255 +0,0 @@ -#!/bin/sh - -FORCE="YES" - -XCODEBUILD=/Developer/usr/bin/xcodebuild -BUILDROOT="$1" - -EXTRACOPY=( \ - /usr/lib/dyld \ - /usr/share/icu \ - /Developer/Private \ - /Developer/Tools \ - /usr/bin/xcodebuild \ - /usr/bin/xcode-select \ - /Developer/Library/version.plist \ - /Developer/usr/bin/xcodebuild) - -BINSYMLINKS=( \ - cc \ - dsymutil \ - gcc \ - gcc-4.0 \ - gcc-4.2 \ - gcov \ - gcov-4.0 \ - gcov-4.2 \ - g++ \ - g++-4.0 \ - g++-4.2 \ - lex \ - libtool \ - mig \ - ranlib \ - strip \ - yacc) - -LIBEXECLINKS=( \ - migcom) - -RPATH=/Developer/Library/PrivateFrameworks - -if [ -z "$BUILDROOT" ]; then - echo "Usage: $0 <BuildRoot>" 1>&2 - exit 1 -fi - -mkdir -p "$BUILDROOT" - -### -### Symlink opensource binaries used by Xcode to /usr/bin -### so the opensource-built binary can be used instead -### of the one that ships with Xcode -### -SymlinkBinaries() { - echo "Creating symlinks for binaries ..." - - BIN_DIR="$BUILDROOT/XCD/loper/usr/bin/" - mkdir -p $BIN_DIR - pushd $BIN_DIR > /dev/null - for B in "${BINSYMLINKS[@]}"; do - ln -s "/usr/bin/$B" "$B" - done - popd > /dev/null - - LIBEXEC_DIR="$BUILDROOT/XCD/loper/usr/libexec/" - mkdir -p $LIBEXEC_DIR - pushd $LIBEXEC_DIR > /dev/null - for L in "${LIBEXECLINKS[@]}"; do - ln -s "/usr/libexec/$L" "$L" - done - popd > /dev/null - - -} - -### -### Load opensource binaries if they dont exist so we can symlink to them -### -LoadBinaries() { - echo "Loading binaries ..." - if [ ! -f "$BUILDROOT/usr/bin/gcc" ]; then - darwinbuild -load gcc - fi - if [ ! -f "$BUILDROOT/usr/bin/gcc-4.2" ]; then - darwinbuild -load gcc_42 - fi -} - -### -### Recurse through frameworks and libraries looking for dependencies -### -RecurseLibs() { - echo $1 >> /tmp/installXcode.seen.$$ - otool -L $1 | tail -n +2 | awk '{ print $1 }' > /tmp/installXcode.tmplibs.$$ - sed -e s,@rpath,${RPATH}, < /tmp/installXcode.tmplibs.$$ > /tmp/installXcode.outlibs.$$ - cat /tmp/installXcode.outlibs.$$ >> /tmp/installXcode.libs.$$ - cat /tmp/installXcode.outlibs.$$ | while read X; do - if ! grep -q "^$X\$" /tmp/installXcode.seen.$$ ; then - RecurseLibs $X - fi - done -} - -RemoveTemps() { - rm -f /tmp/installXcode.libs.$$ - rm -f /tmp/installXcode.outlibs.$$ - rm -f /tmp/installXcode.seen.$$ - rm -f /tmp/installXcode.tmplibs.$$ - rm -f /tmp/installXcode.tmpfiles.$$ - rm -f /tmp/installXcode.files.$$ -} - -AppendExtraFiles() { - for X in "${EXTRACOPY[@]}"; do - echo "$X" >> /tmp/installXcode.libs.$$ - done -} - -TransformLibs() { -# set -x - while read X; do - NEWX=$(echo $X | sed -n 's/\(.*\.framework\).*/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a framework binary, copy the entire bundle - echo "$NEWX" - continue - fi - - NEWX=$(echo $X | sed -n 's/\([^.]*\)\..*dylib$/\1/p') - if [ -n "$NEWX" ]; then - # if we're copying a dylib, copy associate symlinks and stuff - for Y in "$NEWX"*.dylib; do - echo "$Y" - done - continue - fi - - echo "$X" - done -# set +x -} - -GenerateFileNames() { - cat /tmp/installXcode.libs.$$ | sort -u | TransformLibs | sort -u | while read X; do - # echo adding children for "$X" - - # first mkdir parent directories - PARENT=$(dirname "$X") - while [ "$PARENT" != "/" -a "$PARENT" != "." ]; do - echo ".$PARENT" >> /tmp/installXcode.tmpfiles.$$ - PARENT=$(dirname "$PARENT") - done - find ".$X" \! \( -name \*_debug\* -o -name \*_profile\* -o -path \*/Headers\* -o -path \*/PrivateHeaders\* -o -path \*.dict\* \) >> /tmp/installXcode.tmpfiles.$$ - done - sort -u /tmp/installXcode.tmpfiles.$$ > /tmp/installXcode.files.$$ -} - -CopyFiles() { -# VERBOSECPIO="v" - VERBOSECPIO="" - echo "Copying Xcode and dependencies ..." - - # copy files and use sed to rewrite paths during copy - cpio -o -c < /tmp/installXcode.files.$$ | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - echo "Symlinking for RPATH ..." - # symlink R to @rpath so we can replace uses of @rpath - pushd "$BUILDROOT/XCD" > /dev/null - ln -s loper/Library/PrivateFrameworks R - popd > /dev/null - - echo "Copying Jamfiles ..." - find ".$JAMFILES" | cpio -o -c | \ - sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \ - -e 's,/Developer/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/loper/Library/PrivateFrameworks/DevToolsCore.framework,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - - echo "Copying CoreServices ..." - find ./System/Library/CoreServices/System*.{plist,bundle} \ - ./System/Library/CoreServices/CoreTypes.bundle/ \ - | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - # copy xcode support files such as plugins - # but do not copy svn plugins since they are unecessary - echo "Copying Xcode library support files ..." - find "./Developer/Library/Xcode/" \! -ipath '*subversion*' \ - | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - - # Platform - echo "Copying Mac OS X Platform ..." - find "./Developer/Platforms/MacOSX.platform" | cpio -o -c | \ - sed -e 's,/System,/XCD/SY,g' \ - -e 's,CoreServices/XCD/SY,CoreServices/System,g' \ - -e 's,Resources/XCD/SY,Resources/System,g' \ - -e 's,/usr/lib,/XCD/lib,g' \ - -e 's,/usr/share/icu,/XCD/share/icu,g' \ - -e 's,@rpath,/XCD/R,g' \ - -e 's,/Developer,/XCD/loper,g' \ - -e 's,platform/XCD/loper,platform/Developer,g' | \ - (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d ) - -} - - - -### -### Find all the framework and library dependencies of Xcode build -### For frameworks, copy over all supporting files. -### - -pushd / > /dev/null - -RemoveTemps -touch /tmp/installXcode.seen.$$ -echo Analyzing Xcode dependencies ... -RecurseLibs $XCODEBUILD -AppendExtraFiles -GenerateFileNames -CopyFiles -LoadBinaries -SymlinkBinaries - -popd > /dev/null - -#RemoveTemps - -echo "Completed Xcode installation!" Copied: trunk/darwinbuild/installXcode32.in (from rev 551, trunk/darwinbuild/installXcode32) =================================================================== --- trunk/darwinbuild/installXcode32.in (rev 0) +++ trunk/darwinbuild/installXcode32.in 2009-09-04 02:33:07 UTC (rev 552) @@ -0,0 +1,35 @@ +#!/bin/sh + +FORCE="YES" +XCODEBUILD=/Developer/usr/bin/xcodebuild +BUILDROOT="$1" +DBROOT=$(dirname $BUILDROOT) +PLATFORMDIR="${DBROOT}/Platform" +STAMP=$(date +%Y%m%d%H%M%S) +BUILD=$(cat $DBROOT/.build/build) +PLATFORM="Darwinbuild_${BUILD}_${STAMP}" +INFOPLIST=%%PREFIX%%/share/darwinbuild/Info.plist +SDKPLIST=%%PREFIX%%/share/darwinbuild/SDKSettings.plist + +echo $PLATFORM > "${DBROOT}/.build/platform" +echo "Installing Platform/SDK $PLATFORM for Xcode 3.2" + +mkdir -p "${PLATFORMDIR}/Developer/SDKs" + +sed -e "s,%%PLATFORM%%,${PLATFORM}," $INFOPLIST > "${PLATFORMDIR}/Info.plist" +sed -e "s,%%PLATFORM%%,${PLATFORM}," $SDKPLIST > "${BUILDROOT}/SDKSettings.plist" + +pushd "${PLATFORMDIR}/Developer" > /dev/null +ln -s ../../BuildRoot/usr/ usr +popd > /dev/null + +pushd "${PLATFORMDIR}/Developer/SDKs" > /dev/null +ln -s ../../../BuildRoot/ "${PLATFORM}.sdk" +popd > /dev/null + +pushd "/Developer/Platforms" > /dev/null +ln -s "$PLATFORMDIR" "${PLATFORM}.platform" +popd > /dev/null + +echo "Completed Platform/SDK install" +