[darwinbuild-changes] [383] trunk/darwinbuild
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 16 19:13:29 PDT 2008
Revision: 383
http://trac.macosforge.org/projects/darwinbuild/changeset/383
Author: wsiegrist at apple.com
Date: 2008-09-16 19:13:29 -0700 (Tue, 16 Sep 2008)
Log Message:
-----------
Initial work for Xcode 3.1+ using the dynamic dependency determination used for Xcode 2. There are still problems with Xcode 3.1 support so this is just a preview while we work out the problems. I also changed the Xcode 3.0 to be the same as 2 and 3.1.
Modified Paths:
--------------
trunk/darwinbuild/Makefile
trunk/darwinbuild/darwinbuild
trunk/darwinbuild/installXcode
trunk/darwinbuild/installXcode3
Added Paths:
-----------
trunk/darwinbuild/installXcode31
Removed Paths:
-------------
trunk/darwinbuild/xcodefiles/
Modified: trunk/darwinbuild/Makefile
===================================================================
--- trunk/darwinbuild/Makefile 2008-08-13 01:18:11 UTC (rev 382)
+++ trunk/darwinbuild/Makefile 2008-09-17 02:13:29 UTC (rev 383)
@@ -4,7 +4,6 @@
### Variables for the 'install' phase
###
DATDIR:=$(DATDIR)/darwinbuild
-XCFILEDIR:=$(DATDIR)/xcodefiles
all: manifest
@@ -21,10 +20,8 @@
$(INSTALL) $(INSTALL_EXE_FLAGS) installXcode $(DATDIR)
$(INSTALL) $(INSTALL_EXE_FLAGS) installXcode2 $(DATDIR)
$(INSTALL) $(INSTALL_EXE_FLAGS) installXcode3 $(DATDIR)
+ $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode31 $(DATDIR)
- [ -d $(XCFILEDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(XCFILEDIR)
- $(INSTALL) $(INSTALL_DOC_FLAGS) xcodefiles/* $(XCFILEDIR)
-
$(INSTALL) $(INSTALL_EXE_FLAGS) createChroot $(DATDIR)
$(INSTALL) $(INSTALL_EXE_FLAGS) $(OBJROOT)/manifest $(DATDIR)
$(INSTALL) $(INSTALL_EXE_FLAGS) ditto.sh $(DATDIR)/ditto
@@ -41,10 +38,9 @@
rm -f $(DATDIR)/installXcode
rm -f $(DATDIR)/installXcode2
rm -f $(DATDIR)/installXcode3
+ rm -f $(DATDIR)/installXcode31
rm -f $(DATDIR)/createChroot
rm -f $(DATDIR)/manifest
- rm -f $(XCFILEDIR)/*
- -rmdir $(XCFILEDIR)
-rmdir $(DATDIR)
clean:
Modified: trunk/darwinbuild/darwinbuild
===================================================================
--- trunk/darwinbuild/darwinbuild 2008-08-13 01:18:11 UTC (rev 382)
+++ trunk/darwinbuild/darwinbuild 2008-09-17 02:13:29 UTC (rev 383)
@@ -170,7 +170,7 @@
usage: flags: [-headers] [-build=X] [-target=X]
[-logdeps] [-nochroot] [-nopatch] [-noload | -loadonly]
[-depsbuild=X [-depsbuild=Y]]
- [-fetch] [-source]
+ [-fetch] [-source] [-load]
EOF
exit 1
}
@@ -593,17 +593,15 @@
export CHROOTED
export PATH=/bin:/sbin:/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin
+
+# sets the install path to xcode tools
+export DEVELOPER_DIR="/XCD/loper"
+
export SHELL="/bin/sh"
export HOME="/var/root"
export LOGNAME="root"
export USER="root"
export GROUP="wheel"
-#export HOST=$(hostname)
-#export HOSTTYPE="powermac"
-#export MACHTYPE=$(uname -p)
-#export OSTYPE="darwin"
-#export UNAME_RELEASE
-#export UNAME_SYSNAME
build_string=""
if [ "$buildtool" == "xcodebuild" -a "$target" != "" ]; then
Modified: trunk/darwinbuild/installXcode
===================================================================
--- trunk/darwinbuild/installXcode 2008-08-13 01:18:11 UTC (rev 382)
+++ trunk/darwinbuild/installXcode 2008-09-17 02:13:29 UTC (rev 383)
@@ -7,7 +7,14 @@
if [ "$VER" -gt "920" ];
then
- "$BINDIR/installXcode3" "$BROOT";
+ if [ "$VER" -gt "1000" ];
+ then
+ "$BINDIR/installXcode31" "$BROOT";
+ else
+ "$BINDIR/installXcode3" "$BROOT";
+ fi
else
"$BINDIR/installXcode2" "$BROOT";
fi
+
+
Modified: trunk/darwinbuild/installXcode3
===================================================================
--- trunk/darwinbuild/installXcode3 2008-08-13 01:18:11 UTC (rev 382)
+++ trunk/darwinbuild/installXcode3 2008-09-17 02:13:29 UTC (rev 383)
@@ -1,57 +1,151 @@
#!/bin/sh
-XCFILEDIR=/usr/local/share/darwinbuild/xcodefiles
-BROOT=$1
+FORCE="YES"
-if [ "x$BROOT" == "x" ];
-then
- echo "$0 <build root>";
- exit 1;
+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/usr/bin/xcodebuild \
+ /Developer/Makefiles/pbx_jamfiles)
+
+
+JAMFILES=/Developer/Makefiles/pbx_jamfiles
+XCODESETTINGS="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/BuildSettings-macosx.plist"
+XCODECOMP="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/Built-in compilers.pbcompspec"
+
+RPATH=/Developer/Library/PrivateFrameworks
+
+if [ -z "$BUILDROOT" ]; then
+ echo "Usage: $0 <BuildRoot>" 1>&2
+ exit 1
fi
-echo "Installing xcodebuild into ${BROOT}";
+mkdir -p "$BUILDROOT"
-# make initial buildroot and symlinks if needed
-echo "Making initial build root...";
-mkdir -p "${BROOT}";
-pushd $BROOT >> /dev/null
-for D in etc tmp var ;
-do
- if [ ! -L $D ] ;
- then
- echo "Symlinking $D";
- ln -s private/$D $D ;
- fi
-done;
-popd >> /dev/null
+###
+### 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, at 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.seen.$$
+ rm -f /tmp/installXcode.tmplibs.$$
+ rm -f /tmp/installXcode.tmpfiles.$$
+ rm -f /tmp/installXcode.files.$$
+}
-# copy files we need
-exec <$XCFILEDIR/Xcode_3.0.txt
-while read line;
-do
- case "${line}" in
- *".framework")
- if [ -d ${BROOT}/${line} ] ;
- then
- echo "Deleting: ${BROOT}/${line}";
- rm -r "${BROOT}/${line}" ;
- fi ;;
- esac
- parent=$(dirname $line);
- echo "Copying: ${line}";
- mkdir -p "${BROOT}/${parent}" ;
- cp -R "${line}" "${BROOT}/${parent}" ;
-done;
+AppendExtraFiles() {
+ for X in "${EXTRACOPY[@]}"; do
+ echo "$X" >> /tmp/installXcode.libs.$$
+ done
+}
-# load roots
-echo "Loading roots that Xcode needs...";
-darwinbuild -load objc4
-darwinbuild -load ICU
-darwinbuild -load libxml2
-darwinbuild -load SQLite
-darwinbuild -load libxslt
-darwinbuild -load OpenSSL
-darwinbuild -load DiskArbitration
-darwinbuild -load pb_makefiles
+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,/usr/lib,/XCD/lib,g' \
+ -e 's,/usr/share/icu,/XCD/share/icu,g' \
+ -e 's, at rpath,/XCD/R,g' \
+ -e 's,/Developer,/XCD/loper,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ # 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
+
+ find ".$JAMFILES" ".$XCODECOMP" | cpio -o -c | \
+ sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \
+ -e 's,/Developer/Makefiles/pbx_jamfiles,/XCD/loper/Makefiles/pbx_jamfiles,g' \
+ -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ find ".$XCODESETTINGS" | cpio -o -c | \
+ sed -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ echo "done"
+}
+
+
+
+###
+### 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
+
+popd > /dev/null
+
+RemoveTemps
Added: trunk/darwinbuild/installXcode31
===================================================================
--- trunk/darwinbuild/installXcode31 (rev 0)
+++ trunk/darwinbuild/installXcode31 2008-09-17 02:13:29 UTC (rev 383)
@@ -0,0 +1,154 @@
+#!/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/usr/bin/xcodebuild \
+ /Developer/Platforms/MacOSX.platform \
+ /Developer/Makefiles/pbx_jamfiles)
+
+
+JAMFILES=/Developer/Makefiles/pbx_jamfiles
+XCODESETTINGS="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/BuildSettings-macosx.plist"
+XCODECOMP="/System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/Built-in compilers.pbcompspec"
+
+RPATH=/Developer/Library/PrivateFrameworks
+
+if [ -z "$BUILDROOT" ]; then
+ echo "Usage: $0 <BuildRoot>" 1>&2
+ exit 1
+fi
+
+mkdir -p "$BUILDROOT"
+
+###
+### 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, at 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.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
+ # The [^m] used for /Developer is to prevent matching Platform subdirectories
+ cpio -o -c < /tmp/installXcode.files.$$ | \
+ sed -e 's,/System,/XCD/SY,g' \
+ -e 's,/usr/lib,/XCD/lib,g' \
+ -e 's,/usr/share/icu,/XCD/share/icu,g' \
+ -e 's, at rpath,/XCD/R,g' \
+ -e 's,/Developer,/XCD/loper,g' \
+ -e 's,platform/XCD/loper,platform/Developer,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ # 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
+
+ find ".$JAMFILES" ".$XCODECOMP" | cpio -o -c | \
+ sed -e 's,$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks,/XCD/SY///////Library/PrivateFrameworks,g' \
+ -e 's,/Developer/Makefiles/pbx_jamfiles,/XCD/loper/Makefiles/pbx_jamfiles,g' \
+ -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ find ".$XCODESETTINGS" | cpio -o -c | \
+ sed -e 's,/System/Library/PrivateFrameworks/DevToolsCore.framework,/XCD/SY/Library/PrivateFrameworks/DevToolsCore.framework,g' | \
+ (cd "$BUILDROOT"; cpio -ium${VERBOSECPIO}d )
+
+ echo "done"
+}
+
+
+
+###
+### 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
+
+popd > /dev/null
+
+RemoveTemps
Property changes on: trunk/darwinbuild/installXcode31
___________________________________________________________________
Added: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20080916/df703828/attachment-0001.html
More information about the darwinbuild-changes
mailing list