FAQ: Distributing Squeak Programs
Last updated at 10:23 pm UTC on 3 December 2007
To distribute Squeak programs to other Squeak people, you would normally use facilities such as
- Package Universes
However, sometimes you want to deliver a program to people who do not know anything about Squeak. The general approach is to create one distribution for each platform that you would like to support (yes, each one. This is why it is nice to stay within Squeak, where there is only one platform!). The simplest distribution would be a ZIP file including the usual four files used for Squeak development:
- A Virtual Machine (VM) for the platform.
- The image containing your application.
- The .changes file associated with that image.
- The correct .sources file.
The main issue is that you will need to obtain a virtual machine for each platform you want, and you will need to create archives that each platform can support. The VM's can be obtained via the Downloading Squeak page. For platforms you are unsure about, FAQ: Distributing Squeak Programs tend to work well.
Be aware that some virtual machines have additional files they require. If you see files named .DLL or .SO, then you probably need to include these. For safety, you could simply include a copy of every file that comes in the standard VM distribution.
One distro for Windows, Mac, and Linux
The current state of the art is to mimic the Plopp distribution which uses a single deployment structure for Macs, Windows, and Linux on Intel (x86). This makes for a larger distribution, but all 3 VMs and supporting files are still small compared to the image. The Windows executable is in that directory and the Linux executable is a bit buried. But, you end up with a single structure that you can move to any of these platforms and share a single image, changes, and sources file. Works for carrying a USB key a working Squeak on it.
Distributions using this approach:
Improving your Distribution
The above instructions are enough for you to make a rudimentary Squeak distribution. Here are some ways you can spend more time on it and make the distribution nicer.
On all platforms, it is possible to get down to two required files: a VM and an image file. Simply use Smalltalk abandonSources in the image before distributing it. Just be very careful not to mess up your original image file!!
On some platforms you can furthermore combine the VM and image into a single file. See FAQ: Squeak executables info on this.
Naming the Files
You can rename the virtual machine to anything you like. That way, if you are distributing a program called "Spikeit", you can name the VM "Spikeit.exe" on Windows and "/usr/bin/spikeit" on Unix. The image file has more restrictions; it should be named squeak.image unless you have tested on the particular platform that another name will work.
Preparing an Image
You will probably not want to just distribute your development image and have users try to use it. See FAQ: Simplifying the Interface.
It is nice to automate your distribution process as much as possible, so that you can just click a button whenever you are ready to distribute a new version. See Distribution Scripts.
Notes on Particular Platforms
Every platform has its own set of customs for distributing applications. The (nearly) cross-platform distribution methods described above will function on all platforms, but they will not be as smooth as they can be. If you are extremely serious about supporting end users, then you should also look into tailoring the distribution for individual platforms.
( This section is incomplete. People who know more about any of these platforms should fill in more suggestions!)
You probably want to use a script instead of running the virtual machine directly. You can put the image file of your program in /usr/lib/yourprogname, and then put a file in /usr/bin/yourpackagename with contents something like this:
With a resource editor, you should be able to replace the Squeak icon with one of your own devising.
Also, you can use batch files for the same purposes you'd use a script file on Unix.
Some example Squeak distributions:
- Julia Explorer
- Virtual Home
The Future of Virtual Machine support
Currently the VM's are inconsistent about distribution support. It would be nice if they did some things like:
- always allow the image to be named the same as the VM.
- easily allowed the associated icons to be replaced in the application.
A little comment on the following, as it could be misleading:
"yes, each one. This is why it is nice to stay within Squeak, where there is only one platform!"
But you still need to download the Squeak environment for each platform, no? After all, people that don't know anything about Squeak aren't likely to have Squeak installed.
What's misleading about it? If you distribute changesets or monticello files, then you must assume your recipient has squeak installed, but otherwise life is great. If you assume they do not have Squeak installed, then you have to make a ZIP/DEB/EXE/whatever file for each platform you support. Each ZIP/DEB/whatever file will include a copy of Squeak for that platform, but the user never needs to know nor care. -Lex Spoon