GRASS GIS is written in more than one programming language. While most of the source code is written in C, about 30% is written in Python. A compiler is needed to convert the C/C++ source code into executable files ("binaries"). In contrast, Python is an interpreted language that can only be executed with Python software.
Now, in order to create an installable binary package from a source code package, the so-called "compilation step" is required. While the source code consists of thousands of C and Python files (plus HTML documentation), the included "makefiles" tell the build system to generate binaries from the source code in the correct order, render the manual pages, etc.
The way to install the compiler tools and Python depends on the operating system. To make this easier, we have collected copy-paste instructions for most operating systems in our wiki:
Compile and install instructions
There is more than one way of contributing, see full list at https://grass.osgeo.org/get-involved/. In the rest of this document, we will focus on contributions centered around the GRASS GIS source code.
To report an issue or to suggest features or a change, open an issue on GitHub.
This guide covers contributing to the main version of GRASS GIS source code which is in the branch called main. It assumes that you have some very basic knowledge of Git and GitHub, but if you don't just go through some tutorial online or ask on the GRASS GIS developer mailing list.
Fork
button in the upper right corner
of the GitHub interface).git clone git@github.com:your_GH_account/grass.git
cd grass/
git remote add upstream https://github.com/OSGeo/grass
git remote -v
origin git@github.com:your_GH_account/grass.git (fetch)
origin git@github.com:your_GH_account/grass.git (push)
upstream https://github.com/OSGeo/grass.git (fetch)
upstream https://github.com/OSGeo/grass.git (push)
It is important that "origin" points to your fork.
git checkout main
git fetch upstream
git rebase upstream/main
If rebase
fails with "error: cannot rebase: You have unstaged changes...",
then move your uncommitted local changes to "stash" using:
git stash
git rebase upstream/main
git stash apply
git stash pop
Now you have updated your local main branch, you can create a feature branch based on it.
git checkout -b new-feature
You can use your favorite tools to change source code or other files in the local copy of the code. When make changes, please follow Submitting Guidelines at http://trac.osgeo.org/grass/wiki/Submitting.
git add file1
git add file2
git commit -m "module: added a new feature"
git push origin new-feature
When you push, GitHub will respond back in the command line to tell
you what URL to use to create a pull request. You can follow that URL
or you can go any time later to your fork on GitHub, display the
branch new-feature
, and GitHub will show you button to create
a pull request.
GRASS GIS maintainers will now review your pull request. If needed, the maintainers will work with you to improve your changes.
Once the changes in the pull request are ready to be accepted, the maintainers will usually squash all your commits into one commit and merge it to the main branch.
Once the pull request is merged, it is a good time to update your local main branch in order to get the change you just contributed.
GRASS GIS maintainers use additional workflows besides the one described above. These are detailed at https://trac.osgeo.org/grass/wiki/HowToGit