summaryrefslogtreecommitdiff
path: root/misc/osx/package.bash
blob: ac3717642f024dd4f9ee61ebe934ac7481969483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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}