aboutsummaryrefslogtreecommitdiffstats
path: root/mac/make-package
diff options
context:
space:
mode:
authorSteven Tamm2002-11-30 22:06:38 +0000
committerSteven Tamm2002-11-30 22:06:38 +0000
commit876e727eb5e0fe55fab67ae6389b2d158972951a (patch)
tree363cca329e5e557d6c1bae3d5ce01cc55f80edc2 /mac/make-package
parent1fc3ed85431cb6af9bca5c4d895c2c3afb0374ee (diff)
downloademacs-876e727eb5e0fe55fab67ae6389b2d158972951a.tar.gz
emacs-876e727eb5e0fe55fab67ae6389b2d158972951a.zip
Added a lot of options to reduce disk size of both the installer and the final
application. Added option to make installer generate self-contained Emacs.app. Now nolonger creates a "full-dist" by default, by omitting .el files that have already been compiled.
Diffstat (limited to 'mac/make-package')
-rwxr-xr-xmac/make-package121
1 files changed, 98 insertions, 23 deletions
diff --git a/mac/make-package b/mac/make-package
index b8c8f36ca87..759f1654396 100755
--- a/mac/make-package
+++ b/mac/make-package
@@ -40,12 +40,22 @@
40# Contributed by Steven Tamm (steventamm@mac.com). 40# Contributed by Steven Tamm (steventamm@mac.com).
41 41
42progname="$0" 42progname="$0"
43## Default location to place it is /usr/local
44 43
44srcdir="`pwd`/.."
45builddir=..
46
47## Default location to place it is /usr/local
45prefix=/usr/local 48prefix=/usr/local
49appsdir=/Applications
50emapp=Emacs.app
46with_config=yes 51with_config=yes
47with_app=yes 52with_app=yes
48with_x=no 53with_x=no
54comp_diskimage=yes
55self_contained=no
56app_symlink=no
57full_dist=no
58keep_directory=no
49 59
50ac_prev= 60ac_prev=
51display_usage=false; 61display_usage=false;
@@ -73,6 +83,14 @@ do
73 -with-x | --with-x) 83 -with-x | --with-x)
74 with_x=yes 84 with_x=yes
75 with_app=no ;; 85 with_app=no ;;
86 --with-full-dist | -with-full-dist | -full-dist | -full)
87 full_dist=yes ;;
88 -self-contained | --with-self-contained-app | -sc)
89 self_contained=yes ;;
90 -app-symlink | --app-symlink | -symlink | --symlink | --asl)
91 app_symlink=yes ;;
92 --keep-dir)
93 keep_directory=yes ;;
76 -C,* | -c,*) 94 -C,* | -c,*)
77 config_options="$config_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;; 95 config_options="$config_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;;
78 -M,* | -m,*) 96 -M,* | -m,*)
@@ -93,7 +111,8 @@ distribution. By default, this first runs ./configure on the emacs
93directory. Then make install to create the emacs distribution. 111directory. Then make install to create the emacs distribution.
94Then some mac-specific commands to generate the required information 112Then some mac-specific commands to generate the required information
95for the mac package. The installer will, by default, create a 113for the mac package. The installer will, by default, create a
96Carbon application called Emacs in the /Applications directory, and 114Carbon application called Emacs in the ${appsdir} directory, with the
115shared emacs files in /usr/local
97 116
98Usage: $0 [OPTION] 117Usage: $0 [OPTION]
99 118
@@ -107,6 +126,14 @@ Options:
107 --with-x Setup the install to use X Windows for its 126 --with-x Setup the install to use X Windows for its
108 windowed display, instead of carbon. Implies 127 windowed display, instead of carbon. Implies
109 --without-app. 128 --without-app.
129 --with-full-dist Include all the .el files in the distribution.
130 Default is to include only .elc files
131 --app-symlink Have the Emacs.app executable be a symlink
132 to the install in [prefix]/bin/emacs and have
133 the emacs executable link to emacs-${version}
134 --self-contained Create an Emacs.app that is self-contained;
135 prefix will be ignored and all files installed
136 inside the application
110 -C,option Pass option to configure 137 -C,option Pass option to configure
111 -M,option Pass option to make 138 -M,option Pass option to make
112EOF 139EOF
@@ -117,7 +144,7 @@ fi
117#set -e 144#set -e
118 145
119### Print out each line we read, for debugging's sake. 146### Print out each line we read, for debugging's sake.
120set -v 147#set -v
121 148
122LANGUAGE=C 149LANGUAGE=C
123LC_ALL=C 150LC_ALL=C
@@ -136,8 +163,8 @@ itself. Move or delete Emacs.pkg and try again." >&2
136 exit 1 163 exit 1
137fi 164fi
138 165
139if test $with_app == "yes" && [ ! -f Emacs.app/Contents/PkgInfo ]; then 166if test $with_app == "yes" && [ ! -f ${emapp}/Contents/PkgInfo ]; then
140 echo "${progname}: Can't find \`Emacs.app/Contents/PkgInfo'" >&2 167 echo "${progname}: Can't find \`${emapp}/Contents/PkgInfo'" >&2
141 echo "${progname} must be run in the \`mac' directory of the Emacs" >&2 168 echo "${progname} must be run in the \`mac' directory of the Emacs" >&2
142 echo "distribution tree. cd to that directory and try again." >&2 169 echo "distribution tree. cd to that directory and try again." >&2
143 exit 1 170 exit 1
@@ -189,40 +216,78 @@ eject that disc image and try again." >&2
189fi 216fi
190 217
191tempparentfull="`pwd`/${tempparent}" 218tempparentfull="`pwd`/${tempparent}"
219tempparentdist=${tempparentfull}/dist
192 220
193echo Installing into directory ${tempparentfull} >&2 221echo Installing into directory ${tempparentfull} >&2
194 222
195if test "$with_config" = yes; then 223# Run configure in the new tempparent directory
196 (cd ..; ./configure ${config_options} --prefix=${prefix};) 224if test "$with_config" = "yes"; then
225 (cd ..; ./configure ${config_options} --prefix=${prefix})
226fi
227
228installprefix=${tempparentfull}${prefix}
229if test "$self_contained" = "yes"; then
230 # If selfcontained, the local directory is Resources directory
231 installprefix=$tempparentfull/$appsdir/$emapp/Contents/Resources
197fi 232fi
198 233
234### This trap ensures that the staging directory will be cleaned up even
235### when the script is interrupted in mid-career.
236trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; rm -rf Emacs.pkg; exit 1" 1 2 15
237
199## Make bootstrap if .elc files are missing from distribution 238## Make bootstrap if .elc files are missing from distribution
200if [ ! -f ../lisp/abbrev.elc ]; then 239if [ ! -f ../lisp/abbrev.elc ]; then
201 echo "Required .elc files missing; making bootstrap..." 240 echo "Required .elc files missing; making bootstrap..."
202 if ! (cd ..; make bootstrap prefix=${tempparentfull}${prefix} $make_options); then 241 if ! (cd ${builddir}; make bootstrap prefix=$installprefix $make_options); then
203 echo "Make bootstrap failed... Aborting make-package." 242 echo "Make bootstrap failed... Aborting make-package."
204 exit 2 243 exit 2
205 fi 244 fi
206fi 245fi
207 246
208if ! (cd ..; make install prefix=${tempparentfull}${prefix} $make_options); then 247if ! (cd ${builddir}; make install prefix=$installprefix $make_options); then
209 echo "Make failed... Aborting make-package." 248 echo "Make failed... Aborting make-package."
210 exit 1 249 exit 1
211fi 250fi
212 251
213### This trap ensures that the staging directory will be cleaned up even 252if test "$full_dist" == "no"; then
214### when the script is interrupted in mid-career. 253 echo "Removing unneeded .el files"
215trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; rm -rf Emacs.pkg; exit 1" 1 2 15 254 sharedir=$installprefix/share/emacs/$version
255 find $sharedir/lisp $sharedir/leim -name "*.elc" -print | sed 's|\(.*\)\.elc$|/bin/rm -f \1.el|' | /bin/sh -s
256fi
257
258if test "$app_symlink" == "yes"; then
259 echo "Replacing bin/emacs with a symbolic link..."
260 # Fix emacs symlink
261 rm ${installprefix}/bin/emacs
262 ln -s $emacsname ${installprefix}/bin/emacs
263fi
216 264
217if test "$with_app" == "yes"; then 265if test "$with_app" == "yes"; then
218 mkdir ${tempparentfull}/Applications 266 echo "Creating Emacs.app application"
267 tempappdir=${tempparentfull}${appsdir}
268 mkdir ${tempappdir}
219 269
220 ## Copy Emacs application 270 ## Copy Emacs application
221 cp -r Emacs.app ${tempparentfull}/Applications 271 cp -r Emacs.app ${tempappdir}
222 ## Delete any CVS files 272 ## Delete any CVS files
223 find ${tempparentfull}/Applications -name "CVS" -type d -exec rm -r {} \; 273 find ${tempappdir} -name "CVS" -type d -execdir rm -rf {} \;
274 ## Have application be a symlink to ${prefix}/bin/emacs
275 if test "$app_symlink" == "yes"; then
276 echo "Creating application symlink"
277 tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs
278 rm ${tempemapp}
279 if test "$self_contained" = "yes"; then
280 ln -s ../../Contents/Resources/bin/${emacsname} ${tempemapp}
281 else
282 ln -s ${prefix}/bin/${emacsname} ${tempemapp}
283 fi
284 fi
224fi 285fi
225 286
287# Remove unnecessary .el files
288#if test "$full_dist" = no; then
289#fi
290
226echo "Creating Package Info file" 291echo "Creating Package Info file"
227 292
228mkdir Emacs.pkg 293mkdir Emacs.pkg
@@ -246,10 +311,15 @@ echo 'UseUserMask NO' >> ${infofile}
246echo 'OverwritePermissions NO' >> ${infofile} 311echo 'OverwritePermissions NO' >> ${infofile}
247echo 'InstallFat NO' >> ${infofile} 312echo 'InstallFat NO' >> ${infofile}
248 313
314### Set the install directory to install files as root...
315### Not sure if this is a good diea
316# echo "Setting owner to root"
317# chown -Rh 0 ${tempparentfull}
318
249echo "Creating pax file" 319echo "Creating pax file"
250(cd ${tempparentfull}; pax -w -f ../Emacs.pkg/Contents/Resources/Emacs.pax .; cd ..) 320(cd ${tempparentfull}; pax -w -f ../Emacs.pkg/Contents/Resources/Emacs.pax .; cd ..)
251#echo "Compressing pax file" 321echo "Compressing pax file"
252#gzip Emacs.pkg/Contents/Resources/Emacs.pax 322gzip Emacs.pkg/Contents/Resources/Emacs.pax
253 323
254echo "Creating bom file" 324echo "Creating bom file"
255mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom 325mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom
@@ -280,12 +350,14 @@ hdiutil eject ${mountLoc}
280echo "Copying Package to Disc Image" 350echo "Copying Package to Disc Image"
281hdid EmacsRW.dmg 351hdid EmacsRW.dmg
282 352
283rm -rf ${emacsname} 353if test "$keep_directory" = "no"; then
354 rm -rf ${emacsname}
355fi
284 356
285if [ ! -d /Volumes/Emacs ]; then 357if [ ! -d /Volumes/Emacs ]; then
286 echo "Could not create disc image. The Emacs installer package in this 358 echo "Could not create disc image. The Emacs installer package (Emacs.pkg)
287directory should be correct. Please use the Disc Copy program to create 359in this directory should be correct. Please use the Disc Copy program to
288a disc image." >&2 360create a disc image." >&2
289 exit 0 361 exit 0
290fi 362fi
291 363
@@ -295,8 +367,11 @@ cp -R Emacs.pkg /Volumes/Emacs
295echo 'Converting Disc Image to read-only' 367echo 'Converting Disc Image to read-only'
296hdiutil eject ${mountLoc} 368hdiutil eject ${mountLoc}
297hdiutil resize EmacsRW.dmg -sectors min 369hdiutil resize EmacsRW.dmg -sectors min
298hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg 370if test "$comp_diskimage" = "yes"; then
299gzip EmacsInstaller.dmg 371 hdiutil convert EmacsRW.dmg -format UDZO -imagekey zlib-level=2 -o EmacsInstaller.dmg
372else
373 hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg
374fi
300rm EmacsRW.dmg 375rm EmacsRW.dmg
301 376
302echo "Cleaning up the staging directory" 377echo "Cleaning up the staging directory"