[[build]]
=== Upstream build systems

Upstream build systems are designed to go through several steps to install generated binary files to the system from the source distribution.

[[autotools]]
==== Autotools

Autotools (*autoconf* + *automake*) has 4 steps.

1. setup the build system (``*vim configure.ac Makefile.am*'' and ``*autoreconf -ivf*'')
2. configure the build system (``*./configure*'')
3. build the source tree (``*make*'')
4. install the binary files (``*make install*'')

The upstream usually performs the step 1 and builds the upstream tarball for distribution using the ``*make dist*'' command.   (The generated tarball contains not only the pristine upstream VCS contents but also other generated files.)

The package maintainer needs to take care steps 2 to 4 at least.  This is realized by the ``*dh $@ --with autotools-dev*'' command used in the *debian/rules* file.

The package maintainer may wish to take care all steps 1 to 4.  This is realized by the ``*dh $@ --with autoreconf*'' command used in the *debian/rules* file.  This rebuilds all auto-generated files to the latest version ones and provides better supports for the porting to the newer architectures.

If you wish to learn more on the Autotools, please see:

* https://www.gnu.org/software/automake/manual/index.html[GNU Automake documentation]
* https://www.gnu.org/software/autoconf/manual/index.html[GNU Autoconf documentation]
* https://www.lrde.epita.fr/~adl/autotools.html[Autotools Tutorial]
* https://www.dwheeler.com/autotools/introduction-autotools.pdf[Introduction to the autotools (autoconf, automake, and libtool)]
* https://autotools.io/index.html[Autotools Mythbuster]

[[cmake]]
==== CMake

CMake has 4 steps.

1. setup the build system (``*vim CMakeLists.txt config.h.in*'')
2. configure the build system (``*cmake*'')
3. build the source tree (``*make*'')
4. install the binary files (``*make install*'')

The upstream tarball contains no auto-generated files and is generated by the *tar* command after the step 1.

The package maintainer needs to take care steps 2 to 4.

If you wish to learn more on the CMake, please see:

* https://cmake.org/[CMake]
* https://cmake.org/cmake-tutorial/[CMake tutorial]

[[distutils]]
==== Python distutils

Python distutils has 3 steps.

1. setup and configure the build system (``*vim setup.py*'')
2. build the source tree (``*python setup.py build*'')
3. install the binary files (``*python setup.py install*'')

The upstream usually performs the step 1 and builds the upstream tarball for distribution using the ``*python setup.py sdist*'' command.

The package maintainer needs to take care the step 2.  This is realized simply by the ``*dh $@*'' command used in the *debian/rules* file, after *jessie*.

The situation of other build systems, such as CMake, are very similar to this Python one.

If you wish to learn more on the Python3 and *distutils*, please see:

* https://docs.python.org/3/[Python3]
* https://docs.python.org/3.4/library/distutils.html#module-distutils[distutils]
