Skip to content

Commit ef5aaef

Browse files
committed
Doc: Consolidate info on build dependencies and processes
- CONTRIBUTING.md is replaced with a link to the "contributing" section of the docs - Information on build requirements is consolidated in "development/dev_environment.rst" - Build instructions are moved from "build_hints.rst" to "development/building_from_source.rst" - Basic information on running tests is added to "development/testing.rst" - Git usage is moved from CONTRIBUTING.md to "development/dev_practices.rst" - Basic information on building docs is added to "development/dev_documentationrst." The style guide is moved from "contributing" to this location.
1 parent 5327c14 commit ef5aaef

13 files changed

Lines changed: 462 additions & 501 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 232 deletions
Original file line numberDiff line numberDiff line change
@@ -1,232 +1 @@
1-
# Setting development environment (Unix)
2-
3-
## Build SWIG
4-
5-
SWIG (https://swig.org/) is required to compile GDAL with other programming languages, such as Python.
6-
7-
> **Note**
8-
> SWIG version 4.0.2 is required.
9-
10-
Set the installation path:
11-
12-
```bash
13-
export SWIG_PREFIX=/path/to/install
14-
15-
```
16-
17-
Install SWIG from source:
18-
19-
```bash
20-
export SWIG_VERSION=4.0.2
21-
mkdir /tmp/swig/
22-
cd /tmp/swig/
23-
wget https://sourceforge.net/projects/swig/files/swig/swig-${SWIG_VERSION}/swig-${SWIG_VERSION}.tar.gz/download -O swig-${SWIG_VERSION}.tar.gz
24-
tar xf swig-${SWIG_VERSION}.tar.gz
25-
cd swig-${SWIG_VERSION}
26-
./configure --prefix=$SWIG_PREFIX
27-
make
28-
make install
29-
export PATH=$SWIG_PREFIX/bin:$PATH
30-
```
31-
32-
## Build GDAL: CMake
33-
34-
Install all required development packages: GNU make, g++, ...
35-
36-
Setup [Python Virtual environment](https://docs.python.org/3/library/venv.html):
37-
38-
> **Note**
39-
> Add the [Python_FIND_VIRTUALENV=ONLY](https://gdal.org/build_hints.html#cmdoption-arg-Python_FIND_VIRTUALENV) `cmake` option with a Python virtual environment.
40-
41-
```bash
42-
python -m venv gdal_venv
43-
. gdal_venv/bin/activate
44-
python -m pip install numpy
45-
```
46-
47-
Setup pre-commit:
48-
49-
```bash
50-
python -m pip install pre-commit
51-
pre-commit install
52-
```
53-
54-
55-
Configure and build:
56-
57-
> **Note**
58-
> For a minimal build, add these options: `GDAL_BUILD_OPTIONAL_DRIVERS=OFF` `OGR_BUILD_OPTIONAL_DRIVERS=OFF`.
59-
> To enable specific drivers, add `GDAL_ENABLE_DRIVER_<driver_name>=ON` or `OGR_ENABLE_DRIVER_<driver_name>=ON`.
60-
> See [Selection of Drivers](https://gdal.org/build_hints.html#selection-of-drivers)
61-
> for more details.
62-
63-
```bash
64-
mkdir build
65-
cd build
66-
cmake .. -DSWIG_EXECUTABLE=$SWIG_PREFIX/bin/swig -DSWIG_REGENERATE_PYTHON=ON [options]
67-
cmake --build . -j$(nproc)
68-
```
69-
70-
Run command line utilities (without installing):
71-
```bash
72-
. ../scripts/setdevenv.sh
73-
gdalinfo --version
74-
```
75-
This will set the PATH, LD_LIBRARY_PATH/DY_LD_LIBRARY_PATH, GDAL_DATA and PYTHONPATH environment variables to point to the build artifacts.
76-
77-
Run autotest suite:
78-
```bash
79-
python -m pip install -r ../autotest/requirements.txt
80-
pytest autotest
81-
```
82-
83-
## Build GDAL: use Vagrant
84-
85-
Make sure the Vagrant binary is installed on your system.
86-
87-
Perform initial setup of the Vagrant GDAL virtual machine:
88-
```bash
89-
# VAGRANT_VM_CPU=number_of_cpus
90-
vagrant up
91-
```
92-
93-
And then to incrementally develop into it:
94-
```bash
95-
vagrant ssh
96-
ninja
97-
```
98-
99-
Note that the following directories on the host will be created (and can be
100-
removed if no longer needed the Vagrant environment):
101-
- ../apt-cache/ubuntu/jammy64: contains a cache of Ubuntu packages of the VM,
102-
to allow faster VM reconstruction
103-
- build_vagrant: CMake build directory
104-
- ccache_vagrant: CCache directory
105-
106-
## Build GDAL: Autotools
107-
108-
> **Note**
109-
> Only applies to GDAL 3.4 or earlier
110-
111-
Install all required development packages: GNU make, g++, ...
112-
113-
Build:
114-
115-
```bash
116-
./autogen.sh
117-
./configure --with-python [other options]
118-
make -j8 -s
119-
cd apps; make -s test_ogrsf; cd ..
120-
```
121-
122-
Run command line utilities (without installing):
123-
```bash
124-
. scripts/setdevenv.sh
125-
gdalinfo --version
126-
```
127-
128-
Run autotest suite:
129-
```bash
130-
cd autotest
131-
pip install -r requirements.txt
132-
pytest
133-
```
134-
135-
# Git workflows with GDAL
136-
137-
This is not a git tutorial or reference manual by any means. This just collects
138-
a few best practice for git usage for GDAL development.
139-
140-
## Commit message
141-
142-
Indicate a component name (eg a driver name), a short description and when
143-
relevant, a reference to a issue (with 'fixes #' if it actually fixes it)
144-
145-
```
146-
COMPONENT_NAME: fix bla bla (fixes #1234)
147-
148-
Details here...
149-
```
150-
151-
## Initiate your work repository
152-
153-
Fork OSGeo/gdal from github UI, and then
154-
```bash
155-
git clone https://github.com/OSGeo/gdal
156-
cd gdal
157-
git remote add my_user_name git@github.com:my_user_name/gdal.git
158-
```
159-
160-
## Updating your local master against upstream master
161-
162-
```bash
163-
git checkout master
164-
git fetch origin
165-
# Be careful: this will loose all local changes you might have done now
166-
git reset --hard origin/master
167-
```
168-
169-
## Working with a feature branch
170-
171-
```bash
172-
git checkout master
173-
# potentially update your local master against upstream, as described above
174-
git checkout -b my_new_feature_branch
175-
176-
# do work. For example:
177-
git add my_new_file
178-
git add my_modifid_message
179-
git rm old_file
180-
git commit -a
181-
182-
# you may need to resynchronize against master if you need some bugfix
183-
# or new capability that has been added since you created your branch
184-
git fetch origin
185-
git rebase origin/master
186-
187-
# At end of your work, make sure history is reasonable by folding non
188-
# significant commits into a consistent set
189-
git rebase -i master
190-
# use 'fixup' for example to merge several commits together,
191-
# and 'reword' to modify commit messages
192-
193-
# or alternatively, in case there is a big number of commits and marking
194-
# all them as 'fixup' is tedious
195-
git fetch origin
196-
git rebase origin/master
197-
git reset --soft origin/master
198-
git commit -a -m "Put here the synthetic commit message"
199-
200-
# push your branch
201-
git push my_user_name my_new_feature_branch
202-
From GitHub UI, issue a pull request
203-
```
204-
205-
If the pull request discussion or Travis-CI/AppVeyor checks require changes,
206-
commit locally and push. To get a reasonable history, you may need to
207-
```git rebase -i master```, in which case you will have to force-push your
208-
branch with ```git push -f my_user_name my_new_feature_branch```
209-
210-
211-
## Backporting bugfixes from master to a stable branch
212-
213-
```bash
214-
git checkout master
215-
With git log, identify the sha1sum of the commit you want to backport
216-
git checkout 2.2 # if you want to backport to 2.2
217-
git pull origin 2.2
218-
# git checkout -b branch_name # if you intend to submit the backport as a pull request
219-
git cherry-pick the_sha1_sum
220-
git push ...
221-
```
222-
If changes are needed, do them and ```git commit -a --amend```
223-
224-
225-
## Things you should NOT do
226-
227-
(For anyone with push rights to github.com/OSGeo/gdal) Never modify a commit or
228-
the history of anything that has been
229-
committed to https://github.com/OSGeo/gdal
230-
231-
Committing symbolic links is allowed only under the .github directory in order to
232-
avoid potential problems on Windows.
1+
Contributor information is provided at the GDAL [website](https://gdal.org/contributing).

doc/source/contributing/developer.rst

Lines changed: 0 additions & 136 deletions
This file was deleted.

doc/source/contributing/index.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
How to contribute?
55
================================================================================
66

7-
.. toctree::
7+
There are several ways for users to contribute to GDAL:
88

9-
developer
10-
rst_style
9+
* :ref:`contributing code<development>` (bug fixes or enhancements)
10+
* filing high-quality `bug reports <https://github.com/osgeo/gdal/issues>`_
11+
* improving :ref:`documentation<dev_documentation>`
12+
* :ref:`financial sponsorship<sponsors>`

0 commit comments

Comments
 (0)