• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Packaging As a Disk Image ... from the Command Line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Packaging As a Disk Image ... from the Command Line?


  • Subject: Re: Packaging As a Disk Image ... from the Command Line?
  • From: Bill Bumgarner <email@hidden>
  • Date: Mon, 4 Mar 2002 19:20:38 -0500

Can Ant call a perl script? (Yes.)

Mike Trent and I-- mostly Mike-- wrote a perl script that can be used to automatically create disk images containing the build products of PBX projects. It is freely available within the mosxland.sourceforge.net project under the Tools/ directory.

To check out the tool:

cvs -d :pserver:email@hidden:/cvsroot/mosxland login
<<cvs will ask for a password. just hit return as there is none>>
cvs -d :pserver:email@hidden:/cvsroot/mosxland co Tools

The script is called 'build' and is within the Tools/ directory.

Before using it, I typically set up a target and buildstyle within the project; both called 'Packaging'. This isn't necessary and the 'build' script provides options to use an alternative style and target.

The role of the target/buildstyle are to govern the build of the project such that the targeted disk image contains the application at the root directory and includes any README, license, or other files that are needed at the root.

The 'Packaging' buildstyle simply sets COPY_PHASE_STRIP to YES and unsets the INSTALL_PATH (note that on frameworks, this can be dangerous-- it effectively disables the setting of the frameworks install_name and, as such, can completely screw up the build of a framework for the purposes of embedding within the application-- since I *never* include a framework project in the same project with an application project, this isn't a problem for me).

The 'Packaging' target is an aggregate target that includes the normal application target and any additional targets that need to be executed to cause the disk image or distribution archive (build can also create tarballs) to be populated with the appropriate contents.

Confused? Checkout the RadioService or SSHPassKey projects to see working examples:

cvs -d :pserver:email@hidden:/cvsroot/mosxland co RadioService
cvs -d :pserver:email@hidden:/cvsroot/mosxland co SSHPassKey

(RadioService is only useful if you are using Radio UserLand or other Blogging app... SSHPassKey provides the ability to use cvs via ssh even when the remote server requires one to enter a password-- the version you will end up checking out from the above repository also has the beginnings of port forwarding support.)

The 'build' tools usage looks like:

[localhost:~/bbum-developer/sourceforge/mosxland] bbum% Tools/build
usage: build <project directory> [-archive <archive type> -name <product name> -nocopy -noclean -nosource]
-archive Produce an archive of the build results. archive type
must be one of:
dmg - a Disk Copy disk image
gnutar - a compressed gnutar ball
If -archive is omitted an archive will not be made.
-name The product name to use in the final root & archive.
For example, 'Xmanview1.0'.
-buildstyle The build style to use. Defaults to 'Packaging'.
-nocopy Do not copy the source to separate location.
-nosource Do not copy the source into the final image / archive
-noclean Do not clean the source before building.
-nocompress Do not compress the disk image.
-nobuild Just create an archive of the <project directory> folder.

So, if I wanted to build a copy of RadioService as a disk image for distribution as version 1.0a2 without including source (because anyone can check out the latest version), I would (assuming I'm in the directory above the RadioService project):

[localhost:~/bbum-developer/sourceforge/mosxland] bbum% ls -d Tools RadioService
RadioService Tools
[localhost:~/bbum-developer/sourceforge/mosxland] bbum% Tools/build -archive dmg \
-name RadioService_v1_0a2 \
-nosource -nocompress RadioService
.... bunch of stuff happens ....
[localhost:~/bbum-developer/sourceforge/mosxland] bbum% ls -alF /tmp/RadioService.build/archive/
total 5120
drwxr-xr-x 3 bbum wheel 58 Mar 4 19:15 ./
drwxr-xr-x 5 bbum wheel 126 Mar 4 19:14 ../
-rw-r--r-- 1 bbum wheel 5242880 Mar 4 19:15 RadioService_v1_0a2.dmg

Once built, the resulting disk image can be found in /tmp/<<Project name>>.build/archive. In the above example, I specified the -compress flag because this allows me to mount the disk image, rearrange the icons, and set a background image. Compressed images are read only.

I can compress the image by doing something like the following:

[localhost:/tmp/RadioService.build/archive] bbum% ls
RadioService_v1_0a2.dmg
[localhost:/tmp/RadioService.build/archive] bbum% ls -alF
total 5120
-rw-r--r-- 1 bbum wheel 5242880 Mar 4 19:15 RadioService_v1_0a2.dmg
[localhost:/tmp/RadioService.build/archive] bbum% mv RadioService_v1_0a2.dmg RadioService_v1_0a2-orig.dmg
[localhost:/tmp/RadioService.build/archive] bbum% hdiutil convert -format UDZO \
-o RadioService_v1_0a2.dmg RadioService_v1_0a2-orig.dmg
... bunch of stuff happens ...
[localhost:/tmp/RadioService.build/archive] bbum% ls -alF
total 5412
-rw-r--r-- 1 bbum wheel 5242880 Mar 4 19:15 RadioService_v1_0a2-orig.dmg
-rw-r--r-- 1 bbum wheel 297576 Mar 4 19:17 RadioService_v1_0a2.dmg
[localhost:/tmp/RadioService.build/archive] bbum%

---

It should be relatively trivial to wrap the 'build' script as an Ant tool.
If you do and you are willing to share, please let me know.

b.bum

On Monday, March 4, 2002, at 06:08 PM, email@hidden wrote:

Hi,

Sorry if this is a little of the cocoa topic per se, but I wasn't sure
exactly where to ask this. So let's say I have my little application
all built now, and I want to distribute it as a disk image. But I want
to use Ant to do it ... Anybody have any clues as to how to go?


Regards,

John Clayton
email@hidden

b.bum
I ride tandem with the random....
.... things don't run the way I planned them.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Packaging As a Disk Image ... from the Command Line?
      • From: John Clayton <email@hidden>
  • Prev by Date: Newbie Interface question
  • Next by Date: Where to Go From Here?
  • Previous by thread: Re: Packaging As a Disk Image ... from the Command Line?
  • Next by thread: Re: Packaging As a Disk Image ... from the Command Line?
  • Index(es):
    • Date
    • Thread