46177
|
1 #!/bin/sh
|
|
2
|
|
3 #### make-package: create a Mac OS X package for use by the installer.
|
|
4 #### The installer will place the Emacs OSX application in
|
|
5 #### /Application/Emacs and the rest of emacs in the usual unix places
|
|
6 #### under /usr/local or some other location if specified as the first
|
|
7 #### argument. The disc image will be in the file EmacsInstaller.dmg.
|
|
8 ####
|
|
9 #### Upon installation, this will leave two versions of emacs on the
|
|
10 #### computer, 20.7 and 21.1.
|
|
11 ####
|
|
12 #### Examples:
|
|
13 #### ./make-package
|
|
14 #### Will create an installer that will place the emacs support
|
|
15 #### files inside /usr/local.
|
|
16 #### ./make-package /usr
|
|
17 #### Will create an installer that will place the emacs support
|
|
18 #### files inside /usr. This will replace the default version of
|
|
19 #### emacs included with Mac OS X.
|
|
20
|
|
21 # Copyright (C) 2002 Free Software Foundation, Inc.
|
|
22 #
|
|
23 # This file is part of GNU Emacs.
|
|
24 #
|
|
25 # GNU Emacs is free software; you can redistribute it and/or modify
|
|
26 # it under the terms of the GNU General Public License as published by
|
|
27 # the Free Software Foundation; either version 2, or (at your option)
|
|
28 # any later version.
|
|
29 #
|
|
30 # GNU Emacs is distributed in the hope that it will be useful,
|
|
31 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
33 # GNU General Public License for more details.
|
|
34 #
|
|
35 # You should have received a copy of the GNU General Public License
|
|
36 # along with GNU Emacs; see the file COPYING. If not, write to the
|
|
37 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
38 # Boston, MA 02111-1307, USA.
|
|
39 #
|
|
40 # Contributed by Steven Tamm (steventamm@mac.com).
|
|
41
|
|
42 progname="$0"
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
43
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
44 srcdir="`pwd`/.."
|
48990
|
45 builddir=${srcdir}
|
46183
|
46
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
47 ## Default location to place it is /usr/local
|
46177
|
48 prefix=/usr/local
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
49 appsdir=/Applications
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
50 emapp=Emacs.app
|
46183
|
51 with_config=yes
|
47808
|
52 with_app=yes
|
|
53 with_x=no
|
49005
|
54 comp_diskimage=no
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
55 self_contained=no
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
56 app_symlink=no
|
48616
|
57 full_dist=yes
|
48990
|
58 build_in_place=no
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
59 keep_directory=no
|
46183
|
60
|
|
61 ac_prev=
|
|
62 display_usage=false;
|
47808
|
63 config_options=;
|
46183
|
64 while test $# != 0
|
|
65 do
|
|
66 if test -n "$ac_prev"; then
|
|
67 eval "$ac_prev=\$1"
|
|
68 ac_prev=
|
|
69 continue
|
|
70 fi
|
|
71 case $1 in
|
|
72 -help | --help | --hel | --he | -h)
|
|
73 display_usage=yes ;;
|
|
74 -p | -prefix | --p | --prefix)
|
|
75 ac_prev=prefix ;;
|
|
76 -p=* | -prefix=* | --p=* | --prefix=*)
|
|
77 prefix=`expr "x$1" : 'x[^=]*=\(.*\)'` ;;
|
48990
|
78 --build-in-place | --build-in-place )
|
|
79 build_in_place=yes ;;
|
|
80 --build-dir | -build-dir | --builddir | -build-dir)
|
|
81 build_in_place=no
|
|
82 ac_prev=builddir;;
|
|
83 --build-dir=* | -build-dir=* | -builddir=* | --builddir=*)
|
|
84 build_in_place=no
|
|
85 builddir=`expr "x$1" : 'x[^=]*=\(.*\)'`;;
|
47782
de56ca3f523d
make-package: Now calls make bootstrap if .elc files are missing
Steven Tamm <steventamm@mac.com>
diff
changeset
|
86 -no-configure | -no-conf | --no-configure | --no-conf | --without-config)
|
46183
|
87 with_config=no ;;
|
47808
|
88 -no-app | --no-app | -without-app | --without-app)
|
|
89 with_app=no ;;
|
|
90 -without-x | --without-x)
|
|
91 with_x=no ;;
|
46183
|
92 -with-x | --with-x)
|
47808
|
93 with_x=yes
|
|
94 with_app=no ;;
|
48616
|
95 --without-full-dist | -without-full-dist | -no-full-dist | -no-full)
|
|
96 full_dist=no ;;
|
48749
|
97 --self-contained | -self-contained | --with-self-contained-app | -sc)
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
98 self_contained=yes ;;
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
99 -app-symlink | --app-symlink | -symlink | --symlink | --asl)
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
100 app_symlink=yes ;;
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
101 --keep-dir)
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
102 keep_directory=yes ;;
|
47808
|
103 -C,* | -c,*)
|
|
104 config_options="$config_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;;
|
|
105 -M,* | -m,*)
|
|
106 make_options="$make_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;;
|
48749
|
107 *)
|
|
108 display_usage=yes ;;
|
46183
|
109 esac
|
|
110 shift
|
|
111 done
|
|
112
|
47808
|
113 if test "$with_x" = "no"; then
|
|
114 config_options="--without-x $config_options"
|
|
115 fi
|
|
116
|
46183
|
117 if test "$display_usage" = "yes"; then
|
|
118 cat <<EOF
|
49600
|
119 \`make-package' generates a Mac OS X installer package from an Emacs
|
|
120 distribution. By default, this first runs ./configure on the emacs
|
|
121 directory. Then make install to create the emacs distribution.
|
|
122 Then some mac-specific commands to generate the required information
|
47808
|
123 for the mac package. The installer will, by default, create a
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
124 Carbon application called Emacs in the ${appsdir} directory, with the
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
125 shared emacs files in /usr/local
|
46183
|
126
|
|
127 Usage: $0 [OPTION]
|
|
128
|
|
129 Options:
|
|
130 -h, --help display this help and exit
|
|
131 --prefix=DIR Set install location for the Mac OS X package
|
|
132 of the emacs related file. By default /usr/local
|
|
133 --no-conf Do not run the configure script before running
|
|
134 make install.
|
47808
|
135 --without-app Do not create the Emacs application bundle
|
49600
|
136 --with-x Setup the install to use X Windows for its
|
47808
|
137 windowed display, instead of carbon. Implies
|
|
138 --without-app.
|
48616
|
139 --without-full-dist Do not include all the .el files in the distribution.
|
|
140 This is discouraged except if disk space is critical.
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
141 --app-symlink Have the Emacs.app executable be a symlink
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
142 to the install in [prefix]/bin/emacs and have
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
143 the emacs executable link to emacs-${version}
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
144 --self-contained Create an Emacs.app that is self-contained;
|
49600
|
145 prefix will be ignored and all files installed
|
|
146 inside the application
|
48990
|
147 --build-in-place Build the application in the source directory
|
49600
|
148 instead of a temporary directory.
|
48990
|
149 --build-dir=DIR Build the application in the specified directory
|
|
150 instead of a temporary directory. Mutually exclusive
|
|
151 with --build-in-place.
|
47808
|
152 -C,option Pass option to configure
|
|
153 -M,option Pass option to make
|
46183
|
154 EOF
|
|
155 exit 0
|
46177
|
156 fi
|
|
157
|
|
158 ### Exit if a command fails.
|
|
159 #set -e
|
|
160
|
|
161 ### Print out each line we read, for debugging's sake.
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
162 #set -v
|
46177
|
163
|
|
164 LANGUAGE=C
|
|
165 LC_ALL=C
|
|
166 LC_MESSAGES=
|
|
167 LANG=
|
|
168 export LANGUAGE LC_ALL LC_MESSAGES LANG
|
|
169
|
|
170 ## Don't restrict access to any files.
|
|
171 umask 0
|
|
172
|
|
173 ### Make sure we're running in the right place.
|
|
174 if [ -f Emacs.pkg ]; then
|
|
175 echo "${progname}: Package Emacs.pkg already exists.
|
|
176 Perhaps a previous invocation of \`${progname}' failed to clean up after
|
|
177 itself. Move or delete Emacs.pkg and try again." >&2
|
|
178 exit 1
|
|
179 fi
|
|
180
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
181 if test $with_app == "yes" && [ ! -f ${emapp}/Contents/PkgInfo ]; then
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
182 echo "${progname}: Can't find \`${emapp}/Contents/PkgInfo'" >&2
|
46177
|
183 echo "${progname} must be run in the \`mac' directory of the Emacs" >&2
|
|
184 echo "distribution tree. cd to that directory and try again." >&2
|
|
185 exit 1
|
|
186 fi
|
|
187
|
|
188 ### Check whether file ../lisp/version.el exists.
|
|
189 if [ ! -f ../lisp/version.el ]; then
|
|
190 echo "${progname}: Can't find \`../lisp/version.el'" >&2
|
|
191 exit 1
|
|
192 fi
|
|
193
|
|
194 ### Find out which version of Emacs this is.
|
|
195 shortversion=`grep 'defconst[ ]*emacs-version' ../lisp/version.el \
|
|
196 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
|
|
197 version=`grep 'defconst[ ]*emacs-version' ../lisp/version.el \
|
|
198 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
|
|
199 if [ ! "${version}" ]; then
|
|
200 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
|
|
201 exit 1
|
|
202 fi
|
|
203
|
|
204 echo Version numbers are $version and $shortversion
|
|
205
|
|
206 ### Make sure we don't already have a directory emacs-${version}.
|
|
207
|
|
208 emacsname="emacs-${version}${new_extension}"
|
|
209
|
|
210 if [ -d ${emacsname} ]
|
|
211 then
|
|
212 echo Directory "${emacsname}" already exists >&2
|
|
213 exit 1
|
|
214 fi
|
|
215
|
|
216 ### Make sure the subdirectory is available.
|
|
217 tempparent="make-package.tmp.$$"
|
|
218 if [ -d ${tempparent} ]; then
|
|
219 echo "${progname}: staging directory \`${tempparent}' already exists.
|
|
220 Perhaps a previous invocation of \`${progname}' failed to clean up after
|
|
221 itself. Check that directories whose names are of the form
|
|
222 \`make-dist.tmp.NNNNN' don't contain any important information, remove
|
|
223 them, and try again." >&2
|
|
224 exit 1
|
|
225 fi
|
|
226
|
|
227 if [ -d /Volumes/Emacs ]; then
|
|
228 echo "${progname}: Already have an Emacs disc image mounted. Please
|
|
229 eject that disc image and try again." >&2
|
|
230 exit 1
|
|
231 fi
|
|
232
|
|
233 tempparentfull="`pwd`/${tempparent}"
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
234 tempparentdist=${tempparentfull}/dist
|
46177
|
235
|
48990
|
236 if test "$build_in_place" = "no"; then
|
|
237 case ${builddir} in
|
|
238 ${srcdir})
|
|
239 tempbuild="make-package.build.$$"
|
|
240 builddir="`pwd`/${tempbuild}"
|
|
241 removable_build_dir=${builddir}
|
49230
|
242 mkdir -p ${builddir}
|
48990
|
243 ;;
|
|
244 [\\/]* | ?:[\\/]* ) #Absolutepath.
|
|
245 mkdir -p ${builddir}
|
|
246 ;;
|
|
247 *)
|
|
248 mkdir -p ${builddir}
|
|
249 builddir=`cd $builddir && pwd`
|
|
250 ;;
|
|
251 esac
|
|
252 fi
|
|
253 # Location of install package
|
|
254 packagedir=${builddir}/mac/Emacs.pkg
|
|
255
|
|
256 echo Building in directory ${builddir}
|
46177
|
257 echo Installing into directory ${tempparentfull} >&2
|
|
258
|
48990
|
259 ### This trap ensures that the staging directory will be cleaned up even
|
|
260 ### when the script is interrupted in mid-career.
|
|
261 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent} ${removable_build_dir} ${packagedir}; exit 1" 1 2 15
|
|
262
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
263 # Run configure in the new tempparent directory
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
264 if test "$with_config" = "yes"; then
|
48990
|
265 (cd ${builddir}; ${srcdir}/configure ${config_options} --prefix=${prefix})
|
46183
|
266 fi
|
|
267
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
268 installprefix=${tempparentfull}${prefix}
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
269 if test "$self_contained" = "yes"; then
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
270 # If selfcontained, the local directory is Resources directory
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
271 installprefix=$tempparentfull/$appsdir/$emapp/Contents/Resources
|
47782
de56ca3f523d
make-package: Now calls make bootstrap if .elc files are missing
Steven Tamm <steventamm@mac.com>
diff
changeset
|
272 fi
|
46177
|
273
|
49091
|
274
|
|
275 make_options="prefix=${installprefix} $make_options"
|
|
276
|
|
277 if test "$with_app" = "yes"; then
|
|
278 make_options="carbon_appdir=${tempparentfull}/Applications $make_options"
|
|
279 fi
|
|
280
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
281 ## Make bootstrap if .elc files are missing from distribution
|
48990
|
282 if [ ! -f ${srcdir}/lisp/abbrev.elc ]; then
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
283 echo "Required .elc files missing; making bootstrap..."
|
49091
|
284 if ! (cd ${builddir}; make bootstrap $make_options); then
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
285 echo "Make bootstrap failed... Aborting make-package."
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
286 exit 2
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
287 fi
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
288 fi
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
289
|
49091
|
290 if ! (cd ${builddir}; make install $make_options); then
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
291 echo "Make failed... Aborting make-package."
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
292 exit 1
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
293 fi
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
294
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
295 if test "$full_dist" == "no"; then
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
296 echo "Removing unneeded .el files"
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
297 sharedir=$installprefix/share/emacs/$version
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
298 find $sharedir/lisp $sharedir/leim -name "*.elc" -print | sed 's|\(.*\)\.elc$|/bin/rm -f \1.el|' | /bin/sh -s
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
299 fi
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
300
|
47808
|
301 if test "$with_app" == "yes"; then
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
302 echo "Creating Emacs.app application"
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
303 tempappdir=${tempparentfull}${appsdir}
|
48749
|
304 tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs
|
47808
|
305 ## Delete any CVS files
|
48789
|
306 find ${tempappdir} -name "CVS" -type d -exec rm -rf {} \;
|
48749
|
307
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
308 ## Have application be a symlink to ${prefix}/bin/emacs
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
309 if test "$app_symlink" == "yes"; then
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
310 echo "Creating application symlink"
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
311 rm ${tempemapp}
|
48749
|
312 ln -s ${prefix}/bin/${emacsname} ${tempemapp}
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
313 fi
|
47808
|
314 fi
|
46177
|
315
|
50450
33c5c2bf40c2
Place libexec executables directly under the Contents/MacOS/libexec if
Steven Tamm <steventamm@mac.com>
diff
changeset
|
316 compver=powerpc-apple-darwin`uname -r`
|
33c5c2bf40c2
Place libexec executables directly under the Contents/MacOS/libexec if
Steven Tamm <steventamm@mac.com>
diff
changeset
|
317
|
48749
|
318 if test "$self_contained" = "yes"; then
|
|
319 # Move shared files down to Resources directory
|
|
320 mv $installprefix/share/emacs/$version/* $installprefix
|
|
321 rm -rf $installprefix/share
|
|
322 # These directories might remain in Resources
|
|
323 mv $installprefix/bin $installprefix/../MacOS/bin
|
50450
33c5c2bf40c2
Place libexec executables directly under the Contents/MacOS/libexec if
Steven Tamm <steventamm@mac.com>
diff
changeset
|
324 mv $installprefix/libexec/emacs/$version/$compver $installprefix/../MacOS/libexec
|
48749
|
325 # Make the application binary a hard link
|
|
326 rm $installprefix/../MacOS/Emacs
|
|
327 ln $installprefix/../MacOS/bin/emacs $installprefix/../MacOS/Emacs
|
|
328 fi
|
|
329
|
|
330
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
331 # Remove unnecessary .el files
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
332 #if test "$full_dist" = no; then
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
333 #fi
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
334
|
46177
|
335 echo "Creating Package Info file"
|
|
336
|
49230
|
337 mkdir -p ${packagedir}
|
48990
|
338 mkdir ${packagedir}/Contents
|
|
339 mkdir ${packagedir}/Contents/Resources
|
|
340 mkdir ${packagedir}/Contents/Resources/English.lproj
|
49005
|
341 echo -n 'pmkrpkg1' > ${packagedir}/Contents/PkgInfo
|
|
342
|
|
343 # Create ReadMe and License files
|
|
344 cp ${srcdir}/COPYING ${packagedir}/Contents/Resources/License.txt
|
|
345 cp ${srcdir}/mac/README ${packagedir}/Contents/Resources/ReadMe.txt
|
46177
|
346
|
48990
|
347 infofile=${packagedir}/Contents/Resources/English.lproj/Emacs.info
|
46177
|
348
|
48990
|
349 echo 'Title GNU Emacs' > ${infofile}
|
46177
|
350 echo "Version ${version}" >> ${infofile}
|
|
351 echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile}
|
|
352 echo 'DefaultLocation /' >> ${infofile}
|
|
353 echo 'DeleteWarning' >> ${infofile}
|
|
354 echo 'NeedsAuthorization YES' >> ${infofile}
|
|
355 echo 'Required NO' >> ${infofile}
|
|
356 echo 'Relocatable NO' >> ${infofile}
|
|
357 echo 'RequiresReboot NO' >> ${infofile}
|
|
358 echo 'UseUserMask NO' >> ${infofile}
|
|
359 echo 'OverwritePermissions NO' >> ${infofile}
|
|
360 echo 'InstallFat NO' >> ${infofile}
|
|
361
|
49600
|
362 ### Set the install directory to install files as root...
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
363 ### Not sure if this is a good diea
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
364 # echo "Setting owner to root"
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
365 # chown -Rh 0 ${tempparentfull}
|
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
366
|
46177
|
367 echo "Creating pax file"
|
48990
|
368 (cd ${tempparentfull}; pax -w -f ${packagedir}/Contents/Resources/Emacs.pax .)
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
369 echo "Compressing pax file"
|
48990
|
370 gzip ${packagedir}/Contents/Resources/Emacs.pax
|
46177
|
371
|
|
372 echo "Creating bom file"
|
48990
|
373 mkbom ${tempparentfull} ${packagedir}/Contents/Resources/Emacs.bom
|
46177
|
374
|
|
375 echo "Generating sizes file"
|
48990
|
376 sizesfile=${packagedir}/Contents/Resources/Emacs.sizes
|
46177
|
377
|
48979
|
378 numFiles=`du -a ${tempparent} | wc -l`
|
|
379 installedSize=`du -s ${tempparent} | cut -f1`
|
48990
|
380 compressedSize=`du -s ${packagedir} | cut -f1`
|
46177
|
381
|
|
382 echo "NumFiles ${numFiles}" > ${sizesfile}
|
|
383 echo "InstalledSize ${installedSize}" >> ${sizesfile}
|
|
384 echo "CompressedSize ${compressedSize}" >> ${sizesfile}
|
|
385 cat ${sizesfile}
|
|
386
|
|
387 echo "Creating Disc Image"
|
50724
efd65678bb08
* make-package: Allocate 5% extra space on disk image for directories
Andrew Choi <akochoi@shaw.ca>
diff
changeset
|
388 ## From hdiutil man page, a sector is 512k. Allocate an extra 5% for
|
efd65678bb08
* make-package: Allocate 5% extra space on disk image for directories
Andrew Choi <akochoi@shaw.ca>
diff
changeset
|
389 ## directories and partition tables.
|
efd65678bb08
* make-package: Allocate 5% extra space on disk image for directories
Andrew Choi <akochoi@shaw.ca>
diff
changeset
|
390 sectorsAlloced=`echo 2.1*${compressedSize}|bc`
|
48990
|
391 hdiutil create -ov ${builddir}/mac/EmacsRW -sectors ${sectorsAlloced}
|
46177
|
392 ## Need to format the disc image before mounting
|
48990
|
393 mountLoc=`hdid -nomount ${builddir}/mac/EmacsRW.dmg | grep HFS | cut -f1`
|
46177
|
394 /sbin/newfs_hfs -v Emacs ${mountLoc}
|
|
395 hdiutil eject ${mountLoc}
|
|
396 echo "Copying Package to Disc Image"
|
48990
|
397 hdid ${builddir}/mac/EmacsRW.dmg
|
46177
|
398
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
399 if test "$keep_directory" = "no"; then
|
48990
|
400 rm -rf ${tempparentfull}
|
|
401 else
|
|
402 mv ${tempparentfull} ${emacsname}
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
403 fi
|
46177
|
404
|
|
405 if [ ! -d /Volumes/Emacs ]; then
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
406 echo "Could not create disc image. The Emacs installer package (Emacs.pkg)
|
49600
|
407 in this directory should be correct. Please use the Disc Copy program to
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
408 create a disc image." >&2
|
46177
|
409 exit 0
|
|
410 fi
|
|
411
|
48990
|
412 cp -R ${packagedir} /Volumes/Emacs
|
46177
|
413
|
|
414 ## Converting Disk Image to read-only
|
|
415 echo 'Converting Disc Image to read-only'
|
|
416 hdiutil eject ${mountLoc}
|
48990
|
417 hdiutil resize ${builddir}/mac/EmacsRW.dmg -sectors min
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
418 if test "$comp_diskimage" = "yes"; then
|
48990
|
419 hdiutil convert ${builddir}/mac/EmacsRW.dmg -format UDZO -imagekey zlib-level=2 -o ${srcdir}/mac/EmacsInstaller.dmg
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
420 else
|
48990
|
421 hdiutil convert ${builddir}/mac/EmacsRW.dmg -format UDRO -o ${srcdir}/mac/EmacsInstaller.dmg
|
48603
ac86b769c135
Added a lot of options to reduce disk size of both the installer and the final
Steven Tamm <steventamm@mac.com>
diff
changeset
|
422 fi
|
48990
|
423 rm ${builddir}/mac/EmacsRW.dmg
|
46177
|
424
|
|
425 echo "Cleaning up the staging directory"
|
48990
|
426 rm -rf ${builddir}/mac/Emacs.pkg ${removable_build_dir}
|
46177
|
427
|
52401
|
428 # arch-tag: 1b631d0d-9fde-4f71-80c0-33e0e5815515
|
46177
|
429 ### make-package ends here
|