Sphinx can syntax-highlight a block if we use the right syntax.
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4630>
For example, if the game was released in 2001, do
-::
+.. code-block:: console
export MESA_EXTENSION_MAX_YEAR=2001
- Opening braces go on the same line as the if/for/while statement. For
example:
- ::
+ .. code-block:: c
if (condition) {
foo;
- This GNU indent command generally does the right thing for
formatting:
- ::
+ .. code-block:: console
indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
Single-line comments:
- ::
+ .. code-block:: c
/* null-out pointer to prevent dangling reference below */
bufferObj = NULL;
Or,
- ::
+ .. code-block:: c
bufferObj = NULL; /* prevent dangling reference below */
Multi-line comment:
- ::
+ .. code-block:: c
/* If this is a new buffer object id, or one which was generated but
* never used before, allocate a buffer object now.
We try to quote the OpenGL specification where prudent:
- ::
+ .. code-block:: c
/* Page 38 of the PDF of the OpenGL ES 3.0 spec says:
*
Function comment example:
- ::
+ .. code-block:: c
/**
* Create and initialize a new buffer object. Called via the
- If ``glext.h`` doesn't define the extension, edit ``include/GL/gl.h``
and add code like this:
- ::
+ .. code-block:: c
#ifndef GL_EXT_the_extension_name
#define GL_EXT_the_extension_name 1
To unpack the tarball:
-::
+.. code-block:: console
tar xf mesa-Y.N.P.tar.xz
or
-::
+.. code-block:: console
tar xf mesa-Y.N.P.tar.gz
#. Configure your build with the desired client APIs and enable the
driver for your hardware. For example:
- ::
+ .. code-block:: console
$ meson configure \
-D egl=true \
For Linux, on a recent Debian based distribution do:
- ::
+ .. code-block:: console
aptitude install llvm-dev
For a RPM-based distribution do:
- ::
+ .. code-block:: console
yum install llvm-devel
To build everything on Linux invoke scons as:
-::
+.. code-block:: console
scons build=debug libgl-xlib
Alternatively, you can build it with meson with:
-::
+.. code-block:: console
mkdir build
cd build
but the rest of these instructions assume that scons is used. For
Windows the procedure is similar except the target:
-::
+.. code-block:: console
scons platform=windows build=debug libgl-gdi
If Meson is not already installed on your system, you can typically
install it with your package installer. For example:
-::
+.. code-block:: console
sudo apt-get install meson # Ubuntu
or
-::
+.. code-block:: console
sudo dnf install meson # Fedora
flex, and bison. The easiest way to install everything you need is with
`chocolatey <https://chocolatey.org/>`__.
-::
+.. code-block:: console
choco install python3 winflexbison pkgconfiglite
You can even use chocolatey to install mingw and ninja (ninja can be
used with MSVC as well)
-::
+.. code-block:: console
choco install ninja mingw
Then install meson using pip
-::
+.. code-block:: console
py -3 -m pip install meson mako
Basic configuration is done with:
-::
+.. code-block:: console
meson build/
To review the options which Meson chose, run:
-::
+.. code-block:: console
meson configure build/
options for a previously configured build directory. All options passed
to this command are in the form ``-D "option"="value"``. For example:
-::
+.. code-block:: console
meson configure build/ -Dprefix=/tmp/install -Dglx=true
Once you've run the initial ``meson`` command successfully you can use
your configured backend to build the project in your build directory:
-::
+.. code-block:: console
ninja -C build/
finishes up some final steps of the build process (such as creating
symbolic links for drivers). To install:
-::
+.. code-block:: console
ninja -C build/ install
configuration tool) as part of the build process, Meson does not do
this. Instead, you will need do this:
- ::
+ .. code-block:: console
ninja -C build/ xmlpool-pot xmlpool-update-po xmlpool-gmo
than the system library directory. This can be done with the --prefix
option. For example:
-::
+.. code-block:: console
meson --prefix="${PWD}/build/install" build/
This example sets -fmax-errors for compiling C sources and -DMAGIC=123
for C++ sources:
-::
+.. code-block:: console
meson builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123
This is an example of specifying the clang compilers and cleaning the
build directory before reconfiguring with an extra C option:
-::
+.. code-block:: console
CC=clang CXX=clang++ meson build-clang
ninja -C build-clang
``-Dcmake_module_path`` option in this meson version, which points to
the root of an alternative installation (the prefix). For example:
-::
+.. code-block:: console
meson builddir -Dcmake_module_path=/home/user/mycmake/prefix
Then configure meson:
-::
+.. code-block:: console
meson builddir/ --native-file custom-llvm.ini
windows), which will be searched for ``llvm-config``,
``llvm-config$version``, and ``llvm-config-$version``:
-::
+.. code-block:: console
PATH=/path/to/folder/with/llvm-config:$PATH meson build
Then configure meson:
-::
+.. code-block:: console
meson builddir/ --cross-file cross-llvm.ini
- ``git rebase -i ...`` is your friend. Don't be afraid to use it.
- Apply a fixup to commit FOO.
- ::
+ .. code-block:: console
git add ...
git commit --fixup=FOO
- Test for build breakage between patches e.g last 8 commits.
- ::
+ .. code-block:: console
git rebase -i --exec="ninja -C build/" HEAD~8
- Sets the default mailing address for your repo.
- ::
+ .. code-block:: console
git config --local sendemail.to mesa-dev@lists.freedesktop.org
- Add version to subject line of patch series in this case for the last
8 commits before sending.
- ::
+ .. code-block:: console
git send-email --subject-prefix="PATCH v4" HEAD~8
git send-email -v4 @~8 # shorter version, inherited from git format-patch