<commit_before>%% Copyright (C) 2010, 2011, 2012, <NAME>.
%%
%% This software is provided "as is" without warranty of any kind,
%% either expressed or implied, including but not limited to the
%% implied warranties of fitness for a particular purpose.
%%
%% See the LICENSE file for more information.

\chapter{Building \usdk}
\label{sec:build}
\setHtmlFileName{build}

\lstnewenvironment{package}[1][]
  {% Don't do that: we don't want to show "C++ program" in marginpar
   % \cxxPre%
    \lstset{language={},
      style=UrbiSDKEnv,
      #1}}
  {\cxxPost}
\label{sec:build:configure}
This section is meant for people who want to \emph{build} the \usdk.  If
you just want to install a pre-built \usdk, see \autoref{sec:installation}.

A foreword that applies to any package, not just \usdk: \strong{building or
  checking as root is a bad idea}.  Build as a regular user, and run
\samp{sudo make install} just for the install time \emph{if you need
  privileges to install to the chosen destination}.


\section{Building}
\label{sec:build:req}
\usdk uses qibuild as its buildsystem.

\subsection{Getting and installing qibuild}

\begin{shell}
$ git clone https://github.com/aldebaran/qibuild
$ cd qibuild
$ ./install-qibuild.sh
\end{shell}

\subsection{Setting up an urbi worktree}

\begin{shell}
$ mkdir work
$ cd work
$ qisrc init
$ qisrc add https://github.com/aldebaran/libport.git
$ qisrc add https://github.com/aldebaran/urbi.git
$ qisrc add https://github.com/aldebaran/qjpeg.git
\end{shell}

\subsection{Building}

\begin{shell}
$ qibuild configure urbi
$ qibuild make urbi
\end{shell}

Add \command --release to make a release build.

\subsection{Modifying the grammar or the AST}

The build procedure above will use pregenerated files for the grammar
and the AST files.

If you wish to modify ugrammar.y, utoken.l, or ast.yml, you must enable
grammar/ast processing by passing \command -DHAVE\_CUSTOM\_BISON=On. This currently
requires custom patches into bison that you can find in urbi-sdk 2.7.5 source
tarball.

\subsection{Installing}

\begin{shell}
$ qibuild install urbi <INSTALL\_DIR>
\end{shell}

\section{Run}
\label{sec:build:run}

You can now run the \command urbi-launch binary, either from the build directory or
the install directory. See \autoref{sec:tools:urbi-launch} for informations
on its command line.

In addition to the ``public'' environment variables
(\autoref{sec:tools:env}), some other, reserved for developers, alter the
behavior of the programs.

\begin{envs}
\item[URBI\_ACCEPT\_BINARY\_MISMATCH] As a safety net, Urbi checks that
  loaded modules were compiled with exactly the same version of Urbi SDK.
  Define this variable to skip this check, at your own risks.
<commit_msg>Doc: update build guide.<commit_after>%% Copyright (C) 2010, 2011, 2012, Gostai S.A.S.
%%
%% This software is provided "as is" without warranty of any kind,
%% either expressed or implied, including but not limited to the
%% implied warranties of fitness for a particular purpose.
%%
%% See the LICENSE file for more information.

\chapter{Building \usdk}
\label{sec:build}
\setHtmlFileName{build}

\lstnewenvironment{package}[1][]
  {% Don't do that: we don't want to show "C++ program" in marginpar
   % \cxxPre%
    \lstset{language={},
      style=UrbiSDKEnv,
      #1}}
  {\cxxPost}
\label{sec:build:configure}
This section is meant for people who want to \emph{build} the \usdk.  If
you just want to install a pre-built \usdk, see \autoref{sec:installation}.

A foreword that applies to any package, not just \usdk: \strong{building or
  checking as root is a bad idea}.  Build as a regular user, and run
\samp{sudo make install} just for the install time \emph{if you need
  privileges to install to the chosen destination}.


\section{Building}
\label{sec:build:req}
\usdk uses qibuild as its buildsystem.

\subsection{Getting and installing qibuild}

The simplest and recommended way if you have python and pip is:

\begin{shell}
$ pip install qibuild
\end{shell}

Otherwise you can build it from sources:

\begin{shell}
$ git clone https://github.com/aldebaran/qibuild
$ cd qibuild
$ python setup.py install # without pip
\end{shell}

\subsection{Setting up an urbi worktree}

\begin{shell}
$ mkdir work
$ cd work
$ qisrc init
$ qisrc add https://github.com/aldebaran/libport.git
$ qisrc add https://github.com/aldebaran/urbi.git
$ qisrc add https://github.com/aldebaran/libjpeg.git
\end{shell}

\subsection{Building}

\begin{shell}
$ qibuild configure urbi
$ qibuild make urbi
\end{shell}

Add \command --release to make a release build.

\subsection{Modifying the grammar or the AST}

The build procedure above will use pregenerated files for the grammar
and the AST files.

If you wish to modify ugrammar.y, utoken.l, or ast.yml, you must enable
grammar/ast processing by passing \command -DHAVE\_CUSTOM\_BISON=On. This currently
requires custom patches into bison that you can find in urbi-sdk 2.7.5 source
tarball.

\subsection{Installing}

\begin{shell}
$ qibuild install urbi <INSTALL\_DIR> # add --release for release build
\end{shell}

\section{Run}
\label{sec:build:run}

You can now run the \command urbi-launch binary, either from the build directory or
the install directory. See \autoref{sec:tools:urbi-launch} for informations
on its command line.

In addition to the ``public'' environment variables
(\autoref{sec:tools:env}), some other, reserved for developers, alter the
behavior of the programs.

\begin{envs}
\item[URBI\_ACCEPT\_BINARY\_MISMATCH] As a safety net, Urbi checks that
  loaded modules were compiled with exactly the same version of Urbi SDK.
  Define this variable to skip this check, at your own risks.

{'fraction_non_alphanumeric': 0.0980599647266314, 'fraction_numerical': 0.00599647266313933, 'mean_word_length': 4.3, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1313026', 'n_tokens_mistral': 1869, 'n_tokens_neox': 1796, 'n_words': 701}