Re: Correct way to package win32 gtk programs



I have created some gtk exe's for win32 using gtk+ and mingw.What is the correct way to package the exe 
with the required DLL's?

That is to some degree a question of taste and personal opinion...

Should I just send out exe file with dll's from bin? Or are end users meant to install gtk and add its bin 
to their system path?

I would say that the current best practise is to produce a single
executable installer (either a single .exe or a single .msi) that
installs you application and the GTK+ stack (those parts that your
application needs) in the same, freely selectable, location. Many
people say, and I agree, that it is futile to try to use a shared
installation of GTK+ on Windows for applications from different 3rd
parties.

For instance, do it like this:

First fetch the GTK+ stack binaries (for instance the GTK+ bundle zip
file from http://www.gtk.org/download-windows.html , please note that
this bundle contains also developer files though) and unpack them
somewhere. (Warning: watch out for WinZip. It is said to behave badly.
Just use the command-line unzip.exe from
ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
for instance, or Explorer's built-in unzipper.)

Construct in a fresh empty folder the "image" of what you want to get
installed on the end-user machine. Use the normal Unix-like directory
structure with a "bin" and maybe "etc", "lib" and "share" subfolders.
Put your application's .exe in "bin", and other files your application
needs wherever they need to be. (Hopefully your application knows how
to find out at run-time where it is and can then find the other files
it needs based on that.) Then put the GTK+ stack DLLs you need in
place, also in "bin", and the other files they need in their
corresponding places.

You don't have to copy all what's included in the GTK+ stack binaries
into your image. Instead, copy as little as possible, a bit at a time,
until you have a subset that works. (When testing, make sure your PATH
doesn't contain any other GTK+ installation. Just add the "bin" folder
of this installation image prototype you are creating to PATH.)

Obviously you should leave out the developer stuff (headers, import
libraries, documentation). It's fine to leave out the message catalogs
(share/locale) if you don't need localised messages from GTK+ and
GLib. (If your application isn't localised itself, it makes little
sense that GTK+ strings appear localised.)

It's fine to leve out the pangoft2 DLL, you won't need that unless
your application explicitly uses pangoft2 API, which isn't likely.
It's fine to leave out gdk-pixbuf image loaders for image formats your
application and GTK+ itself doesn't need. Edit the
etc/gdk-pixbuf.loaders file, removing the entries for those gdk-pixbuf
loaders you left out. (Don't touch the pathnames as such in this file.
They look odd, but that is not a problem.)

Then use whatever installer-builder you like to construct an installer
based on that "image" directory. Use the installer-builder's mechanism
to add a shortcut to your application's .exe to the Start Menu (and
Desktop, and Quick Launch bar, if you want... but please make it then
possible for the user to opt out from adding them there).

No doubt you will get other replies telling you to do it in a
completely different way... And no doubt some may think the above is
ridiculously complicated. But remember, constructing an installer for
a GTK+ application for Windows is roughly comparable to creating a
Linux package for some complex software that hasn't been packaged for
the distribution in question before. That is not trivial either. It is
not fair to compare distributing a GTK+ application for Windows to
distributing it for some Linux distro where all the GTK+ stack can be
assumed to be already present and handled by the distro's package
management.

--tml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]