Gimp Plugins in Win32

This page is a couple years out of date – there’s now a GIMP wiki which, hopefully, will become a good repository for this sort of info.  If you compile GIMP from source under windows as per this page, you should be able to compile your own plugins as well (I don’t know if gimp-tool is currently working for win32 though – so you may still need to write custom build scripts as I did here.)

The following is my guide to compiling gimp plugins in MS windows:

(There are probably easier ways to do all this, but now that I've got it all working, I don't have too much of an incentive to figure them out. If you want up-to-date help and supplementary info, log yourself onto the wingimp yahoo group).

Start by going to the WinGimp download page.
Download all the release and development packages and install them as Tor instructs (just the development packages by themselves, even if you already have a copy of wingimp, are not enough).

(I used c:\gimplibs as my GIMPTOP directory; if you want my to avoid editing my perlscript, you will need to do the same.)

One trivial detail that Tor doesn't mention is that in order to use pkg-config, you need to go into your environment variable settings (control panel/System/Advanced), and create a new variable:
PKG_CONFIG_PATH = C:\gimplibs\lib\pkgconfig.

Now you'll need to get your hands on the mingw compiler (gcc for windows), as well as cygwin (a shell environment which makes gnu-make happier).
When you install cygwin, install everything listed under the developer packages. Then run setup again an uninstall gcc and gcc-mingw. This is the only way that I have found to get mingw to link properly. I have no idea why it works.

Once you've reached this point, you should have a setup that can build gimp plugins.
You can test it out by downloading my simple plugin source and running 'make' from the cygwin shell. Before trying this you should extend your PATH environment variable to include mingw's bin dir, as well as the GIMPTOP lib and bin subdirectories. (Note that even though you are using cygwin to compile the plugins, the plugins are not for a cygwin version of gimp.)

Take the compiled lumtoalpha.exe and put it in GIMPTOP\lib\gimp\1.2\plugins, then start gimp by running the executable in GIMPTOP\bin. Go to the image menu, and try the plugin in Filters/Sven. If that works then congratulate yourself, you've just compiled a fresh gimp plugin and successfully used it.

One of the bothersome things about the instillation setup at this point is that `gimptool --build` and `gimptool --install` still don't work. I don't know how to fix this. However, for my own convenience, I have put together the following kludge: With a little messing around, gimptool's output can be used to create makefiles that will correctly compile plugins (assuming gcc is called from the cygwin shell).
So I've made a perl script that creates such makefiles using a tweaked version of gimptool's output:

"perl plugin_name > Makefile && make"
gives you the effect that you should get from:
"gimp-tool --build plugin_name.c".