This is a guide for those who wish to hack on the MPD source code. MPD is an open project, and we are always happy about contributions. So far, more than 150 people have contributed patches. This document is work in progress. Most of it may be incomplete yet. Please help!
Configure with the options :option:`--enable-debug --enable-werror`. Enable as many plugins as possible, to be sure that you don't break any disabled code.
Don't mix several changes in one single patch. Create a separate patch for every change. Tools like :program:`stgit` help you with that. This way, we can review your patches more easily, and we can pick the patches we like most first.
stgit allows you to create a set of patches and refine all of them: you can go back to any patch at any time, and re-edit it (both the code and the commit message). You can reorder patches and insert new patches at any position. It encourages creating separate patches for tiny changes.
stgit needs to be initialized on a git repository:
..code-block:: sh
stg init
Before you edit the code, create a patch:
..code-block:: sh
stg new my-patch-name
stgit now asks you for the commit message.
Now edit the code. Once you're finished, you have to "refresh" the patch, i.e. your edits are incorporated into the patch you have created:
..code-block:: sh
stg refresh
You may now continue editing the same patch, and refresh it as often as you like. Create more patches, edit and refresh them.
To view the list of patches, type stg series. To go back to a specific patch, type stg goto my-patch-name; now you can re-edit it (don't forget stg refresh when you're finished with that patch).
When the whole patch series is finished, convert stgit patches to git commits:
The `static analyzer <http://clang-analyzer.llvm.org/>`_ is a tool that helps find bugs. To run it on the MPD code base, install LLVM and clang. configure MPD to use clang:
It is recommended to use :option:`--enable-debug`, because the analyzer takes advantage of :dfn:`assert()` calls, which are only enabled in the debug build.
The options :option:`--use-c++` and :option:`--use-cc` are necessary because it invokes :command:`cc` for actually compiling the sources by default. That breaks, because MPD requires a C99 compiler.