aboutsummaryrefslogtreecommitdiffstats
path: root/mac/make-bin-dist
blob: 793f15581f766f9228b079f3637647d058ae1ae3 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh

#### make-bin-dist: create a binary Emacs distribution tar file for
#### Mac OS X.  This basically runs a `configure' and `make install'
#### into a temporary directory and archives that directory.  It also
#### places the Emacs application bundle and a installer script in the
#### tar file.  The installer script is run to set up the XML file for
#### setting the environment variables used by Emacs when it is
#### started from the Finder.

# Copyright (C) 2002 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
# GNU Emacs is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

progname="$0"

### Exit if a command fails.
#set -e

### Print out each line we read, for debugging's sake.
set -v

LANGUAGE=C
LC_ALL=C
LC_MESSAGES=
LANG=
export LANGUAGE LC_ALL LC_MESSAGES LANG

## Don't restrict access to any files.
umask 0

### Make sure we're running in the right place.
if [ ! -f Emacs.app/Contents/PkgInfo ]; then
  echo "${progname}: Can't find \`Emacs.app/Contents/PkgInfo'" >&2
  echo "${progname} must be run in the \`mac' directory of the Emacs" >&2
  echo "distribution tree.  cd to that directory and try again." >&2
  exit 1
fi

### Check whether file ../lisp/version.el exists.
if [ ! -f ../lisp/version.el ]; then
  echo "${progname}: Can't find \`../lisp/version.el'" >&2
  exit 1
fi

### Find out which version of Emacs this is.
shortversion=`grep 'defconst[	 ]*emacs-version' ../lisp/version.el \
	 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
version=`grep 'defconst[	 ]*emacs-version' ../lisp/version.el \
	 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
if [ ! "${version}" ]; then
  echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
  exit 1
fi

echo Version numbers are $version and $shortversion

### Make sure we don't already have a directory  emacs-${version}.

emacsname="emacs-${version}${new_extension}"

if [ -d ${emacsname} ]
then
  echo Directory "${emacsname}" already exists >&2
  exit 1
fi

### Make sure the subdirectory is available.
tempparent="make-bin-dist.tmp.$$"
if [ -d ${tempparent} ]; then
  echo "${progname}: staging directory \`${tempparent}' already exists.
Perhaps a previous invocation of \`${progname}' failed to clean up after
itself.  Check that directories whose names are of the form
\`make-dist.tmp.NNNNN' don't contain any important information, remove
them, and try again." >&2
  exit 1
fi

tempparentfull="`pwd`/${tempparent}"

echo Installing into directory ${tempparentfull} >&2

(cd ..; ./configure --prefix=${tempparentfull}; make install)

### This trap ensures that the staging directory will be cleaned up even
### when the script is interrupted in mid-career.
trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15

cp -r Emacs.app ${tempparent}

cp osx-install ${tempparent}

echo "Creating tar file"

mv ${tempparent} ${emacsname}

tar cvf - ${emacsname} | gzip > ${emacsname}-mac-bin.tar.gz

echo "Cleaning up the staging directory"
rm -rf ${emacsname}

### make-bin-dist ends here