Difference between revisions of "Developing custom GRASS programs"

From Rhessys
Jump to navigationJump to search
Line 7: Line 7:
 
latest version of XCode.  You will be required to create a free account before you can download the tools.
 
latest version of XCode.  You will be required to create a free account before you can download the tools.
  
===Get the grass source===
+
===Get the GRASS source===
  
 
In order to write your own custom GRASS programs, you will need the GRASS header files and
 
In order to write your own custom GRASS programs, you will need the GRASS header files and
Line 26: Line 26:
 
Next, getting the GRASS source.  To download the GRASS source, go to http://grass.itc.it/download/index.php.  It is best to download
 
Next, getting the GRASS source.  To download the GRASS source, go to http://grass.itc.it/download/index.php.  It is best to download
 
the RC code, as svn code may have issues compiling.  If you did not find the necessary .h and .dylib files, it will be necessary to
 
the RC code, as svn code may have issues compiling.  If you did not find the necessary .h and .dylib files, it will be necessary to
compile GRASS.  Unfortunately, GRASS has a long list of dependencies.
+
compile GRASS.  Unfortunately, GRASS has a long list of dependencies, and building can be rather difficult. An explanation of building
 +
software and all it's dependancies is beyond the scope of this tutorial. 
 +
 
 +
 
 +
===Examining the GRASS source===

Revision as of 10:44, 13 October 2009

As the majority of the RHESSys group is using OS X, this article targets that OS. However, most of the content should apply to any operating system.

Get a compiler

Development tools are not installed by default on OS X. You can install the dev tools from any OS X installation CD. For the most recent version, go Apple's Mac Dev Center and download the latest version of XCode. You will be required to create a free account before you can download the tools.

Get the GRASS source

In order to write your own custom GRASS programs, you will need the GRASS header files and libraries. Even if you already have GRASS on your computer, these may not be installed. Additionally, the actual GRASS source code is an excellent resource for learning to write new GRASS modules, and should be downloaded even if your installation already has the necessary headers and libraries.

First, check to see if your GRASS install has the necessary headers and libraries.

  1. Open a terminal window
  2. cd to the folder containing your GRASS executable
  3. $> ls <GRASS app name>/Contents/MacOS/include/grass
  4. If you see several files ending in .h, one of which is gis.h, then you have the GRASS headers.
  5. $> ls <GRASS app name>/Contents/MacOS/lib
  6. You should see a long list of files ending in .dylib. Make sure that one of them is libgrass_gis.dylib.
  7. If your GRASS install had both the .h and .dylib files, then you already have the necessary files and do not need to download the source.


Next, getting the GRASS source. To download the GRASS source, go to http://grass.itc.it/download/index.php. It is best to download the RC code, as svn code may have issues compiling. If you did not find the necessary .h and .dylib files, it will be necessary to compile GRASS. Unfortunately, GRASS has a long list of dependencies, and building can be rather difficult. An explanation of building software and all it's dependancies is beyond the scope of this tutorial.


Examining the GRASS source