From GIMP Developer Wiki
Revision as of 18:24, 9 April 2014 by Scl (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page will teach you how to set Netbeans IDE to work on the latest source of GIMP from git. In order to work with Netbeans on GIMP, you will have to install the C plugin for Netbeans (or simply download Netbeans with C support). See Configuring the NetBeans IDE for C/C++/Fortran.

Why use Netbeans to work on GIMP?

  • Because it has an extremely good autocompletion, that will be configured automatically for you!
  • Because it's an IDE and not just a text editor (meaning it manages many files at once, it has syntax highlighting, it can manage tasks, ...)
  • Because it's very easy to use (it's not Emacs :P)

Why not to use Netbeans to work on GIMP?

  • Because it's not Emacs :P

Preparing the build environment

In order for Netbeans to be able to configure all the dependencies of GIMP automatically, you will have to have a working environment in which you can compile GIMP. Netbeans will pull all the needed configurations from your Makefile, so we need to be able to reach the stage of generating GIMP's Makefiles.

Building GIMP itself is a subject for a different page - see Build:Basic After you have the version of GIMP which you want to work on, run the ./configure script to generate all the makefiles (or run ./autogen.sh if you are building GIMP from git). Build GIMP and test that it works without any errors - if there any errors (especially in the Makefile) it will annoy Netbeans...

Configuring Netbeans to work on GIMP

This was tested with Netbeans 6.8 on GIMP 2.7.1 from git. For any errors/problems please report to LightningIsMyName at irc://irc.gimp.org/#gimp.

  1. Open Netbeans.
  2. Create a new project.
  3. In the "Choose Project" screen, choose "C/C++" -> "C/C++ project with existing sources", and click Next.
  4. In the "Select Mode" screen:
    • For the folder, choose the root folder of GIMP's source.
    • For the configuration mode, choose "Custom".
    • Click Next.
  5. In the "Build Tool" screen, choose "Using an Existing makefile" and make sure that the selected file is called "Makefile" and it's directly under GIMP's source root dir. Click Next.
  6. In the build action screen, you can either leave it as is or pass other parameters. For example, I like to add "-j3" to the "Build Command" so that build will use two cores (since I'm on a Dual-Core PC). Click Next.
  7. In the "Source Files" screen, simply click Next.
  8. In the "Code Assistance Configuration", make sure "Automatic Configuration" is selected and click Next
  9. In the "Project Name and Location" screen, give a name for your project and choose a directory for it's configuration files (do NOT select GIMP's source directory!). Click Finish

Netbeans will now scan and parse GIMP's source. You may encounter the following problems during this scan:

  • You will get a dialog asking questions about associating certain file types (usually about xbm) with Netbeans. Say No.
  • After parsing will reach 100% it will get stuck - the UI will still be partially responsive, but it will remain on 100%. When this happens, close Netbeans and launch it again
  • After opening the project for the first time, netbeans will just get stuck without any obvious reason. Close it (if needed, do it brutally) and launch it again.

Final Notes:

  • Every time you'll launch Netbeans, if the GIMP project is still open from last time it will parse it and parsing the entire source can take 3-10 minutes (depending on your computer). Go drink some coffee and get back to it when it's done =) You can disable the source analysis, to make the startup way faster, be right-clicking the project icon and disabling the checkbox in "Code Assitance -> C\C++ Code Assitance". You will have no C/C++ Code assitance, but the IDE will load much faster without the need to wait.
  • If you want to update GIMP's source (from git), first of all close Netbeans. Now run again the ./autogen.sh script to regenerate the makefiles and only then launch Netbeans again.
  • You can not debug plugins with the IDE since plugins are external programs started by GIMP, and not a part of GIMP itself. See the plugin debugging information in devel-docs/debug-plug-ins.txt