[darwinbuild-changes] [151] trunk/darwinbuild/installXcodebuild
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 4 01:52:27 PDT 2006
Revision: 151
http://trac.macosforge.org/projects/darwinbuild/changeset/151
Author: ssen
Date: 2006-10-04 01:52:27 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
Significant overhaul.
Based on the set of xcodebuild dependencies (dylibs and explicit),
we generate a full list of files to copy. We then copy those
files to the BUILDROOT, but dynamically rewrite all references
to /S/L/F, /S/L/PF, and /usr/lib to our secret "/XCD" directory.
This insulates xcodebuild from the Darwin CF, and prevents
tainting the build root. We no longer need to do lipo
stuff to preserve the fat CF.
We're a bit smarter about copying files. Don't copy _debug or _profile
variants, and don't copy the multi-megabyte LangAnalysis dictionaries.
I was able to chroot into a directory produced only with this
script and run "/usr/bin/xcodebuild -version". Still need to do
some real-life tests
Modified Paths:
--------------
trunk/darwinbuild/installXcodebuild
Modified: trunk/darwinbuild/installXcodebuild
===================================================================
--- trunk/darwinbuild/installXcodebuild 2005-08-04 13:53:52 UTC (rev 150)
+++ trunk/darwinbuild/installXcodebuild 2006-10-04 08:52:27 UTC (rev 151)
@@ -1,13 +1,26 @@
#!/bin/sh
-### TODO:
-### pbx_jamfiles
-
FORCE="YES"
XCODEBUILD=/usr/bin/xcodebuild
BUILDROOT="$1"
+EXTRACOPY=( \
+ /usr/lib/dyld \
+# /usr/share/icu \
+ /System/Library/CoreServices/CharacterSets \
+ /Developer/Private \
+ /Developer/Tools \
+ /usr/bin/xcodebuild \
+ /Library/Application\ Support/Xcode)
+
+if [ -z "$BUILDROOT" ]; then
+ echo "Usage: $0 /Volumes/DarwinBuild/BuildRoot" 1>&2
+ exit 1
+fi
+
+mkdir -p "$BUILDROOT"
+
###
### Recurse through frameworks and libraries looking for dependencies
###
@@ -15,7 +28,7 @@
echo $1 >> /tmp/installXcode.seen.$$
otool -L $1 | tail -n +2 | awk '{ print $1 }' > /tmp/installXcode.tmplibs.$$
cat /tmp/installXcode.tmplibs.$$ >> /tmp/installXcode.libs.$$
- for X in $(cat /tmp/installXcode.tmplibs.$$); do
+ cat /tmp/installXcode.tmplibs.$$ | while read X; do
if ! grep -q "^$X\$" /tmp/installXcode.seen.$$ ; then
RecurseLibs $X
fi
@@ -26,66 +39,85 @@
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() {
+ echo -n "Copying Xcode and dependencies ..."
+ cpio -o -c < /tmp/installXcode.files.$$ | \
+ sed -e 's,/System/Library/Frameworks,/XCD/SY/Library/Frameworks,g' \
+ -e 's,/System/Library/PrivateFrameworks,/XCD/SY/Library/PrivateFrameworks,g' \
+ -e 's,/usr/lib,/XCD/lib,g' | \
+ (cd "$BUILDROOT"; cpio -imvd )
+
+ 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
-for X in $(cat /tmp/installXcode.libs.$$ | sort | uniq); do
- echo -n $(basename $X) "... "
- [ -d $BUILDROOT$(dirname $X) ] || mkdir -p $BUILDROOT$(dirname $X)
- if [ "$FORCE" == "YES" -o ! -f $BUILDROOT$X ]; then
- echo copying
- ### Back up to the .framework level (instead of /Versions/A/)
- SRC=$(echo $(dirname $X) | sed 's/\(.*\.framework\).*/\1/')
- DST=$BUILDROOT$SRC
- case $SRC in
- *.framework)
- rsync -rl \
- --exclude=Headers \
- --exclude=PrivateHeaders \
- $SRC/* $DST
- ;;
- *)
- cp $X $DST
- ;;
- esac
- else
- echo skipping
- fi
-done
+AppendExtraFiles
+GenerateFileNames
+CopyFiles
+popd > /dev/null
-###
-### Copy some miscellaneous files that xcodebuild needs
-###
-
-for SRC in \
- /usr/share/icu \
- /System/Library/CoreServices/CharacterSets \
- /Developer/Private/jam \
- /Developer/Tools \
- /usr/bin/xcodebuild \
- /Library/Application\ Support/Xcode \
- ; do
- echo -n "$SRC ... "
- DST="$BUILDROOT$SRC"
- DST=$(dirname "$DST")
- [ -d "$DST" ] || mkdir -p "$DST"
- if [ ! -e "$BUILDROOT$SRC" ]; then
- echo copying
- rsync -rl "$SRC" "$DST"
- else
- echo skipped
- fi
-done
-
if [ ! -e "$BUILDROOT/Library/Application Support/Xcode/Specifications/GCC 3.5.xcspec" ];
then
echo "Generating GCC 3.5.xcspec"
@@ -101,25 +133,4 @@
fi
-###
-### Copy the full CF over the CF-Lite that may be in the build root.
-### Retain the i386 CF-Lite that may be in the build root.
-###
-
-CF=/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/CoreFoundation
-CF_PPC=$CF
-if file $CF | grep -q "Mach-O fat file" ; then
- CF_PPC=/tmp/CF.tmp.ppc.$$
- lipo $CF -thin ppc -output $CF_PPC
-fi
-if [ -f $BUILDROOT$CF ]; then
- if file $BUILDROOT$CF | grep -q "Mach-O fat file" ; then
- lipo $BUILDROOT$CF -replace ppc $CF_PPC -output $BUILDROOT$CF
- else
- lipo -create -arch ppc $CF_PPC -output $BUILDROOT$CF
- fi
-else
- lipo -create -arch ppc $CF_PPC -output $BUILDROOT$CF
-fi
-
RemoveTemps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/bcc032ba/attachment.html
More information about the darwinbuild-changes
mailing list