diff options
| author | Steven Tamm | 2002-11-30 22:06:38 +0000 |
|---|---|---|
| committer | Steven Tamm | 2002-11-30 22:06:38 +0000 |
| commit | 876e727eb5e0fe55fab67ae6389b2d158972951a (patch) | |
| tree | 363cca329e5e557d6c1bae3d5ce01cc55f80edc2 /mac/make-package | |
| parent | 1fc3ed85431cb6af9bca5c4d895c2c3afb0374ee (diff) | |
| download | emacs-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-x | mac/make-package | 121 |
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 | ||
| 42 | progname="$0" | 42 | progname="$0" |
| 43 | ## Default location to place it is /usr/local | ||
| 44 | 43 | ||
| 44 | srcdir="`pwd`/.." | ||
| 45 | builddir=.. | ||
| 46 | |||
| 47 | ## Default location to place it is /usr/local | ||
| 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; |
| @@ -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 | |||
| 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 | ||
| @@ -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 |
| 112 | EOF | 139 | EOF |
| @@ -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. |
| 120 | set -v | 147 | #set -v |
| 121 | 148 | ||
| 122 | LANGUAGE=C | 149 | LANGUAGE=C |
| 123 | LC_ALL=C | 150 | LC_ALL=C |
| @@ -136,8 +163,8 @@ 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 |
| @@ -189,40 +216,78 @@ eject that disc image and try again." >&2 | |||
| 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 |
| 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 | ||
| 197 | fi | 232 | fi |
| 198 | 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 | ||
| 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 {} \; |
| 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 | ||
| 224 | fi | 285 | fi |
| 225 | 286 | ||
| 287 | # Remove unnecessary .el files | ||
| 288 | #if test "$full_dist" = no; then | ||
| 289 | #fi | ||
| 290 | |||
| 226 | echo "Creating Package Info file" | 291 | echo "Creating Package Info file" |
| 227 | 292 | ||
| 228 | mkdir Emacs.pkg | 293 | mkdir Emacs.pkg |
| @@ -246,10 +311,15 @@ 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 |
| @@ -280,12 +350,14 @@ 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 | ||
| @@ -295,8 +367,11 @@ cp -R Emacs.pkg /Volumes/Emacs | |||
| 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" |