diff options
| author | Steven Tamm | 2002-12-29 07:34:48 +0000 |
|---|---|---|
| committer | Steven Tamm | 2002-12-29 07:34:48 +0000 |
| commit | 52efaffcc3995130d656c9d18f57dcfe9697edf9 (patch) | |
| tree | df5bf1f7123559a040ecdec828ea6aef34120db6 /mac/make-package | |
| parent | 1dc788eba88cfbcc1eb7e1069a7d090a209d2f39 (diff) | |
| download | emacs-52efaffcc3995130d656c9d18f57dcfe9697edf9.tar.gz emacs-52efaffcc3995130d656c9d18f57dcfe9697edf9.zip | |
* make-package: Defaults to building the source tree in a
separate directory. Use the new option --build-in-place to
have old behavior. Added new option --build-dir to specify the
build directory
Diffstat (limited to 'mac/make-package')
| -rwxr-xr-x | mac/make-package | 100 |
1 files changed, 67 insertions, 33 deletions
diff --git a/mac/make-package b/mac/make-package index dc058588f1e..3f02d42cf89 100755 --- a/mac/make-package +++ b/mac/make-package | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | progname="$0" | 42 | progname="$0" |
| 43 | 43 | ||
| 44 | srcdir="`pwd`/.." | 44 | srcdir="`pwd`/.." |
| 45 | builddir=.. | 45 | builddir=${srcdir} |
| 46 | 46 | ||
| 47 | ## Default location to place it is /usr/local | 47 | ## Default location to place it is /usr/local |
| 48 | prefix=/usr/local | 48 | prefix=/usr/local |
| @@ -55,6 +55,7 @@ comp_diskimage=yes | |||
| 55 | self_contained=no | 55 | self_contained=no |
| 56 | app_symlink=no | 56 | app_symlink=no |
| 57 | full_dist=yes | 57 | full_dist=yes |
| 58 | build_in_place=no | ||
| 58 | keep_directory=no | 59 | keep_directory=no |
| 59 | 60 | ||
| 60 | ac_prev= | 61 | ac_prev= |
| @@ -74,6 +75,14 @@ do | |||
| 74 | ac_prev=prefix ;; | 75 | ac_prev=prefix ;; |
| 75 | -p=* | -prefix=* | --p=* | --prefix=*) | 76 | -p=* | -prefix=* | --p=* | --prefix=*) |
| 76 | prefix=`expr "x$1" : 'x[^=]*=\(.*\)'` ;; | 77 | prefix=`expr "x$1" : 'x[^=]*=\(.*\)'` ;; |
| 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[^=]*=\(.*\)'`;; | ||
| 77 | -no-configure | -no-conf | --no-configure | --no-conf | --without-config) | 86 | -no-configure | -no-conf | --no-configure | --no-conf | --without-config) |
| 78 | with_config=no ;; | 87 | with_config=no ;; |
| 79 | -no-app | --no-app | -without-app | --without-app) | 88 | -no-app | --no-app | -without-app | --without-app) |
| @@ -135,6 +144,11 @@ Options: | |||
| 135 | --self-contained Create an Emacs.app that is self-contained; | 144 | --self-contained Create an Emacs.app that is self-contained; |
| 136 | prefix will be ignored and all files installed | 145 | prefix will be ignored and all files installed |
| 137 | inside the application | 146 | inside the application |
| 147 | --build-in-place Build the application in the source directory | ||
| 148 | instead of a temporary directory. | ||
| 149 | --build-dir=DIR Build the application in the specified directory | ||
| 150 | instead of a temporary directory. Mutually exclusive | ||
| 151 | with --build-in-place. | ||
| 138 | -C,option Pass option to configure | 152 | -C,option Pass option to configure |
| 139 | -M,option Pass option to make | 153 | -M,option Pass option to make |
| 140 | EOF | 154 | EOF |
| @@ -219,11 +233,35 @@ fi | |||
| 219 | tempparentfull="`pwd`/${tempparent}" | 233 | tempparentfull="`pwd`/${tempparent}" |
| 220 | tempparentdist=${tempparentfull}/dist | 234 | tempparentdist=${tempparentfull}/dist |
| 221 | 235 | ||
| 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} | ||
| 242 | ;; | ||
| 243 | [\\/]* | ?:[\\/]* ) #Absolutepath. | ||
| 244 | mkdir -p ${builddir} | ||
| 245 | ;; | ||
| 246 | *) | ||
| 247 | mkdir -p ${builddir} | ||
| 248 | builddir=`cd $builddir && pwd` | ||
| 249 | ;; | ||
| 250 | esac | ||
| 251 | fi | ||
| 252 | # Location of install package | ||
| 253 | packagedir=${builddir}/mac/Emacs.pkg | ||
| 254 | |||
| 255 | echo Building in directory ${builddir} | ||
| 222 | echo Installing into directory ${tempparentfull} >&2 | 256 | echo Installing into directory ${tempparentfull} >&2 |
| 223 | 257 | ||
| 258 | ### This trap ensures that the staging directory will be cleaned up even | ||
| 259 | ### when the script is interrupted in mid-career. | ||
| 260 | trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent} ${removable_build_dir} ${packagedir}; exit 1" 1 2 15 | ||
| 261 | |||
| 224 | # Run configure in the new tempparent directory | 262 | # Run configure in the new tempparent directory |
| 225 | if test "$with_config" = "yes"; then | 263 | if test "$with_config" = "yes"; then |
| 226 | (cd ..; ./configure ${config_options} --prefix=${prefix}) | 264 | (cd ${builddir}; ${srcdir}/configure ${config_options} --prefix=${prefix}) |
| 227 | fi | 265 | fi |
| 228 | 266 | ||
| 229 | installprefix=${tempparentfull}${prefix} | 267 | installprefix=${tempparentfull}${prefix} |
| @@ -232,12 +270,8 @@ if test "$self_contained" = "yes"; then | |||
| 232 | installprefix=$tempparentfull/$appsdir/$emapp/Contents/Resources | 270 | installprefix=$tempparentfull/$appsdir/$emapp/Contents/Resources |
| 233 | fi | 271 | fi |
| 234 | 272 | ||
| 235 | ### This trap ensures that the staging directory will be cleaned up even | ||
| 236 | ### when the script is interrupted in mid-career. | ||
| 237 | trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; rm -rf Emacs.pkg; exit 1" 1 2 15 | ||
| 238 | |||
| 239 | ## Make bootstrap if .elc files are missing from distribution | 273 | ## Make bootstrap if .elc files are missing from distribution |
| 240 | if [ ! -f ../lisp/abbrev.elc ]; then | 274 | if [ ! -f ${srcdir}/lisp/abbrev.elc ]; then |
| 241 | echo "Required .elc files missing; making bootstrap..." | 275 | echo "Required .elc files missing; making bootstrap..." |
| 242 | if ! (cd ${builddir}; make bootstrap prefix=$installprefix $make_options); then | 276 | if ! (cd ${builddir}; make bootstrap prefix=$installprefix $make_options); then |
| 243 | echo "Make bootstrap failed... Aborting make-package." | 277 | echo "Make bootstrap failed... Aborting make-package." |
| @@ -263,7 +297,7 @@ if test "$with_app" == "yes"; then | |||
| 263 | mkdir ${tempappdir} | 297 | mkdir ${tempappdir} |
| 264 | 298 | ||
| 265 | ## Copy Emacs application | 299 | ## Copy Emacs application |
| 266 | cp -r Emacs.app ${tempappdir} | 300 | cp -r ${builddir}/mac/Emacs.app ${tempappdir} |
| 267 | ## Delete any CVS files | 301 | ## Delete any CVS files |
| 268 | find ${tempappdir} -name "CVS" -type d -exec rm -rf {} \; | 302 | find ${tempappdir} -name "CVS" -type d -exec rm -rf {} \; |
| 269 | 303 | ||
| @@ -294,15 +328,15 @@ fi | |||
| 294 | 328 | ||
| 295 | echo "Creating Package Info file" | 329 | echo "Creating Package Info file" |
| 296 | 330 | ||
| 297 | mkdir Emacs.pkg | 331 | mkdir ${packagedir} |
| 298 | mkdir Emacs.pkg/Contents | 332 | mkdir ${packagedir}/Contents |
| 299 | mkdir Emacs.pkg/Contents/Resources | 333 | mkdir ${packagedir}/Contents/Resources |
| 300 | mkdir Emacs.pkg/Contents/Resources/English.lproj | 334 | mkdir ${packagedir}/Contents/Resources/English.lproj |
| 301 | echo 'pmkrpkg1' > Emacs.pkg/Contents/PkgInfo | 335 | echo 'pmkrpkg1' > ${packagedir}/Contents/PkgInfo |
| 302 | 336 | ||
| 303 | infofile=Emacs.pkg/Contents/Resources/English.lproj/Emacs.info | 337 | infofile=${packagedir}/Contents/Resources/English.lproj/Emacs.info |
| 304 | 338 | ||
| 305 | echo 'Title Emacs' > ${infofile} | 339 | echo 'Title GNU Emacs' > ${infofile} |
| 306 | echo "Version ${version}" >> ${infofile} | 340 | echo "Version ${version}" >> ${infofile} |
| 307 | echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile} | 341 | echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile} |
| 308 | echo 'DefaultLocation /' >> ${infofile} | 342 | echo 'DefaultLocation /' >> ${infofile} |
| @@ -321,41 +355,41 @@ echo 'InstallFat NO' >> ${infofile} | |||
| 321 | # chown -Rh 0 ${tempparentfull} | 355 | # chown -Rh 0 ${tempparentfull} |
| 322 | 356 | ||
| 323 | echo "Creating pax file" | 357 | echo "Creating pax file" |
| 324 | (cd ${tempparentfull}; pax -w -f ../Emacs.pkg/Contents/Resources/Emacs.pax .; cd ..) | 358 | (cd ${tempparentfull}; pax -w -f ${packagedir}/Contents/Resources/Emacs.pax .) |
| 325 | echo "Compressing pax file" | 359 | echo "Compressing pax file" |
| 326 | gzip Emacs.pkg/Contents/Resources/Emacs.pax | 360 | gzip ${packagedir}/Contents/Resources/Emacs.pax |
| 327 | 361 | ||
| 328 | echo "Creating bom file" | 362 | echo "Creating bom file" |
| 329 | mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom | 363 | mkbom ${tempparentfull} ${packagedir}/Contents/Resources/Emacs.bom |
| 330 | 364 | ||
| 331 | echo "Generating sizes file" | 365 | echo "Generating sizes file" |
| 332 | sizesfile=Emacs.pkg/Contents/Resources/Emacs.sizes | 366 | sizesfile=${packagedir}/Contents/Resources/Emacs.sizes |
| 333 | 367 | ||
| 334 | numFiles=`du -a ${tempparent} | wc -l` | 368 | numFiles=`du -a ${tempparent} | wc -l` |
| 335 | installedSize=`du -s ${tempparent} | cut -f1` | 369 | installedSize=`du -s ${tempparent} | cut -f1` |
| 336 | compressedSize=`du -s Emacs.pkg | cut -f1` | 370 | compressedSize=`du -s ${packagedir} | cut -f1` |
| 337 | 371 | ||
| 338 | echo "NumFiles ${numFiles}" > ${sizesfile} | 372 | echo "NumFiles ${numFiles}" > ${sizesfile} |
| 339 | echo "InstalledSize ${installedSize}" >> ${sizesfile} | 373 | echo "InstalledSize ${installedSize}" >> ${sizesfile} |
| 340 | echo "CompressedSize ${compressedSize}" >> ${sizesfile} | 374 | echo "CompressedSize ${compressedSize}" >> ${sizesfile} |
| 341 | cat ${sizesfile} | 375 | cat ${sizesfile} |
| 342 | 376 | ||
| 343 | mv ${tempparentfull} ${emacsname} | ||
| 344 | |||
| 345 | echo "Creating Disc Image" | 377 | echo "Creating Disc Image" |
| 346 | ## Allocate an extra 5000 sectors (about 2.5 mg) | 378 | ## Allocate an extra 5000 sectors (about 2.5 mg) |
| 347 | ## Note a sector appears to be ~500k | 379 | ## Note a sector appears to be 512k |
| 348 | sectorsAlloced=`echo 2*${compressedSize}+5000|bc` | 380 | sectorsAlloced=`echo 2*${compressedSize}+5000|bc` |
| 349 | hdiutil create -ov EmacsRW -sectors ${sectorsAlloced} | 381 | hdiutil create -ov ${builddir}/mac/EmacsRW -sectors ${sectorsAlloced} |
| 350 | ## Need to format the disc image before mounting | 382 | ## Need to format the disc image before mounting |
| 351 | mountLoc=`hdid -nomount EmacsRW.dmg | grep HFS | cut -f1` | 383 | mountLoc=`hdid -nomount ${builddir}/mac/EmacsRW.dmg | grep HFS | cut -f1` |
| 352 | /sbin/newfs_hfs -v Emacs ${mountLoc} | 384 | /sbin/newfs_hfs -v Emacs ${mountLoc} |
| 353 | hdiutil eject ${mountLoc} | 385 | hdiutil eject ${mountLoc} |
| 354 | echo "Copying Package to Disc Image" | 386 | echo "Copying Package to Disc Image" |
| 355 | hdid EmacsRW.dmg | 387 | hdid ${builddir}/mac/EmacsRW.dmg |
| 356 | 388 | ||
| 357 | if test "$keep_directory" = "no"; then | 389 | if test "$keep_directory" = "no"; then |
| 358 | rm -rf ${emacsname} | 390 | rm -rf ${tempparentfull} |
| 391 | else | ||
| 392 | mv ${tempparentfull} ${emacsname} | ||
| 359 | fi | 393 | fi |
| 360 | 394 | ||
| 361 | if [ ! -d /Volumes/Emacs ]; then | 395 | if [ ! -d /Volumes/Emacs ]; then |
| @@ -365,20 +399,20 @@ create a disc image." >&2 | |||
| 365 | exit 0 | 399 | exit 0 |
| 366 | fi | 400 | fi |
| 367 | 401 | ||
| 368 | cp -R Emacs.pkg /Volumes/Emacs | 402 | cp -R ${packagedir} /Volumes/Emacs |
| 369 | 403 | ||
| 370 | ## Converting Disk Image to read-only | 404 | ## Converting Disk Image to read-only |
| 371 | echo 'Converting Disc Image to read-only' | 405 | echo 'Converting Disc Image to read-only' |
| 372 | hdiutil eject ${mountLoc} | 406 | hdiutil eject ${mountLoc} |
| 373 | hdiutil resize EmacsRW.dmg -sectors min | 407 | hdiutil resize ${builddir}/mac/EmacsRW.dmg -sectors min |
| 374 | if test "$comp_diskimage" = "yes"; then | 408 | if test "$comp_diskimage" = "yes"; then |
| 375 | hdiutil convert EmacsRW.dmg -format UDZO -imagekey zlib-level=2 -o EmacsInstaller.dmg | 409 | hdiutil convert ${builddir}/mac/EmacsRW.dmg -format UDZO -imagekey zlib-level=2 -o ${srcdir}/mac/EmacsInstaller.dmg |
| 376 | else | 410 | else |
| 377 | hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg | 411 | hdiutil convert ${builddir}/mac/EmacsRW.dmg -format UDRO -o ${srcdir}/mac/EmacsInstaller.dmg |
| 378 | fi | 412 | fi |
| 379 | rm EmacsRW.dmg | 413 | rm ${builddir}/mac/EmacsRW.dmg |
| 380 | 414 | ||
| 381 | echo "Cleaning up the staging directory" | 415 | echo "Cleaning up the staging directory" |
| 382 | rm -rf Emacs.pkg | 416 | rm -rf ${builddir}/mac/Emacs.pkg ${removable_build_dir} |
| 383 | 417 | ||
| 384 | ### make-package ends here | 418 | ### make-package ends here |