[wxruby-users] Recommended cross platform deployment methods?
Alex Fenton
alex at pressure.to
Thu Oct 23 11:36:14 EDT 2008
Mark E. wrote:
> I'm also interested in a more generic solution. I'm interested in
> rubygame, wxruby and other ruby projects. I'd love to tinker with it
> too.
>
> I imagine a nice wxruby GUI for driving the build process too. ;)
>
> But really, it would be great to be able to customize the following:
> + where the files get installed to (Shoes installer put it in \Program
> Files\Common Files\Shoes\<version>
> + what files get installed (different gems, libraries like sdl, etc)
> + The graphic to show
> + The script files to deploy (optional just a directory, etc)
>
Just to come in late on this discussion. I think perhaps I've mentioned
this stuff before on the list a while back, but I've spent a fair bit of
time working up executables and installers for Windows and Mac (I've
done less with Linux).
rubyscript2exe is OK, but it's far from perfect for wxRuby apps. Some of
this is down to the large size of the wxruby binary. I've had trouble
getting it to generate working exes on Mac. It had recently a bug (and
maybe still has) a bug that included some libraries, including
wxruby2.so twice over - which is a big hit in terms of the exe size.
Having to unzip at each execution is also a bit messy and noticeably
slows startup time. And it's not intended as a solution as an installer.
Interested to read about the Shoes stuff, but I don't really like net
installers. I'm fine with package managers, where a huge amount of work
has gone into dealing with connection failure, but I'm a bit uneasy
about a roll-your-own solution. If it's not impolite, I think _why's
work is perhaps the most creative in the ruby world, but not the best
maintained over time (I'm thinking of redcloth here).
I got round this by using platform specific solutions. The basic process is:
1) Do a trace run of the app to discover all of its library dependencies
2) Assemble all of these libraries, plus the ruby interpreter and the
ruby lib in a single place
3) Create a runnable app (this is only necessary on Mac)
4) Create an installer (a DMG on Mac, a setup.exe on Windows)
A bit more detail
1) is covered by this script here:
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/assemble_libraries.rb
2) This rake file runs the script; use rbconfig.rb (part of the stdlib)
to find the ruby executable and the dlls / bundles it depends on:
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_assemble.rb
These rake files define additional dlls that need to be included (eg for
sqlite3) and find the ruby stuff
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_mswin.rb
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_osx.rb
3) Use Platypus (http://www.sveinbjorn.org/platypus) to turn a script
file (eg an .rb or a .sh) into a runnable, nicely named and iconed .app
bundle on OS X. Again this can be automated with rake
4) Use NSIS to create a cute installer on Windows, this requires
creating a .nsi file to define the steps in the installer. This is a bit
fiddly but it means you can include whatever additional files you want
(eg documentation, app icons) and create whatever shortcuts you want (eg
uninstallers). An example is here:
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/qda.nsi
For OS X, Apple's own hdiutil command-line tool will create a .dmg that
can be downloaded, expanded, so the user simply copies the .app file
into their Applications folder. This is the standard way. Again, I
automate this in the rakefile.
For the time being, all this is in hard-coded rakefiles specific to one
application. But I think it would not be too hard to make it more
general, so that the rakefiles could be generated. But it's not
something I really want to get into building myself. But it's worth
bearing in mind that all the bits and pieces are out there already to
produce 100% professional standard installers.
alex
More information about the wxruby-users
mailing list