mirror of
https://github.com/golang/go
synced 2024-11-24 21:10:04 -07:00
misc/osx: Add scripts to create OS X package and disk image
Fixes #2327. R=golang-dev, rsc, roberto, jdpoirier CC=golang-dev https://golang.org/cl/5375049
This commit is contained in:
parent
6c864210fc
commit
dd731478b8
@ -29,6 +29,8 @@ doc/codelab/wiki/*.bin
|
|||||||
misc/cgo/life/run.out
|
misc/cgo/life/run.out
|
||||||
misc/dashboard/builder/gobuilder
|
misc/dashboard/builder/gobuilder
|
||||||
misc/goplay/goplay
|
misc/goplay/goplay
|
||||||
|
misc/osx/*.pkg
|
||||||
|
misc/osx/*.dmg
|
||||||
src/Make.inc
|
src/Make.inc
|
||||||
src/cmd/6a/6a
|
src/cmd/6a/6a
|
||||||
src/cmd/?l/enam.c
|
src/cmd/?l/enam.c
|
||||||
|
9
misc/osx/README
Normal file
9
misc/osx/README
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Use image.bash to construct a disk image.
|
||||||
|
|
||||||
|
package.bash constructs a package file (Go.pkg) for installation on OS X, and
|
||||||
|
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.
|
4
misc/osx/ReadMe.txt
Normal file
4
misc/osx/ReadMe.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
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.
|
||||||
|
|
1
misc/osx/etc/paths.d/go
Normal file
1
misc/osx/etc/paths.d/go
Normal file
@ -0,0 +1 @@
|
|||||||
|
/usr/local/go/bin
|
15
misc/osx/etc/profile.go
Executable file
15
misc/osx/etc/profile.go
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/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.
|
||||||
|
|
||||||
|
# The output of this script will be eval'd by the user's shell on startup. This
|
||||||
|
# script decides what type of shell is being used in the same way as
|
||||||
|
# /usr/libexec/path_helper
|
||||||
|
|
||||||
|
if echo $SHELL | grep csh$ > /dev/null; then
|
||||||
|
echo 'setenv GOROOT /usr/local/go'
|
||||||
|
else
|
||||||
|
echo 'export GOROOT=/usr/local/go'
|
||||||
|
fi
|
||||||
|
|
38
misc/osx/image.bash
Executable file
38
misc/osx/image.bash
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/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}
|
||||||
|
|
51
misc/osx/package.bash
Executable file
51
misc/osx/package.bash
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
BUILD=/tmp/go.build.tmp
|
||||||
|
ROOT=`hg root`
|
||||||
|
|
||||||
|
echo "Removing old images"
|
||||||
|
rm -f *.pkg *.dmg
|
||||||
|
|
||||||
|
echo "Preparing temporary directory"
|
||||||
|
rm -rf ${BUILD}
|
||||||
|
mkdir -p ${BUILD}
|
||||||
|
|
||||||
|
echo "Preparing template"
|
||||||
|
mkdir -p ${BUILD}/root/usr/local/
|
||||||
|
|
||||||
|
echo "Copying go source distribution"
|
||||||
|
cp -r $ROOT ${BUILD}/root/usr/local/go
|
||||||
|
cp -r etc ${BUILD}/root/etc
|
||||||
|
|
||||||
|
echo "Building go"
|
||||||
|
pushd . > /dev/null
|
||||||
|
cd ${BUILD}/root/usr/local/go
|
||||||
|
GOROOT=`pwd`
|
||||||
|
src/version.bash -save
|
||||||
|
rm -rf .hg .hgignore .hgtags
|
||||||
|
cd src
|
||||||
|
./all.bash | sed "s/^/ /"
|
||||||
|
cd ..
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
echo "Building package"
|
||||||
|
${PM} -v -r ${BUILD}/root -o "Go `hg id`.pkg" \
|
||||||
|
--scripts scripts \
|
||||||
|
--id com.googlecode.go \
|
||||||
|
--title Go \
|
||||||
|
--version "0.1" \
|
||||||
|
--target "10.5"
|
||||||
|
|
||||||
|
echo "Removing temporary directory"
|
||||||
|
rm -rf ${BUILD}
|
28
misc/osx/scripts/postinstall
Normal file
28
misc/osx/scripts/postinstall
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GOROOT=/usr/local/go
|
||||||
|
|
||||||
|
echo "Fixing permissions"
|
||||||
|
cd $GOROOT
|
||||||
|
find . -exec chmod ugo+r \{\} \;
|
||||||
|
find bin -exec chmod ugo+rx \{\} \;
|
||||||
|
find . -type d -exec chmod ugo+rx \{\} \;
|
||||||
|
chmod o-w .
|
||||||
|
|
||||||
|
echo "Setting GOROOT system-wide"
|
||||||
|
echo "eval \`/etc/profile.go\`" >> /etc/csh.login
|
||||||
|
echo "eval \`/etc/profile.go\`" >> /etc/zshenv
|
||||||
|
echo "eval \`/etc/profile.go\`" >> /etc/profile
|
||||||
|
|
||||||
|
echo "Fixing debuggers via sudo.bash"
|
||||||
|
# setgrp procmod the debuggers (sudo.bash)
|
||||||
|
cd $GOROOT/src
|
||||||
|
./sudo.bash
|
||||||
|
|
||||||
|
echo "Installing miscellaneous files:"
|
||||||
|
XCODE_MISC_DIR="/Library/Application Support/Developer/Shared/Xcode/Specifications/"
|
||||||
|
if [ -f $XCODE_MISC_DIR ]; then
|
||||||
|
echo " XCode"
|
||||||
|
cp $GOROOT/misc/xcode/* $XCODE_MISC_DIR
|
||||||
|
fi
|
||||||
|
|
31
misc/osx/utils.bash
Normal file
31
misc/osx/utils.bash
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/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
|
Loading…
Reference in New Issue
Block a user