aboutsummaryrefslogtreecommitdiffstats
path: root/mac/make-package
diff options
context:
space:
mode:
authorSteven Tamm2002-12-29 07:34:48 +0000
committerSteven Tamm2002-12-29 07:34:48 +0000
commit52efaffcc3995130d656c9d18f57dcfe9697edf9 (patch)
treedf5bf1f7123559a040ecdec828ea6aef34120db6 /mac/make-package
parent1dc788eba88cfbcc1eb7e1069a7d090a209d2f39 (diff)
downloademacs-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-xmac/make-package100
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 @@
42progname="$0" 42progname="$0"
43 43
44srcdir="`pwd`/.." 44srcdir="`pwd`/.."
45builddir=.. 45builddir=${srcdir}
46 46
47## Default location to place it is /usr/local 47## Default location to place it is /usr/local
48prefix=/usr/local 48prefix=/usr/local
@@ -55,6 +55,7 @@ comp_diskimage=yes
55self_contained=no 55self_contained=no
56app_symlink=no 56app_symlink=no
57full_dist=yes 57full_dist=yes
58build_in_place=no
58keep_directory=no 59keep_directory=no
59 60
60ac_prev= 61ac_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
140EOF 154EOF
@@ -219,11 +233,35 @@ fi
219tempparentfull="`pwd`/${tempparent}" 233tempparentfull="`pwd`/${tempparent}"
220tempparentdist=${tempparentfull}/dist 234tempparentdist=${tempparentfull}/dist
221 235
236if 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
251fi
252# Location of install package
253packagedir=${builddir}/mac/Emacs.pkg
254
255echo Building in directory ${builddir}
222echo Installing into directory ${tempparentfull} >&2 256echo 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.
260trap "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
225if test "$with_config" = "yes"; then 263if test "$with_config" = "yes"; then
226 (cd ..; ./configure ${config_options} --prefix=${prefix}) 264 (cd ${builddir}; ${srcdir}/configure ${config_options} --prefix=${prefix})
227fi 265fi
228 266
229installprefix=${tempparentfull}${prefix} 267installprefix=${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
233fi 271fi
234 272
235### This trap ensures that the staging directory will be cleaned up even
236### when the script is interrupted in mid-career.
237trap "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
240if [ ! -f ../lisp/abbrev.elc ]; then 274if [ ! -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
295echo "Creating Package Info file" 329echo "Creating Package Info file"
296 330
297mkdir Emacs.pkg 331mkdir ${packagedir}
298mkdir Emacs.pkg/Contents 332mkdir ${packagedir}/Contents
299mkdir Emacs.pkg/Contents/Resources 333mkdir ${packagedir}/Contents/Resources
300mkdir Emacs.pkg/Contents/Resources/English.lproj 334mkdir ${packagedir}/Contents/Resources/English.lproj
301echo 'pmkrpkg1' > Emacs.pkg/Contents/PkgInfo 335echo 'pmkrpkg1' > ${packagedir}/Contents/PkgInfo
302 336
303infofile=Emacs.pkg/Contents/Resources/English.lproj/Emacs.info 337infofile=${packagedir}/Contents/Resources/English.lproj/Emacs.info
304 338
305echo 'Title Emacs' > ${infofile} 339echo 'Title GNU Emacs' > ${infofile}
306echo "Version ${version}" >> ${infofile} 340echo "Version ${version}" >> ${infofile}
307echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile} 341echo "Description Install GNU Emacs ${version} as a command-line app and a Mac OS Application" >> ${infofile}
308echo 'DefaultLocation /' >> ${infofile} 342echo 'DefaultLocation /' >> ${infofile}
@@ -321,41 +355,41 @@ echo 'InstallFat NO' >> ${infofile}
321# chown -Rh 0 ${tempparentfull} 355# chown -Rh 0 ${tempparentfull}
322 356
323echo "Creating pax file" 357echo "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 .)
325echo "Compressing pax file" 359echo "Compressing pax file"
326gzip Emacs.pkg/Contents/Resources/Emacs.pax 360gzip ${packagedir}/Contents/Resources/Emacs.pax
327 361
328echo "Creating bom file" 362echo "Creating bom file"
329mkbom ${tempparentfull} Emacs.pkg/Contents/Resources/Emacs.bom 363mkbom ${tempparentfull} ${packagedir}/Contents/Resources/Emacs.bom
330 364
331echo "Generating sizes file" 365echo "Generating sizes file"
332sizesfile=Emacs.pkg/Contents/Resources/Emacs.sizes 366sizesfile=${packagedir}/Contents/Resources/Emacs.sizes
333 367
334numFiles=`du -a ${tempparent} | wc -l` 368numFiles=`du -a ${tempparent} | wc -l`
335installedSize=`du -s ${tempparent} | cut -f1` 369installedSize=`du -s ${tempparent} | cut -f1`
336compressedSize=`du -s Emacs.pkg | cut -f1` 370compressedSize=`du -s ${packagedir} | cut -f1`
337 371
338echo "NumFiles ${numFiles}" > ${sizesfile} 372echo "NumFiles ${numFiles}" > ${sizesfile}
339echo "InstalledSize ${installedSize}" >> ${sizesfile} 373echo "InstalledSize ${installedSize}" >> ${sizesfile}
340echo "CompressedSize ${compressedSize}" >> ${sizesfile} 374echo "CompressedSize ${compressedSize}" >> ${sizesfile}
341cat ${sizesfile} 375cat ${sizesfile}
342 376
343mv ${tempparentfull} ${emacsname}
344
345echo "Creating Disc Image" 377echo "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
348sectorsAlloced=`echo 2*${compressedSize}+5000|bc` 380sectorsAlloced=`echo 2*${compressedSize}+5000|bc`
349hdiutil create -ov EmacsRW -sectors ${sectorsAlloced} 381hdiutil 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
351mountLoc=`hdid -nomount EmacsRW.dmg | grep HFS | cut -f1` 383mountLoc=`hdid -nomount ${builddir}/mac/EmacsRW.dmg | grep HFS | cut -f1`
352/sbin/newfs_hfs -v Emacs ${mountLoc} 384/sbin/newfs_hfs -v Emacs ${mountLoc}
353hdiutil eject ${mountLoc} 385hdiutil eject ${mountLoc}
354echo "Copying Package to Disc Image" 386echo "Copying Package to Disc Image"
355hdid EmacsRW.dmg 387hdid ${builddir}/mac/EmacsRW.dmg
356 388
357if test "$keep_directory" = "no"; then 389if test "$keep_directory" = "no"; then
358 rm -rf ${emacsname} 390 rm -rf ${tempparentfull}
391else
392 mv ${tempparentfull} ${emacsname}
359fi 393fi
360 394
361if [ ! -d /Volumes/Emacs ]; then 395if [ ! -d /Volumes/Emacs ]; then
@@ -365,20 +399,20 @@ create a disc image." >&2
365 exit 0 399 exit 0
366fi 400fi
367 401
368cp -R Emacs.pkg /Volumes/Emacs 402cp -R ${packagedir} /Volumes/Emacs
369 403
370## Converting Disk Image to read-only 404## Converting Disk Image to read-only
371echo 'Converting Disc Image to read-only' 405echo 'Converting Disc Image to read-only'
372hdiutil eject ${mountLoc} 406hdiutil eject ${mountLoc}
373hdiutil resize EmacsRW.dmg -sectors min 407hdiutil resize ${builddir}/mac/EmacsRW.dmg -sectors min
374if test "$comp_diskimage" = "yes"; then 408if 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
376else 410else
377 hdiutil convert EmacsRW.dmg -format UDRO -o EmacsInstaller.dmg 411 hdiutil convert ${builddir}/mac/EmacsRW.dmg -format UDRO -o ${srcdir}/mac/EmacsInstaller.dmg
378fi 412fi
379rm EmacsRW.dmg 413rm ${builddir}/mac/EmacsRW.dmg
380 414
381echo "Cleaning up the staging directory" 415echo "Cleaning up the staging directory"
382rm -rf Emacs.pkg 416rm -rf ${builddir}/mac/Emacs.pkg ${removable_build_dir}
383 417
384### make-package ends here 418### make-package ends here