1
0
mirror of https://github.com/golang/go synced 2024-11-24 21:00:09 -07:00

misc/osx: update for dist tool, drop image.bash, update readme

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5639043
This commit is contained in:
Andrew Gerrand 2012-02-07 14:37:57 +11:00
parent c2fe6634db
commit eb039a8045
5 changed files with 39 additions and 98 deletions

View File

@ -1,9 +1,3 @@
Use image.bash to construct a disk image. Use package.bash to construct a package file (Go.pkg) for installation on OS X.
package.bash constructs a package file (Go.pkg) for installation on OS X, and This script depends on PackageMaker (Developer Tools).
is used by image.bash to construct a disk image. Strictly speaking, the disk
image is unnecessary, but they are more common by convention.
These scripts depend on PackageMaker (Developer Tools), osascript, and hdiutil.
Appropriate checks are run in utils.bash, called at the beginning of each
script.

View File

@ -1,4 +0,0 @@
See http://golang.org/doc/go_tutorial.html for help getting started. Note that
the installation steps described in the "getting started" guide are performed
for you by the installer packaged in this directory.

View File

@ -1,38 +0,0 @@
#!/bin/bash
# Copyright 2011 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
source utils.bash
if ! test -f ../../src/env.bash; then
echo "package.bash must be run from $GOROOT/misc/osx" 1>&2
fi
ROOT=`hg root`
echo "Running package.bash"
./package.bash
echo "Preparing image directory"
IMGDIR=/tmp/"Go `hg id`"
rm -rf "${IMGDIR}"
mkdir -p "${IMGDIR}"
# Copy in files
cp "Go `hg id`.pkg" "${IMGDIR}/Go.pkg"
cp ${ROOT}/LICENSE "${IMGDIR}/License.txt"
cp ReadMe.txt "${IMGDIR}/ReadMe.txt"
cp "${ROOT}/doc/gopher/bumper640x360.png" "${IMGDIR}/.background"
# Call out to applescript (osascript) to prettify things
#${OSASCRIPT} prepare.applescript
echo "Creating dmg"
${HDIUTIL} create -srcfolder "${IMGDIR}" "Go `hg id`.dmg"
echo "Removing image directory"
rm -rf ${IMGDIR}

View File

@ -5,45 +5,65 @@
set -e set -e
source utils.bash if ! test -f ../../src/all.bash; then
echo >&2 "package.bash must be run from $GOROOT/misc/osx"
if ! test -f ../../src/env.bash; then exit 1
echo "package.bash must be run from $GOROOT/misc/osx" 1>&2
fi fi
echo >&2 "Locating PackageMaker..."
PM=/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
if [ ! -x $PM ]; then
PM=/Developer$PM
if [ ! -x $PM ]; then
echo >&2 "could not find PackageMaker; aborting"
exit 1
fi
fi
echo >&2 " Found: $PM"
BUILD=/tmp/go.build.tmp BUILD=/tmp/go.build.tmp
ROOT=`hg root` ROOT=`hg root`
export GOROOT=$BUILD/root/usr/local/go export GOROOT=$BUILD/root/usr/local/go
export GOROOT_FINAL=/usr/local/go export GOROOT_FINAL=/usr/local/go
echo "Removing old images" echo >&2 "Removing old images"
rm -f *.pkg *.dmg rm -f *.pkg *.dmg
echo "Preparing temporary directory" echo >&2 "Preparing temporary directory"
rm -rf $BUILD rm -rf $BUILD
mkdir -p $BUILD mkdir -p $BUILD
trap "rm -rf $BUILD" 0
echo "Copying go source distribution" echo >&2 "Copying go source distribution"
mkdir -p $BUILD/root/usr/local mkdir -p $BUILD/root/usr/local
cp -r $ROOT $GOROOT cp -r $ROOT $GOROOT
cp -r etc $BUILD/root/etc cp -r etc $BUILD/root/etc
echo "Building go"
pushd $GOROOT > /dev/null pushd $GOROOT > /dev/null
src/version.bash -save
echo >&2 "Detecting version..."
pushd src > /dev/null
./make.bash --dist-tool > /dev/null
../bin/tool/dist version > /dev/null
popd > /dev/null
mv VERSION.cache VERSION
VERSION="$(cat VERSION | awk '{ print $1 }')"
echo >&2 " Version: $VERSION"
echo >&2 "Pruning Mercurial metadata"
rm -rf .hg .hgignore .hgtags rm -rf .hg .hgignore .hgtags
cd src
./all.bash | sed "s/^/ /" echo >&2 "Building Go"
pushd src
./all.bash 2>&1 | sed "s/^/ /" >&2
popd > /dev/null popd > /dev/null
echo "Building package" popd > /dev/null
# $PM came from utils.bahs
$PM -v -r $BUILD/root -o "Go `hg id`.pkg" \ echo >&2 "Building package"
$PM -v -r $BUILD/root -o "go.darwin.$VERSION.pkg" \
--scripts scripts \ --scripts scripts \
--id com.googlecode.go \ --id com.googlecode.go \
--title Go \ --title Go \
--version "0.1" \ --version "0.1" \
--target "10.5" --target "10.5"
echo "Removing temporary directory"
rm -rf $BUILD

View File

@ -1,31 +0,0 @@
#!/bin/bash
# Copyright 2011 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
echo "Attempting to locate needed utilities..."
# PackageMaker
PM=/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
if [ ! -x ${PM} ]; then
PM=/Developer${PM}
if [ ! -x ${PM} ]; then
echo "Could not find PackageMaker; aborting!"
fi
fi
echo " PackageMaker : ${PM}"
# hdiutil. If this doesn't exist, your OS X installation is horribly borked,
# but let's check anyway...
if which hdiutil > /dev/null; then
HDIUTIL=`which hdiutil`
echo " hdiutil : ${HDIUTIL}"
fi
# Ditto for osascript
if which osascript > /dev/null; then
OSASCRIPT=`which osascript`
echo " osascript : ${OSASCRIPT}"
fi