Mercurial > emacs
comparison mac/make-package @ 48603:ac86b769c135
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.
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Sat, 30 Nov 2002 22:06:23 +0000 |
parents | 52e9e2b86007 |
children | a3fe4bde49d3 |
comparison
equal
deleted
inserted
replaced
48602:f819c7a2dd98 | 48603:ac86b769c135 |
---|---|
38 # Boston, MA 02111-1307, USA. | 38 # Boston, MA 02111-1307, USA. |
39 # | 39 # |
40 # Contributed by Steven Tamm (steventamm@mac.com). | 40 # Contributed by Steven Tamm (steventamm@mac.com). |
41 | 41 |
42 progname="$0" | 42 progname="$0" |
43 | |
44 srcdir="`pwd`/.." | |
45 builddir=.. | |
46 | |
43 ## Default location to place it is /usr/local | 47 ## Default location to place it is /usr/local |
44 | |
45 prefix=/usr/local | 48 prefix=/usr/local |
49 appsdir=/Applications | |
50 emapp=Emacs.app | |
46 with_config=yes | 51 with_config=yes |
47 with_app=yes | 52 with_app=yes |
48 with_x=no | 53 with_x=no |
54 comp_diskimage=yes | |
55 self_contained=no | |
56 app_symlink=no | |
57 full_dist=no | |
58 keep_directory=no | |
49 | 59 |
50 ac_prev= | 60 ac_prev= |
51 display_usage=false; | 61 display_usage=false; |
52 config_options=; | 62 config_options=; |
53 while test $# != 0 | 63 while test $# != 0 |
71 -without-x | --without-x) | 81 -without-x | --without-x) |
72 with_x=no ;; | 82 with_x=no ;; |
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,*) |
79 make_options="$make_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;; | 97 make_options="$make_options `expr "x$1" : 'x[^,]*,\(.*\)'`" ;; |
80 | 98 |
91 \`make-package' generates a Mac OS X installer package from an Emacs | 109 \`make-package' generates a Mac OS X installer package from an Emacs |
92 distribution. By default, this first runs ./configure on the emacs | 110 distribution. By default, this first runs ./configure on the emacs |
93 directory. Then make install to create the emacs distribution. | 111 directory. Then make install to create the emacs distribution. |
94 Then some mac-specific commands to generate the required information | 112 Then some mac-specific commands to generate the required information |
95 for the mac package. The installer will, by default, create a | 113 for the mac package. The installer will, by default, create a |
96 Carbon application called Emacs in the /Applications directory, and | 114 Carbon application called Emacs in the ${appsdir} directory, with the |
115 shared emacs files in /usr/local | |
97 | 116 |
98 Usage: $0 [OPTION] | 117 Usage: $0 [OPTION] |
99 | 118 |
100 Options: | 119 Options: |
101 -h, --help display this help and exit | 120 -h, --help display this help and exit |
105 make install. | 124 make install. |
106 --without-app Do not create the Emacs application bundle | 125 --without-app Do not create the Emacs application bundle |
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 |
112 EOF | 139 EOF |
113 exit 0 | 140 exit 0 |
114 fi | 141 fi |
115 | 142 |
116 ### Exit if a command fails. | 143 ### Exit if a command fails. |
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. |
120 set -v | 147 #set -v |
121 | 148 |
122 LANGUAGE=C | 149 LANGUAGE=C |
123 LC_ALL=C | 150 LC_ALL=C |
124 LC_MESSAGES= | 151 LC_MESSAGES= |
125 LANG= | 152 LANG= |
134 Perhaps a previous invocation of \`${progname}' failed to clean up after | 161 Perhaps a previous invocation of \`${progname}' failed to clean up after |
135 itself. Move or delete Emacs.pkg and try again." >&2 | 162 itself. Move or delete Emacs.pkg and try again." >&2 |
136 exit 1 | 163 exit 1 |
137 fi | 164 fi |
138 | 165 |
139 if test $with_app == "yes" && [ ! -f Emacs.app/Contents/PkgInfo ]; then | 166 if 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 |
144 fi | 171 fi |
145 | 172 |
187 eject that disc image and try again." >&2 | 214 eject that disc image and try again." >&2 |
188 exit 1 | 215 exit 1 |
189 fi | 216 fi |
190 | 217 |
191 tempparentfull="`pwd`/${tempparent}" | 218 tempparentfull="`pwd`/${tempparent}" |
219 tempparentdist=${tempparentfull}/dist | |
192 | 220 |
193 echo Installing into directory ${tempparentfull} >&2 | 221 echo Installing into directory ${tempparentfull} >&2 |
194 | 222 |
195 if test "$with_config" = yes; then | 223 # Run configure in the new tempparent directory |
196 (cd ..; ./configure ${config_options} --prefix=${prefix};) | 224 if test "$with_config" = "yes"; then |
197 fi | 225 (cd ..; ./configure ${config_options} --prefix=${prefix}) |
226 fi | |
227 | |
228 installprefix=${tempparentfull}${prefix} | |
229 if test "$self_contained" = "yes"; then | |
230 # If selfcontained, the local directory is Resources directory | |
231 installprefix=$tempparentfull/$appsdir/$emapp/Contents/Resources | |
232 fi | |
233 | |
234 ### This trap ensures that the staging directory will be cleaned up even | |
235 ### when the script is interrupted in mid-career. | |
236 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; rm -rf Emacs.pkg; exit 1" 1 2 15 | |
198 | 237 |
199 ## Make bootstrap if .elc files are missing from distribution | 238 ## Make bootstrap if .elc files are missing from distribution |
200 if [ ! -f ../lisp/abbrev.elc ]; then | 239 if [ ! -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 |
206 fi | 245 fi |
207 | 246 |
208 if ! (cd ..; make install prefix=${tempparentfull}${prefix} $make_options); then | 247 if ! (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 |
211 fi | 250 fi |
212 | 251 |
213 ### This trap ensures that the staging directory will be cleaned up even | 252 if test "$full_dist" == "no"; then |
214 ### when the script is interrupted in mid-career. | 253 echo "Removing unneeded .el files" |
215 trap "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 | |
256 fi | |
257 | |
258 if 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 | |
263 fi | |
216 | 264 |
217 if test "$with_app" == "yes"; then | 265 if 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 {} \; |
224 fi | 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 | |
285 fi | |
286 | |
287 # Remove unnecessary .el files | |
288 #if test "$full_dist" = no; then | |
289 #fi | |
225 | 290 |
226 echo "Creating Package Info file" | 291 echo "Creating Package Info file" |
227 | 292 |
228 mkdir Emacs.pkg | 293 mkdir Emacs.pkg |
229 mkdir Emacs.pkg/Contents | 294 mkdir Emacs.pkg/Contents |
244 echo 'RequiresReboot NO' >> ${infofile} | 309 echo 'RequiresReboot NO' >> ${infofile} |
245 echo 'UseUserMask NO' >> ${infofile} | 310 echo 'UseUserMask NO' >> ${infofile} |
246 echo 'OverwritePermissions NO' >> ${infofile} | 311 echo 'OverwritePermissions NO' >> ${infofile} |
247 echo 'InstallFat NO' >> ${infofile} | 312 echo '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 | |
249 echo "Creating pax file" | 319 echo "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" | 321 echo "Compressing pax file" |
252 #gzip Emacs.pkg/Contents/Resources/Emacs.pax | 322 gzip Emacs.pkg/Contents/Resources/Emacs.pax |
253 | 323 |
254 echo "Creating bom file" | 324 echo "Creating bom file" |
255 mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom | 325 mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom |
256 | 326 |
257 echo "Generating sizes file" | 327 echo "Generating sizes file" |
278 /sbin/newfs_hfs -v Emacs ${mountLoc} | 348 /sbin/newfs_hfs -v Emacs ${mountLoc} |
279 hdiutil eject ${mountLoc} | 349 hdiutil eject ${mountLoc} |
280 echo "Copying Package to Disc Image" | 350 echo "Copying Package to Disc Image" |
281 hdid EmacsRW.dmg | 351 hdid EmacsRW.dmg |
282 | 352 |
283 rm -rf ${emacsname} | 353 if test "$keep_directory" = "no"; then |
354 rm -rf ${emacsname} | |
355 fi | |
284 | 356 |
285 if [ ! -d /Volumes/Emacs ]; then | 357 if [ ! -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) |
287 directory should be correct. Please use the Disc Copy program to create | 359 in this directory should be correct. Please use the Disc Copy program to |
288 a disc image." >&2 | 360 create a disc image." >&2 |
289 exit 0 | 361 exit 0 |
290 fi | 362 fi |
291 | 363 |
292 cp -R Emacs.pkg /Volumes/Emacs | 364 cp -R Emacs.pkg /Volumes/Emacs |
293 | 365 |
294 ## Converting Disk Image to read-only | 366 ## Converting Disk Image to read-only |
295 echo 'Converting Disc Image to read-only' | 367 echo 'Converting Disc Image to read-only' |
296 hdiutil eject ${mountLoc} | 368 hdiutil eject ${mountLoc} |
297 hdiutil resize EmacsRW.dmg -sectors min | 369 hdiutil resize EmacsRW.dmg -sectors min |
298 hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg | 370 if test "$comp_diskimage" = "yes"; then |
299 gzip EmacsInstaller.dmg | 371 hdiutil convert EmacsRW.dmg -format UDZO -imagekey zlib-level=2 -o EmacsInstaller.dmg |
372 else | |
373 hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg | |
374 fi | |
300 rm EmacsRW.dmg | 375 rm EmacsRW.dmg |
301 | 376 |
302 echo "Cleaning up the staging directory" | 377 echo "Cleaning up the staging directory" |
303 rm -rf Emacs.pkg | 378 rm -rf Emacs.pkg |
304 | 379 |