Mercurial > emacs
comparison mac/make-package @ 48990:dfea5194194f
* 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
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Sun, 29 Dec 2002 07:34:48 +0000 |
parents | 81b2338bea6e |
children | 5c4e830c411b |
comparison
equal
deleted
inserted
replaced
48989:4975be537cb2 | 48990:dfea5194194f |
---|---|
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 | 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 |
49 appsdir=/Applications | 49 appsdir=/Applications |
50 emapp=Emacs.app | 50 emapp=Emacs.app |
53 with_x=no | 53 with_x=no |
54 comp_diskimage=yes | 54 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= |
61 display_usage=false; | 62 display_usage=false; |
62 config_options=; | 63 config_options=; |
72 display_usage=yes ;; | 73 display_usage=yes ;; |
73 -p | -prefix | --p | --prefix) | 74 -p | -prefix | --p | --prefix) |
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) |
80 with_app=no ;; | 89 with_app=no ;; |
81 -without-x | --without-x) | 90 -without-x | --without-x) |
133 to the install in [prefix]/bin/emacs and have | 142 to the install in [prefix]/bin/emacs and have |
134 the emacs executable link to emacs-${version} | 143 the emacs executable link to emacs-${version} |
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 |
141 exit 0 | 155 exit 0 |
142 fi | 156 fi |
217 fi | 231 fi |
218 | 232 |
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 |
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 | |
223 | 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} |
230 if test "$self_contained" = "yes"; then | 268 if test "$self_contained" = "yes"; then |
231 # If selfcontained, the local directory is Resources directory | 269 # If selfcontained, the local directory is Resources directory |
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." |
244 exit 2 | 278 exit 2 |
245 fi | 279 fi |
261 tempappdir=${tempparentfull}${appsdir} | 295 tempappdir=${tempparentfull}${appsdir} |
262 tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs | 296 tempemapp=${tempappdir}/${emapp}/Contents/MacOS/Emacs |
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 |
270 ## Have application be a symlink to ${prefix}/bin/emacs | 304 ## Have application be a symlink to ${prefix}/bin/emacs |
271 if test "$app_symlink" == "yes"; then | 305 if test "$app_symlink" == "yes"; then |
292 #if test "$full_dist" = no; then | 326 #if test "$full_dist" = no; then |
293 #fi | 327 #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} |
309 echo 'DeleteWarning' >> ${infofile} | 343 echo 'DeleteWarning' >> ${infofile} |
310 echo 'NeedsAuthorization YES' >> ${infofile} | 344 echo 'NeedsAuthorization YES' >> ${infofile} |
319 ### Not sure if this is a good diea | 353 ### Not sure if this is a good diea |
320 # echo "Setting owner to root" | 354 # echo "Setting owner to root" |
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 |
362 echo "Could not create disc image. The Emacs installer package (Emacs.pkg) | 396 echo "Could not create disc image. The Emacs installer package (Emacs.pkg) |
363 in this directory should be correct. Please use the Disc Copy program to | 397 in this directory should be correct. Please use the Disc Copy program to |
364 create a disc image." >&2 | 398 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 |