[darwinbuild-changes] [197] trunk/darwinbuild

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:58:10 PDT 2006


Revision: 197
          http://trac.macosforge.org/projects/darwinbuild/changeset/197
Author:   kevin
Date:     2006-10-04 01:58:09 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- added CheckDarwinBuildRoot function to darwinbuild.common
- added darwinmaster.sh for creating bootable CDs
- added packageRoots.sh
- added thinFile.sh
- added thinPackages.sh

Modified Paths:
--------------
    trunk/darwinbuild/Makefile
    trunk/darwinbuild/darwinbuild
    trunk/darwinbuild/darwinbuild.common

Added Paths:
-----------
    trunk/darwinbuild/darwinmaster.sh
    trunk/darwinbuild/packageRoots.sh
    trunk/darwinbuild/thinFile.sh
    trunk/darwinbuild/thinPackages.sh

Modified: trunk/darwinbuild/Makefile
===================================================================
--- trunk/darwinbuild/Makefile	2005-08-24 21:42:14 UTC (rev 196)
+++ trunk/darwinbuild/Makefile	2006-10-04 08:58:09 UTC (rev 197)
@@ -13,12 +13,16 @@
 install: all
 	[ -d $(BINDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR)
 	$(INSTALL) $(INSTALL_EXE_FLAGS) darwinbuild $(BINDIR)
+	$(INSTALL) $(INSTALL_EXE_FLAGS) darwinmaster.sh $(BINDIR)/darwinmaster
 
 	[ -d $(DATDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR)
 	$(INSTALL) $(INSTALL_DOC_FLAGS) darwinbuild.common $(DATDIR)
 	$(INSTALL) $(INSTALL_EXE_FLAGS) installXcodebuild $(DATDIR)
 	$(INSTALL) $(INSTALL_EXE_FLAGS) manifest $(DATDIR)
 	$(INSTALL) $(INSTALL_EXE_FLAGS) ditto.sh $(DATDIR)/ditto
+	$(INSTALL) $(INSTALL_EXE_FLAGS) packageRoots.sh $(DATDIR)/packageRoots
+	$(INSTALL) $(INSTALL_EXE_FLAGS) thinFile.sh $(DATDIR)/thinFile
+	$(INSTALL) $(INSTALL_EXE_FLAGS) thinPackages.sh $(DATDIR)/thinPackages
 
 uninstall:
 	rm -f $(BINDIR)/darwinbuild
@@ -28,4 +32,4 @@
 	-rmdir $(DATDIR)
 
 clean:
-	rm -f manifest
\ No newline at end of file
+	rm -f manifest

Modified: trunk/darwinbuild/darwinbuild
===================================================================
--- trunk/darwinbuild/darwinbuild	2005-08-24 21:42:14 UTC (rev 196)
+++ trunk/darwinbuild/darwinbuild	2006-10-04 08:58:09 UTC (rev 197)
@@ -175,39 +175,10 @@
 }
 
 ###
-### Check that we are properly situated.  Either the
-### DARWIN_BUILDROOT environment variable must be set to an
-### absolute path, or the current working directory must be
-### at the root level of the build environment.
+### Check that we're property situated in an initialized directory
 ###
-if [ "$DARWIN_BUILDROOT" != "" ]; then
-	if [ "${DARWIN_BUILDROOT:0:1}" != "/" ]; then
-		echo "Error:" 1>&2
-		echo "The DARWIN_BUILDROOT environment variable must contain" 1>&2
-		echo "an absolute path." 1>&2
-		echo "" 1>&2
-		exit 1
-	else
-		cd "$DARWIN_BUILDROOT"
-	fi
-fi
-if [ -d Roots -a \
-	 -d Sources -a \
-	 -d Symbols -a \
-	 -d Headers -a \
-	 -d Logs ]; then
-	export DARWIN_BUILDROOT="$(pwd -P)"
-else
-	echo "ERROR: Please change your working directory to the mount point" 1>&2
-	echo "of the disk image, partition, or directory containing the" 1>&2
-	echo "Sources, Symbols, Roots, and Logs directories." 1>&2
-	echo "Alternatively, you may set the DARWIN_BUILDROOT environment" 1>&2
-	echo "variable to the absolute path of that directory." 1>&2
-	echo "" 1>&2
-	exit 1
-fi
+CheckDarwinBuildRoot
 
-
 BuildRoot="$DARWIN_BUILDROOT/BuildRoot"
 mkdir -p "$BuildRoot"
 export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/$XREFDB"

Modified: trunk/darwinbuild/darwinbuild.common
===================================================================
--- trunk/darwinbuild/darwinbuild.common	2005-08-24 21:42:14 UTC (rev 196)
+++ trunk/darwinbuild/darwinbuild.common	2006-10-04 08:58:09 UTC (rev 197)
@@ -2,6 +2,8 @@
 #
 # Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
 # 
+# @APPLE_BSD_LICENSE_HEADER_START@
+#
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
 # are met:
@@ -25,9 +27,44 @@
 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
+#
+# @APPLE_BSD_LICENSE_HEADER_END@
 
 
 ###
+### Check that we are properly situated.  Either the
+### DARWIN_BUILDROOT environment variable must be set to an
+### absolute path, or the current working directory must be
+### at the root level of the build environment.
+###
+function CheckDarwinBuildRoot() {
+	if [ "$DARWIN_BUILDROOT" != "" ]; then
+		if [ "${DARWIN_BUILDROOT:0:1}" != "/" ]; then
+			echo "ERROR: DARWIN_BUILDROOT environment variable must contain an absolute path." 1>&2
+			exit 1
+		else
+			cd "$DARWIN_BUILDROOT"
+		fi
+	fi
+	if [ -d Roots -a \
+		-d Sources -a \
+		-d Symbols -a \
+		-d Headers -a \
+		-d Logs ]; then
+		export DARWIN_BUILDROOT="$(pwd -P)"
+	else
+		cat 1>&2 <<- EOB
+			ERROR: please change your working directory to one initialized by:
+			  darwinbuild -init <build>
+			Alternatively, you may set the DARWIN_BUILDROOT environment variable to the
+			absolute path of that directory.
+
+			EOB
+			exit 1
+	fi
+}
+
+###
 ### Given a list of filenames, this function will
 ### find the largest number after the '~' and return
 ### its value. Used to calculate a non-conflicting build number.

Added: trunk/darwinbuild/darwinmaster.sh
===================================================================
--- trunk/darwinbuild/darwinmaster.sh	                        (rev 0)
+++ trunk/darwinbuild/darwinmaster.sh	2006-10-04 08:58:09 UTC (rev 197)
@@ -0,0 +1,255 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
+#
+# @APPLE_BSD_LICENSE_HEADER_START@
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# @APPLE_BSD_LICENSE_HEADER_END@
+#
+# Kevin Van Vechten <kevin at opendarwin.org>
+#
+# ISO generation adapted from buildcd.sh by:
+#
+# Shantonu Sen      <ssen at opendarwin.org>
+# Felix Kronlage    <fkr at opendarwin.org>
+# Chuck Remes       <cremes at opendarwin.org>
+
+ARCH="$1"
+VOLNAME="$2"
+
+if [ "$ARCH" != "ppc" -a "$ARCH" != "i386" \
+	-o "$VOLNAME" == "" ]; then
+	cat 1>&2 <<- EOB
+usage: $(basename $0) <arch> <volname>
+       arch = {ppc, i386}
+EOB
+	exit 1
+fi
+
+PREFIX=/usr/local
+XREFDB=.build/xref.db
+DARWINXREF=$PREFIX/bin/darwinxref
+DATADIR=$PREFIX/share/darwinbuild
+COMMONFILE=$DATADIR/darwinbuild.common
+
+###
+### Include some common subroutines
+###
+. "$COMMONFILE"
+
+shopt -s nullglob
+
+###
+### Check that we're property situated in an initialized directory
+###
+CheckDarwinBuildRoot
+
+DMG="/tmp/$VOLNAME.dmg"
+CDR="/tmp/$VOLNAME.cdr"
+ISO="/tmp/$VOLNAME.iso"
+PKGDIR="$DARWIN_BUILDROOT/Packages"
+MKISOFS="/opt/local/bin/mkisofs"
+SIZE="650m"
+
+###
+### Must be run as root.  Enforce this.
+###
+if [ "$EUID" != "0" ]; then
+	echo "Error: $(basename $0) must be run as root." 1>&2
+	exit 1
+fi
+
+###
+### Update binary packages
+###
+"$DATADIR/packageRoots"
+
+###
+### Update thin packages
+###
+"$DATADIR/thinPackages" "$ARCH"
+
+
+###
+### Mount a disk image, create if necessary
+###
+if [ ! -f "$DMG" ]; then
+	hdiutil create "$DMG" \
+		-size "$SIZE" \
+		-layout SPUD \
+		-fs HFS+ \
+		-volname "$VOLNAME"
+fi
+DESTDIR=$(hdiutil attach "$DMG" \
+		-readwrite \
+		-owners on | tail -1 | awk '{print $3}')
+RECEIPTS="$DESTDIR/.receipts"
+
+###
+### Copy roots necessary for booting / installation onto disk image
+###
+cd "$DESTDIR" || exit
+chown root:admin "$DESTDIR"
+chmod 1775 "$DESTDIR"
+
+echo "Installing Roots ..."
+[ -d "$RECEIPTS" ] || mkdir "$RECEIPTS"
+#for X in $PKGDIR/files-*.tar.gz $PKGDIR/*-*.tar.gz ; do
+for Z in $(cat "$DARWIN_BUILDROOT/boot.txt") ; do
+	X=$DARWIN_BUILDROOT/BinaryDrivers_${ARCH}/$Z-*.tar.bz2
+	if [ ! -f "$X" ]; then
+		X=$DARWIN_BUILDROOT/Packages_${ARCH}/$Z-*.tar.bz2
+	fi
+	if [ -f "$X" ]; then
+		RECEIPT=$RECEIPTS/$(basename $X)
+		if [ "$RECEIPT" -ot $X ]; then
+			echo ... $(basename $X)
+			tar xjf $X
+			touch $RECEIPT
+		fi
+	fi
+done
+
+###
+### Generate the mkext cache
+###
+echo "Generating MKext ..."
+
+export TMPDIR="$DESTDIR/private/tmp"
+kextcache -a $ARCH -k -K "$DESTDIR/mach_kernel" -m "$DESTDIR/System/Library/Extensions.mkext" "$DESTDIR/System/Library/Extensions"
+export -n TMPDIR
+
+###
+### Remove extraneous files
+###
+echo "Pruning ..."
+find "$DESTDIR" -type f \( -name '*.[ch]' -or -name '*.cp' -or -name '*.cpp' \) -print -exec rm -f {} ';'
+rm -Rf "$DESTDIR/AppleInternal"
+rm -Rf "$DESTDIR/Developer"
+rm -Rf "$DESTDIR/usr/local"
+rm -Rf "$DESTDIR/usr/share/doc"
+rm -Rf "$DESTDIR"/usr/share/man/man3/*
+
+###
+### Modify the root password to blank
+###
+echo "Modifying Root Password ..."
+nicl -raw "$DESTDIR/var/db/netinfo/local.nidb" -create /users/root passwd ''
+
+###
+### Copy installation packages
+###
+mkdir -p "$DESTDIR/System/Installation/BinaryDrivers_${ARCH}"
+echo "Copying binary drivers ..."
+for X in $DARWIN_BUILDROOT/BinaryDrivers_${ARCH}/*-*.tar.bz2 ; do
+	Y="$DESTDIR"/System/Installation/BinaryDrivers_${ARCH}/$(basename $X)
+	if [ $X -nt $Y ]; then
+		cp $X $Y
+	fi
+done
+
+echo "Copying packages ..."
+mkdir -p "$DESTDIR"/System/Installation/Packages_${ARCH}
+for X in $DARWIN_BUILDROOT/Packages_${ARCH}/*-*.tar.bz2 ; do
+	f=$(basename $X)
+	if [ "${f/-*/}" != "DarwinInstaller" ]; then
+	Y="$DESTDIR"/System/Installation/Packages_${ARCH}/$(basename $X)
+	if [ $X -nt $Y ]; then
+		echo $f
+		cp $X $Y
+	fi
+	fi
+done
+
+###
+### Architecture-specific boot setup
+###
+if [ "$ARCH" == "ppc" ]; then
+	###
+	### Bless the volume for powerpc booting
+	###
+	echo "Blessing Volume ..."
+	bless   --verbose \
+		--label "$VOLNAME" \
+		--folder "$DESTDIR/System/Library/CoreServices" \
+		--bootinfo "$DESTDIR/usr/standalone/ppc/bootx.bootinfo"
+
+	### Generate CDR image
+	rm -f "$CDR"
+        hdiutil convert \
+		"$DMG" \
+		-format UDTO \
+                -o "$CDR"
+
+
+elif [ "$ARCH" == "i386" ]; then
+	###
+	### Create a bootable ISO filesystem
+	###
+	ditto "$DESTDIR/usr/standalone/i386" /tmp/i386
+	rm -f "$ISO.boot"
+	$MKISOFS -R \
+		-V "$VOLNAME" \
+		-no-emul-boot \
+		-T \
+		-J \
+		-c boot.cat \
+		-b cdboot \
+		-hide-joliet-trans-tbl \
+		-quiet \
+		-o "$ISO.boot" \
+		/tmp/i386
+	SECTORS=$(du "$ISO.boot" | tail -1 | awk '{print $1}')
+
+	###
+	### Create a hybrid image
+	###
+	rm -f "$ISO.dmg"
+	hdiutil create "$ISO.dmg" -size "$SIZE" -layout NONE
+	DEV=$(hdid -nomount "$ISO.dmg" | tail -1 | awk '{print $1}')
+	RDEV=$(echo $DEV | sed s/disk/rdisk/)
+
+	pdisk "$RDEV" -initialize
+	BLOCKS=$(pdisk "$RDEV" -dump | grep 2: | awk -F" " '{print $4}')
+
+	pdisk "$RDEV" -createPartition "$VOLNAME" Apple_HFS $SECTORS $(($BLOCKS - $SECTORS))
+	SLICE=$(pdisk "$RDEV" -dump | grep "$VOLNAME" | awk -F: '{print $1}' | awk -F" " '{print $1}')
+
+	### Copy ISO boot data onto the disk image
+	dd if="$ISO.boot" of="$RDEV" skip=64 seek=64 bs=512
+
+	newfs_hfs -v "$VOLNAME" "${RDEV}s${SLICE}"
+	mkdir -p /mnt
+	mount -t hfs -o perm "${DEV}s${SLICE}" /mnt
+	ditto -rsrc "$DESTDIR" /mnt
+	bless -folder /mnt/System/Library/CoreServices \
+	      -bootinfo /mnt/usr/standalone/ppc/bootx.bootinfo \
+	      -label "$VOLNAME"
+	umount /mnt
+	hdiutil eject "$DEV"
+	mv "$ISO.dmg" "$ISO"
+fi


Property changes on: trunk/darwinbuild/darwinmaster.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

Added: trunk/darwinbuild/packageRoots.sh
===================================================================
--- trunk/darwinbuild/packageRoots.sh	                        (rev 0)
+++ trunk/darwinbuild/packageRoots.sh	2006-10-04 08:58:09 UTC (rev 197)
@@ -0,0 +1,107 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
+#
+# @APPLE_BSD_LICENSE_HEADER_START@
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# @APPLE_BSD_LICENSE_HEADER_END@
+#
+# Kevin Van Vechten <kevin at opendarwin.org>
+
+PREFIX=/usr/local
+XREFDB=.build/xref.db
+DARWINXREF=$PREFIX/bin/darwinxref
+DATADIR=$PREFIX/share/darwinbuild
+COMMONFILE=$DATADIR/darwinbuild.common
+
+NORUN=""
+
+###
+### Interpret our arguments:
+###   -n  Don't actually package anything, just say what we would do.
+function PrintUsage() {
+	echo "usage: $(basename $0) [-n]" 1>&2
+	exit
+}
+
+for ARG in "$@"; do
+	if [ "$NORUN" == "" ]; then
+		if [ "$ARG" == "-n" ]; then
+			NORUN="YES"
+		else
+			PrintUsage "$0"
+		fi
+	else
+		PrintUsage "$0"
+	fi
+done
+
+
+###
+### Include some common subroutines
+###
+. "$COMMONFILE"
+
+shopt -s nullglob
+
+###
+### Check that we're property situated in an initialized directory
+###
+CheckDarwinBuildRoot
+
+
+if [ "$NORUN" == "YES" ]; then
+	CMD="true"
+else
+	CMD="tar czf"
+fi
+
+if [ ! -d "$DARWIN_BUILDROOT/Packages" ]; then
+	mkdir "$DARWIN_BUILDROOT/Packages"
+fi
+
+function PackageThem() {
+	local DIR="$1"
+	local SFX="$2"
+	echo "*** Packaging $DIR"
+	OLDIFS="$IFS"
+	IFS=$'\n'
+	for X in $("$DARWINXREF" version '*') ; do
+		Y="${X/-*/}"
+		build_version=$(GetBuildVersion $DARWIN_BUILDROOT/$DIR/$Y/$X*)
+		if [ "$build_version" != "0" -a \
+		     "$DARWIN_BUILDROOT/$DIR/$Y/$X$SFX~$build_version" -nt \
+		     "$DARWIN_BUILDROOT/Packages/$X$SFX.tar.gz" ]; then
+			echo "$X$SFX~$build_version"
+			cd "$DARWIN_BUILDROOT/$DIR/$Y/$X$SFX~$build_version"
+			eval $CMD "$DARWIN_BUILDROOT/Packages/$X$SFX.tar.gz" .
+		fi
+	done
+	IFS="$OLDIFS"
+}
+PackageThem Headers .hdrs
+PackageThem Roots .root


Property changes on: trunk/darwinbuild/packageRoots.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

Added: trunk/darwinbuild/thinFile.sh
===================================================================
--- trunk/darwinbuild/thinFile.sh	                        (rev 0)
+++ trunk/darwinbuild/thinFile.sh	2006-10-04 08:58:09 UTC (rev 197)
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
+#
+# @APPLE_BSD_LICENSE_HEADER_START@
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# @APPLE_BSD_LICENSE_HEADER_END@
+#
+# Kevin Van Vechten <kevin at opendarwin.org>
+
+###
+### If the file is Mach-O and fat, thin to the specified architecture
+###
+
+ARCH="$1"
+FILE="$2"
+
+if [ "$ARCH" == "" -o "$FILE" == "" ]; then
+	exit 1
+fi
+
+if file "$FILE" | grep -q "Mach-O fat" ; then
+	MODES=$(stat -f%p "$FILE" | cut -b3-6)
+	echo ... thinning $(basename "$FILE") to "$ARCH"
+	lipo "$FILE" -thin "$ARCH" -output "$FILE"
+	chmod "$MODES" "$FILE"
+fi


Property changes on: trunk/darwinbuild/thinFile.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

Added: trunk/darwinbuild/thinPackages.sh
===================================================================
--- trunk/darwinbuild/thinPackages.sh	                        (rev 0)
+++ trunk/darwinbuild/thinPackages.sh	2006-10-04 08:58:09 UTC (rev 197)
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# Copyright (c) 2005, Apple Computer, Inc. All rights reserved.
+#
+# @APPLE_BSD_LICENSE_HEADER_START@
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# @APPLE_BSD_LICENSE_HEADER_END@
+#
+# Kevin Van Vechten <kevin at opendarwin.org>
+
+PREFIX=/usr/local
+XREFDB=.build/xref.db
+DARWINXREF=$PREFIX/bin/darwinxref
+DATADIR=$PREFIX/share/darwinbuild
+COMMONFILE=$DATADIR/darwinbuild.common
+
+THINFILE="$DATADIR/thinFile"
+
+###
+### Interpret our arguments:
+###   the architecture to thin to
+ARCH="$1"
+
+if [ "$ARCH" != "ppc" -a "$ARCH" != "i386" ]; then
+        echo "usage: $(basename $0) <arch>" 1>&2
+        exit 1
+fi
+
+###
+### Include some common subroutines
+###
+. "$COMMONFILE"
+
+shopt -s nullglob
+
+###
+### Check that we're property situated in an initialized directory
+###
+CheckDarwinBuildRoot
+
+PKGDIR="$DARWIN_BUILDROOT/Packages"
+DESTDIR="${PKGDIR}_$ARCH"
+
+for X in $PKGDIR/*-*.tar.gz ; do
+	Y=$(basename $X .gz).bz2
+	if [ $X -nt $DESTDIR/$Y ]; then
+		echo "Extracting $Y ..."
+		rm -rf "$DESTDIR/tmp"
+		mkdir -p "$DESTDIR/tmp"
+		tar xzf $X -C "$DESTDIR/tmp" .
+		echo "Thinning $Y ..."
+		find "$DESTDIR/tmp" -type f -exec "$THINFILE" "$ARCH" {} ';'
+		echo "Archiving $Y ..."
+		tar cjf "$DESTDIR/$Y" -C "$DESTDIR/tmp" .
+	#else
+	#	echo $Y is up to date
+	fi
+done
+rm -rf "$DESTDIR/tmp"


Property changes on: trunk/darwinbuild/thinPackages.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/218a9aa2/attachment-0001.html


More information about the darwinbuild-changes mailing list