RSS/Atom feed Twitter
Site is read-only, email is disabled

Fw: [Gimp-user] Threshold Crop Plug-in

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

9 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Fw: [Gimp-user] Threshold Crop Plug-in Kevin Myers 14 Oct 20:37
  Fw: [Gimp-user] Threshold Crop Plug-in Carol Spears 16 Oct 03:49
   Fw: [Gimp-user] Threshold Crop Plug-in Tor Lillqvist 16 Oct 21:55
Fw: [Gimp-user] Threshold Crop Plug-in Kevin Myers 16 Oct 05:26
Fw: [Gimp-user] Threshold Crop Plug-in Kevin Myers 16 Oct 05:38
How to Compile Plug-in Under MS VC++ 5.0 (was Re: Threshold Crop Plug-in) Kevin Myers 16 Oct 07:08
Fw: [Gimp-user] Threshold Crop Plug-in Kevin Myers 16 Oct 23:16
Fw: [Gimp-user] Threshold Crop Plug-in Kevin Myers 16 Oct 23:22
  Fw: [Gimp-user] Threshold Crop Plug-in Tor Lillqvist 17 Oct 00:06
Kevin Myers
2002-10-14 20:37:06 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 10:23 AM Subject: [Gimp-user] Threshold Crop Plug-in

Hello,

I would like to develop (or preferably locate) a tool somewhat similar to the default gimp autocrop, but with this difference: It would allow you

to

specify a threshold range in some manner for the border that is to be cropped. If it handles RGB that would be fine, but in my case all that I really care about is grayscale.

I've searched the gimp registry and didn't see anything similar, so I'm considering writing one of my own by using the existing autocrop plug-in

as

a starting point. I've done some preliminary looking at the code and have written pseudo-code for the primary changes that would be needed.

However,

I can't seem to locate any docs on what you actually need in order to compile a plug-in...

In autocrop libgimp is the only external library that is used, and I don't think that I need anything else either, at least for a simple initial version with hardcoded threshold values and no user interface.

I would think that I can easily locate and download the header file(s) for libgimp. But I'm an inexperienced C developer, and don't know what else

if

anything that I may need. I will be mucking with tiff files, but since

gimp

itself will be doing all of the actual file interaction, I don't think

that

I should need libtiff or anything like that, right? Also, I don't need

the

libgimp source other than the header files, do I?

Finally, I will be doing my work under Windows. I have several compilers available, including a couple of versions of Microsoft Visual C++. I

don't

want my plug-in to be dependent on Cygwin libraries or anything like that, so I don't plan to use Cygwin for this development. By default (because I don't know any better) I was planning to MSVC++ 6.0 to write and compile

the

plug-in. Will this work? Are there any other tools that I am likely to need in order to develop this extremely simple plug-in?

After compiling, I believe that all I should need to do to run the plug-in is to locate it in the proper gimp subdirectory on my machine, right?

Thanks in advance for any tips.

Kevin M. Round Rock, Texas

Carol Spears
2002-10-16 03:49:55 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

On 2002-10-14 at 1337.06 -0500, Kevin Myers typed this:

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 10:23 AM Subject: [Gimp-user] Threshold Crop Plug-in

Hello,

I would like to develop (or preferably locate) a tool somewhat similar to the default gimp autocrop, but with this difference: It would allow you

to

specify a threshold range in some manner for the border that is to be cropped. If it handles RGB that would be fine, but in my case all that I really care about is grayscale.

I've searched the gimp registry and didn't see anything similar, so I'm considering writing one of my own by using the existing autocrop plug-in

as

a starting point. I've done some preliminary looking at the code and have written pseudo-code for the primary changes that would be needed.

However,

I can't seem to locate any docs on what you actually need in order to compile a plug-in...

http://gimp-plug-ins.sourceforge.net/doc/Writing/html/plug-in.html

gimptool builds plugins. try "gimptool --help" although the man page (included in the source) would prolly help anyone developing gimp more.

I would think that I can easily locate and download the header file(s) for libgimp. But I'm an inexperienced C developer, and don't know what else

if

anything that I may need. I will be mucking with tiff files, but since

gimp

itself will be doing all of the actual file interaction, I don't think

that

I should need libtiff or anything like that, right? Also, I don't need

the

libgimp source other than the header files, do I?

check Xtns -->Pdb for gimp access to the various libraries

Finally, I will be doing my work under Windows. I have several compilers available, including a couple of versions of Microsoft Visual C++. I

don't

want my plug-in to be dependent on Cygwin libraries or anything like that, so I don't plan to use Cygwin for this development. By default (because I don't know any better) I was planning to MSVC++ 6.0 to write and compile

the

plug-in. Will this work? Are there any other tools that I am likely to need in order to develop this extremely simple plug-in?

my first instinct is to tell you *not* to try to build anything for gimp on windows.

actually, my second and third instinct tell me this too.

but if you must, there is a win-gimp developers list that will prolly be more helpful to you. most of the gimp developers don't waste their time with propietory software ...

here is a document describing the dirty truth as to why gimp exists on windows:
http://www.gimp.org/~tml/gimp/win32/why.html and here is the mail list for those poor bas^H^H^Hdevelopers: gimpwin-dev@yahoogroups.com

carol

Kevin Myers
2002-10-16 05:26:45 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

Hi Carol -

Thanks a lot for your reply, and the warnings! As it turns out, I am already well down this path, and with surprisingly little difficulty have been able to compile and run the first version of my new plug-in. In fact, I am presently in the process of documenting the steps that were required. BTW, I didn't even use gimptool. Admittedly, my plug-in is not very complex, so I probably had an easier time of it than most. Anyway, I will be posting back to the list soon with my results. Thanks again for your reply and all of the links that you provided. I had already seen some of them, but there were a few that were new to me.

Regards, s/KAM

----- Original Message ----- From: "Carol Spears"
To: "gimp developers"
Sent: Tuesday, October 15, 2002 8:49 PM Subject: [Gimp-developer] Re: Fw: [Gimp-user] Threshold Crop Plug-in

On 2002-10-14 at 1337.06 -0500, Kevin Myers typed this:

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 10:23 AM Subject: [Gimp-user] Threshold Crop Plug-in

Hello,

I would like to develop (or preferably locate) a tool somewhat similar

to

the default gimp autocrop, but with this difference: It would allow

you

to

specify a threshold range in some manner for the border that is to be cropped. If it handles RGB that would be fine, but in my case all

that I

really care about is grayscale.

I've searched the gimp registry and didn't see anything similar, so

I'm

considering writing one of my own by using the existing autocrop

plug-in

as

a starting point. I've done some preliminary looking at the code and

have

written pseudo-code for the primary changes that would be needed.

However,

I can't seem to locate any docs on what you actually need in order to compile a plug-in...

http://gimp-plug-ins.sourceforge.net/doc/Writing/html/plug-in.html

gimptool builds plugins. try "gimptool --help" although the man page (included in the source) would prolly help anyone developing gimp more.

I would think that I can easily locate and download the header file(s)

for

libgimp. But I'm an inexperienced C developer, and don't know what

else

if

anything that I may need. I will be mucking with tiff files, but

since

gimp

itself will be doing all of the actual file interaction, I don't think

that

I should need libtiff or anything like that, right? Also, I don't

need

the

libgimp source other than the header files, do I?

check Xtns -->Pdb for gimp access to the various libraries

Finally, I will be doing my work under Windows. I have several

compilers

available, including a couple of versions of Microsoft Visual C++. I

don't

want my plug-in to be dependent on Cygwin libraries or anything like

that,

so I don't plan to use Cygwin for this development. By default

(because I

don't know any better) I was planning to MSVC++ 6.0 to write and

compile

the

plug-in. Will this work? Are there any other tools that I am likely

to

need in order to develop this extremely simple plug-in?

my first instinct is to tell you *not* to try to build anything for gimp on windows.

actually, my second and third instinct tell me this too.

but if you must, there is a win-gimp developers list that will prolly be more helpful to you. most of the gimp developers don't waste their time with propietory software ...

here is a document describing the dirty truth as to why gimp exists on windows:
http://www.gimp.org/~tml/gimp/win32/why.html and here is the mail list for those poor bas^H^H^Hdevelopers: gimpwin-dev@yahoogroups.com

carol

Kevin Myers
2002-10-16 05:38:52 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

P.S. - Like Tor Lillqvist, I do have reasons why running gimp under Windows is pretty much a requirement, at least for right now. Also, Kevin Turner's pages are great for helping you understand how to get started wrting code for a plug-in, but unfortunately there is virtually nothing there with regard to compiling or building. Finally, thank God for all of Tor's win-gimp stuff. Without that I probably would have been way out in the weeds forever!!!

----- Original Message ----- From: "Kevin Myers"
To: "Carol Spears" ; "gimp developers"

Sent: Tuesday, October 15, 2002 10:26 PM Subject: Re: [Gimp-developer] Re: Fw: [Gimp-user] Threshold Crop Plug-in

Hi Carol -

Thanks a lot for your reply, and the warnings! As it turns out, I am already well down this path, and with surprisingly little difficulty have been able to compile and run the first version of my new plug-in. In

fact,

I am presently in the process of documenting the steps that were required. BTW, I didn't even use gimptool. Admittedly, my plug-in is not very complex, so I probably had an easier time of it than most. Anyway, I will be posting back to the list soon with my results. Thanks again for your reply and all of the links that you provided. I had already seen some of them, but there were a few that were new to me.

Regards, s/KAM

----- Original Message ----- From: "Carol Spears"
To: "gimp developers"
Sent: Tuesday, October 15, 2002 8:49 PM Subject: [Gimp-developer] Re: Fw: [Gimp-user] Threshold Crop Plug-in

On 2002-10-14 at 1337.06 -0500, Kevin Myers typed this:

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 10:23 AM Subject: [Gimp-user] Threshold Crop Plug-in

Hello,

I would like to develop (or preferably locate) a tool somewhat

similar

to

the default gimp autocrop, but with this difference: It would allow

you

to

specify a threshold range in some manner for the border that is to

be

cropped. If it handles RGB that would be fine, but in my case all

that I

really care about is grayscale.

I've searched the gimp registry and didn't see anything similar, so

I'm

considering writing one of my own by using the existing autocrop

plug-in

as

a starting point. I've done some preliminary looking at the code

and

have

written pseudo-code for the primary changes that would be needed.

However,

I can't seem to locate any docs on what you actually need in order

to

compile a plug-in...

http://gimp-plug-ins.sourceforge.net/doc/Writing/html/plug-in.html

gimptool builds plugins. try "gimptool --help" although the man page (included in the source) would prolly help anyone developing gimp more.

I would think that I can easily locate and download the header

file(s)

for

libgimp. But I'm an inexperienced C developer, and don't know what

else

if

anything that I may need. I will be mucking with tiff files, but

since

gimp

itself will be doing all of the actual file interaction, I don't

think

that

I should need libtiff or anything like that, right? Also, I don't

need

the

libgimp source other than the header files, do I?

check Xtns -->Pdb for gimp access to the various libraries

Finally, I will be doing my work under Windows. I have several

compilers

available, including a couple of versions of Microsoft Visual C++.

I

don't

want my plug-in to be dependent on Cygwin libraries or anything like

that,

so I don't plan to use Cygwin for this development. By default

(because I

don't know any better) I was planning to MSVC++ 6.0 to write and

compile

the

plug-in. Will this work? Are there any other tools that I am

likely

to

need in order to develop this extremely simple plug-in?

my first instinct is to tell you *not* to try to build anything for gimp on windows.

actually, my second and third instinct tell me this too.

but if you must, there is a win-gimp developers list that will prolly be more helpful to you. most of the gimp developers don't waste their time with propietory software ...

here is a document describing the dirty truth as to why gimp exists on windows:
http://www.gimp.org/~tml/gimp/win32/why.html and here is the mail list for those poor bas^H^H^Hdevelopers: gimpwin-dev@yahoogroups.com

carol

Kevin Myers
2002-10-16 07:08:50 UTC (over 21 years ago)

How to Compile Plug-in Under MS VC++ 5.0 (was Re: Threshold Crop Plug-in)

Hi folks,

After quite a few downloads and some trial and error, I was able to eventually get my new plug-in to compile successfully. After adding a UI to specify the threshold settings, and perhaps a bit more performance tweaking I will plan to submit it for public evaluation. Just how you go about doing that I don't know yet, but hopefully I can find some web pages to give me a clue.

Meanwhile, for the record I wanted to try to document the basic steps that I used to make this process work. Hopefully this may be somewhat useful to others. I am working under MS Windows 2K, with MS Visual C++ 5.0. Steps as follows:

1. Download and install the Windows installer binary gimp and GTK+ images off of the links from Jernej Simoncic's page at http://www2.arnes.si/~sopjsimo/gimp/. After all, a gimp plug-in isn't much good unless you've got gimp to run it with, right? Installation for both of these was pretty simple and went off without a hitch. Thanks a lot for providing these easy to install images!!!

2. Install MS VC++ 5.0. Can be tricky in and of itself, because v5.0 is somewhat outdated now days. Had to reinstall MS Jet and MDAC from www.microsoft.com/data after doing this to replace the obsolete versions that VC 5.0 installed. Am worried that other obsolete gunk may have also been installed, but couldn't specifically find anything else out of sync.

3. Download and unzip the following include and library packages from Tor Lillqvist's downloads page at
http://www.gimp.org/~tml/gimp/win32/downloads.html: gimp-dev-1.2.4-20020907.zip, glib-dev-2.0.6-20020802.zip, gettext-dev-0.10.40-20020904.zip.

4. Download and unzip the following source packages from Tor Lillqvist's downloads page at http://www.gimp.org/~tml/gimp/win32/downloads.html (same page as above): gimp-1.2.4-tml-20020907-src.zip

5. Fire up MS VC++ 5.0, and create a new Win32 project, noting the project directory that is created.

6. Copy autocrop.c from the gimp-1.2.4\PLUG-INS\COMMON source subdirectory to the project directory.

7. Copy config.h.win32 from the gimp-1.2.4 subdirectory to the project directory and rename to config.h .

8. Copy glibconfig.h from the LIB\GLIB-2.0\INCLUDE glib subdirectory to the project directory.

9. Add each of the above files to my VC project via the RMB->Add Files to Project... menu item.

10. Edit GTYPES.H in the INCLUDE\GLIB-2.0\GLIB glib subdirectory and change the reference to "glibconfig.h". That probably shouldn't have been necessary, but I wasn't sure what other means would have been a better approach to have the compiler locate glibconfig.h in another directory. Moving glibconfig.h to the main glib include directory didn't seem like the appropriate thing to do, since it includes installation-specific settings.

11. RMB Settings... on the project, change Setting For to All Configurations.

12. On the C/C++ tab, Category: Preprocessor, add the paths for each of the three include subdirectories of the previously downloaded packages to the Additional include directories field (the glib include path ends in include\glib-2.0).

13. On the Link tab, Category: Input, add gimp.lib, intl.lib, and glib-2.0.lib to the Object/library modules, and add the paths for each of the three lib subdirectories of the previously downloaded packages to the Additional library path field.

14. Hit OK in the Project Settings window.

15. Select Build->Set Active Configuration from the VC menu, and select the Win32 Release configuration then click OK.

16. Select Build->Build .exe from the VC menu. Should build with no warnings or errors. You've now successfully built a duplicate of the autocrop plug-in.

17. Now copy autocrop.c to threshcrop.c (my new plug-in name), make some desired changes in the code, and provide a new location for the plug-in in the gimp menu structure by changing the approrpriate, easily recognizable argument to gimp_install_procedure, and re-build. Oops, almost forgot to mention that you need to go into Settings..., General tab for autocrop.c and select Exclude from build to avoid problems with duplicate main(), etc.

18. Copy the .exe file from your project directory to the Program Files\GIMP\lib\gimp\1.2\plug-ins directory.

19. Fire up gimp and load an image. RMB on the image and if everything worked right, then your new plug-in should be found in the gimp menu structure where you placed it in step 17. Click on the menu item for the plug-in, and it should execute, taking whatever action that it was intended to perform. Mine is a minor modification to autocrop which does cropping based on user-specified threshold values, rather than assuming that the entire border area must have only a single color. My version is MUCH better for scanned images. Still needs some minor additional development and tweaking before I'll be ready to release it for general consumption though.

One problem that I ran into was how to debug my application. Not being a C, Windows, and GIMP development guru, I wasn't sure how to do that since the plug-in could not be executed directly under the control of the debugger, as it must be executed by the gimp instead. Also, since the plug-in is a Win32 app, and not a console app, I didn't have any kind of console window to echo debugging messages. I could have created a duplicate console app specifically for debugging, but that would have required a duplicate VC project with all of the same setup, and would have been somewhat of a minor pain. So, what I did instead was really ugly: I used the text area of the gimp progress indicator to display my debugging messages! That worked, but was definitely painful, and not highly recommended.

Please note that I am NOT an experienced C developer. I wouldn't be surprised if there were some other changes to project settings in VC that might have been appropriate for performance, etc. Also, I specifically did NOT download or install everything that might be necessary to build any conceivable plugin. I only used that components that I specifically needed for this particular project. So, other folks may have additional/better suggestions, or you may need additional components besides those that I have specified here. Hopefully though, at least this will give some of you a bit of a starting point.

By the way, I did NOT use gimptool, or any other tools or make files, etc. I don't know whether any of those might have made my task any easier or not. I suspect not in this specific case, but that might be a completely different story for a more complex plug-in.

Wanted to say thanks once again to Tor Lillqvist for all of the info and files on his web site related to porting the gimp to Windows. Without that I would have been completely stuck.

s/KAM

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 10:23 AM Subject: [Gimp-user] Threshold Crop Plug-in

Hello,

I would like to develop (or preferably locate) a tool somewhat similar

to

the default gimp autocrop, but with this difference: It would allow you

to

specify a threshold range in some manner for the border that is to be cropped. If it handles RGB that would be fine, but in my case all that

I

really care about is grayscale.

I've searched the gimp registry and didn't see anything similar, so I'm considering writing one of my own by using the existing autocrop plug-in

as

a starting point. I've done some preliminary looking at the code and

have

written pseudo-code for the primary changes that would be needed.

However,

I can't seem to locate any docs on what you actually need in order to compile a plug-in...

In autocrop libgimp is the only external library that is used, and I

don't

think that I need anything else either, at least for a simple initial version with hardcoded threshold values and no user interface.

I would think that I can easily locate and download the header file(s)

for

libgimp. But I'm an inexperienced C developer, and don't know what else

if

anything that I may need. I will be mucking with tiff files, but since

gimp

itself will be doing all of the actual file interaction, I don't think

that

I should need libtiff or anything like that, right? Also, I don't need

the

libgimp source other than the header files, do I?

Finally, I will be doing my work under Windows. I have several

compilers

available, including a couple of versions of Microsoft Visual C++. I

don't

want my plug-in to be dependent on Cygwin libraries or anything like

that,

so I don't plan to use Cygwin for this development. By default (because

I

don't know any better) I was planning to MSVC++ 6.0 to write and compile

the

plug-in. Will this work? Are there any other tools that I am likely to need in order to develop this extremely simple plug-in?

After compiling, I believe that all I should need to do to run the

plug-in

is to locate it in the proper gimp subdirectory on my machine, right?

Thanks in advance for any tips.

Kevin M. Round Rock, Texas

Tor Lillqvist
2002-10-16 21:55:29 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

Carol Spears writes:
> my first instinct is to tell you *not* to try to build anything for gimp > on windows.

Actually, if a plug-in is reasonably portably written, building it on Windows isn't necessarily any more complicated than on Unix. To build and install a plug-in foobar:

gimptool --install foobar.c

This would run the command:

gcc -mpentiumpro -O4 -Wall -fnative-struct -I/include -I/lib/gtk+/include -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include -o /.gimp-1.2/plug-ins/foobar.exe foobar.c -L/target/lib-mwindows -L/lib -lgimpui -lgimp -Wl,--export-dynamic -L/lib -lgtk -lgdk -lgmodule-2.0 -lglib-2.0 -lintl -liconv

or, if you use MSVC:

set CC="cl -MD" set CFLAGS=""
set LDFLAGS=""
gimptool --msvc-syntax --install foobar.c

This would run:

cl -I/include -I/lib/gtk+/include -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include -Fe/.gimp-1.2/plug-ins/foobar.exe foobar.c -link -subsystem:windows /libpath:/lib gimpui.lib gimp.lib /libpath:/lib gtk.lib gdk.lib gmodule-2.0.lib glib-2.0.lib intl.lib iconv.lib

It is a bug in gimptool.exe as currently distributed that setting CC, CFLAGS and LDFLAGS as above is necessary. Gimptool should be able to figure out by itself that if the --msvc-syntax flag is given, it shouldn't try to use the configure-time CC, CFLAGS or LDFLAGS autoconf variables if those are intended for gcc and GNU ld.

above would be replaced by the top installation directory of GLib, GTK+ 1.3.0, GIMP etc, and with your home directory.

Like on Unix, this requires that you have installed the gimp, gtk+-1.3.0, glib-2.0 developer packages (containing for instance the gimptool program, and headers and import libraries), plus the libintl and iconv packages. (If the plug-in doesn't need libintl or libiconv, you can edit out those from the command line.)

--tml

Kevin Myers
2002-10-16 23:16:42 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

Hi Tor -

Thanks very much for this extremely helpful additional info!

s/KAM

----- Original Message ----- From: "Tor Lillqvist"
To: "gimp developers"
Sent: Wednesday, October 16, 2002 2:55 PM Subject: [Gimp-developer] Re: Fw: [Gimp-user] Threshold Crop Plug-in

Carol Spears writes:
> my first instinct is to tell you *not* to try to build anything for

gimp

on windows.

Actually, if a plug-in is reasonably portably written, building it on Windows isn't necessarily any more complicated than on Unix. To build and install a plug-in foobar:

gimptool --install foobar.c

This would run the command:

gcc -mpentiumpro -O4 -Wall -fnative-struct -I/include -I/lib/gtk+/ include -I/include/glib-2.0 -I/lib/glib-2.0/include -I/incl ude -o /.gimp-1.2/plug-ins/foobar.exe foobar.c -L/target/lib-mwindows -L/lib -lgimpui -lgimp -Wl,--export-dy namic -L/lib -lgtk -lgdk -lgmodule-2.0 -lglib-2.0 -lintl -liconv

or, if you use MSVC:

set CC="cl -MD" set CFLAGS=""
set LDFLAGS=""
gimptool --msvc-syntax --install foobar.c

This would run:

cl -I/include -I/lib/gtk+/include -I/include/glib-2.0 -I

/lib/glib-2.0/include -I/include -Fe/.gimp-1.2/plug-ins/foobar

.exe foobar.c -link -subsystem:windows /libpath:/lib gimpui.lib gimp.lib /libpath:/lib gtk.lib gdk.lib gmodule-2.0.lib glib-2.0.lib intl.lib iconv.lib

It is a bug in gimptool.exe as currently distributed that setting CC, CFLAGS and LDFLAGS as above is necessary. Gimptool should be able to figure out by itself that if the --msvc-syntax flag is given, it shouldn't try to use the configure-time CC, CFLAGS or LDFLAGS autoconf variables if those are intended for gcc and GNU ld.

above would be replaced by the top installation directory of GLib, GTK+ 1.3.0, GIMP etc, and with your home directory.

Like on Unix, this requires that you have installed the gimp, gtk+-1.3.0, glib-2.0 developer packages (containing for instance the gimptool program, and headers and import libraries), plus the libintl and iconv packages. (If the plug-in doesn't need libintl or libiconv, you can edit out those from the command line.)

--tml

Kevin Myers
2002-10-16 23:22:38 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

Hi Tor -

Sorry for the extra email, but one question: When using gimptool as you describe below, what is the correct approach for handling the configuration-specific files such as config.h, gdkconfig.h, and glibconfig.h which aren't in the normal include paths in the developer packages? Should I copy those files into their correspoding include subdirectories, or is some other approach more appropriate?

Thanks again.

Regards, Kevin M.

----- Original Message ----- From: "Tor Lillqvist"
To: "gimp developers"
Sent: Wednesday, October 16, 2002 2:55 PM Subject: [Gimp-developer] Re: Fw: [Gimp-user] Threshold Crop Plug-in

Carol Spears writes:
> my first instinct is to tell you *not* to try to build anything for

gimp

on windows.

Actually, if a plug-in is reasonably portably written, building it on Windows isn't necessarily any more complicated than on Unix. To build and install a plug-in foobar:

gimptool --install foobar.c

This would run the command:

gcc -mpentiumpro -O4 -Wall -fnative-struct -I/include -I/lib/gtk+/ include -I/include/glib-2.0 -I/lib/glib-2.0/include -I/incl ude -o /.gimp-1.2/plug-ins/foobar.exe foobar.c -L/target/lib-mwindows -L/lib -lgimpui -lgimp -Wl,--export-dy namic -L/lib -lgtk -lgdk -lgmodule-2.0 -lglib-2.0 -lintl -liconv

or, if you use MSVC:

set CC="cl -MD" set CFLAGS=""
set LDFLAGS=""
gimptool --msvc-syntax --install foobar.c

This would run:

cl -I/include -I/lib/gtk+/include -I/include/glib-2.0 -I

/lib/glib-2.0/include -I/include -Fe/.gimp-1.2/plug-ins/foobar

.exe foobar.c -link -subsystem:windows /libpath:/lib gimpui.lib gimp.lib /libpath:/lib gtk.lib gdk.lib gmodule-2.0.lib glib-2.0.lib intl.lib iconv.lib

It is a bug in gimptool.exe as currently distributed that setting CC, CFLAGS and LDFLAGS as above is necessary. Gimptool should be able to figure out by itself that if the --msvc-syntax flag is given, it shouldn't try to use the configure-time CC, CFLAGS or LDFLAGS autoconf variables if those are intended for gcc and GNU ld.

above would be replaced by the top installation directory of GLib, GTK+ 1.3.0, GIMP etc, and with your home directory.

Like on Unix, this requires that you have installed the gimp, gtk+-1.3.0, glib-2.0 developer packages (containing for instance the gimptool program, and headers and import libraries), plus the libintl and iconv packages. (If the plug-in doesn't need libintl or libiconv, you can edit out those from the command line.)

--tml

Tor Lillqvist
2002-10-17 00:06:17 UTC (over 21 years ago)

Fw: [Gimp-user] Threshold Crop Plug-in

Kevin Myers writes:
> Sorry for the extra email, but one question: When using gimptool as you > describe below, what is the correct approach for handling the > configuration-specific files such as config.h, gdkconfig.h, and glibconfig.h > which aren't in the normal include paths in the developer packages?

If you look at the gimptool output, you see that it includes -I flags for the directories where gdkconfig.h and glibconfig.h are (-I/lib/gtk+/include and -I/lib/glib-2.0/include). These headers are in the "lib" subtree because they are architecture-specific and compiler-specific, even though in the Win32 case glibconfig.h (if generated from the manually maintained glibconfig.h.win32.in) is good for both gcc and MSVC. The other headers can be shared among all architectures and compilers.

GIMP's config.h isn't supposed to be used by plug-ins (other than those bundled with the GIMP sources). A GIMP developer package does not contain the config.h file. If a separately distributed plug-in uses a configure script, it will produce an own config.h for that plug-in.

> Should I copy those files into their correspoding include > subdirectories, or is some other approach more appropriate?

Just leave them where they are and use appropriate -I switches.

--tml