[5069da3] | 1 | .. _requirements: |
---|
| 2 | |
---|
[e15d7d0] | 3 | Build options |
---|
| 4 | ============= |
---|
| 5 | |
---|
| 6 | If built without any external dependencies aubio can be somewhat useful, for |
---|
| 7 | instance to read, process, and write simple wav files. |
---|
| 8 | |
---|
[8f1b354] | 9 | To support more media input formats and add more features to aubio, you can use |
---|
| 10 | one or all of the following `external libraries`_. |
---|
[e15d7d0] | 11 | |
---|
| 12 | You may also want to know more about the `other options`_ and the `platform |
---|
| 13 | notes`_ |
---|
| 14 | |
---|
| 15 | The configure script will automatically for these extra libraries. To make sure |
---|
| 16 | the library or feature is used, pass the `--enable-flag` to waf. To disable |
---|
| 17 | this feature, use `--disable-feature`. |
---|
| 18 | |
---|
| 19 | To find out more about the build commands, use the `--verbose` option. |
---|
[5069da3] | 20 | |
---|
[e15d7d0] | 21 | External libraries |
---|
| 22 | ------------------ |
---|
| 23 | |
---|
| 24 | External libraries are checked for using ``pkg-config``. Set the |
---|
| 25 | ``PKG_CONFIG_PATH`` environment variable if you have them installed in an |
---|
| 26 | unusual location. |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | .. note:: |
---|
| 30 | |
---|
| 31 | If ``pkg-config`` is not found in ``PATH``, the configure step will |
---|
| 32 | succeed, but none of the external libraries will be used. |
---|
| 33 | |
---|
[9aac2b5] | 34 | To build aubio with no external libraries, use the ``--nodeps`` build option. |
---|
| 35 | |
---|
[b45af44] | 36 | Media libraries |
---|
| 37 | --------------- |
---|
| 38 | |
---|
[e15d7d0] | 39 | libav |
---|
| 40 | ..... |
---|
| 41 | |
---|
| 42 | `libav.org <https://libav.org/>`_, open source audio and video processing |
---|
| 43 | tools. |
---|
| 44 | |
---|
| 45 | If all of the following libraries are found, they will be used to compile |
---|
| 46 | ``aubio_source_avcodec``. so that ``aubio_source`` will be able to decode audio |
---|
| 47 | from all formats supported by `libav |
---|
| 48 | <https://libav.org/documentation/general.html#Audio-Codecs>`_. |
---|
| 49 | |
---|
| 50 | * libavcodec |
---|
| 51 | * libavformat |
---|
| 52 | * libavutil |
---|
| 53 | * libavresample |
---|
| 54 | |
---|
| 55 | To enable this option, configure with ``--enable-avcodec``. The build will then |
---|
| 56 | failed if the required libraries are not found. To disable this option, |
---|
| 57 | configure with ``--disable-avcodec`` |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | libsndfile |
---|
| 61 | .......... |
---|
| 62 | |
---|
| 63 | `libsndfile <http://www.mega-nerd.com/libsndfile/>`_, a C library for reading |
---|
| 64 | and writing sampled sound files. |
---|
| 65 | |
---|
| 66 | With libsndfile built in, ``aubio_source_sndfile`` will be built in and used by |
---|
| 67 | ``aubio_source``. |
---|
| 68 | |
---|
| 69 | To enable this option, configure with ``--enable-sndfile``. The build will then |
---|
| 70 | fail if the required library is not found. To disable this option, configure |
---|
| 71 | with ``--disable-sndfile`` |
---|
| 72 | |
---|
| 73 | libsamplerate |
---|
| 74 | ............. |
---|
| 75 | |
---|
| 76 | `libsamplerate <http://www.mega-nerd.com/SRC/>`_, a sample rate converter for |
---|
| 77 | audio. |
---|
| 78 | |
---|
| 79 | With libsamplerate built in, ``aubio_source_sndfile`` will support resampling, |
---|
| 80 | and ``aubio_resample`` will be fully functional. |
---|
| 81 | |
---|
| 82 | To enable this option, configure with ``--enable-samplerate``. The build will |
---|
| 83 | then fail if the required library is not found. To disable this option, |
---|
| 84 | configure with ``--disable-samplerate`` |
---|
| 85 | |
---|
[b45af44] | 86 | Optimisation libraries |
---|
| 87 | ---------------------- |
---|
| 88 | |
---|
[e15d7d0] | 89 | libfftw3 |
---|
| 90 | ........ |
---|
| 91 | |
---|
| 92 | `FFTW <http://fftw.org/>`_, a C subroutine for computing the discrete Fourier |
---|
| 93 | transform |
---|
| 94 | |
---|
| 95 | With libfftw3 built in, ``aubio_fft`` will use `FFTW`_ to |
---|
| 96 | compute Fast Fourier Transform (FFT), allowing aubio to compute FFT on length |
---|
| 97 | that are not a power of 2. |
---|
| 98 | |
---|
| 99 | To enable this option, configure with ``--enable-fftw3``. The build will |
---|
| 100 | then fail if the required library is not found. To disable this option, |
---|
| 101 | configure with ``--disable-fftw3`` |
---|
[5069da3] | 102 | |
---|
[46b065d1] | 103 | blas |
---|
| 104 | .... |
---|
| 105 | |
---|
| 106 | On macOs/iOS, `blas |
---|
| 107 | <https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms>`_ are made |
---|
| 108 | available through the Accelerate framework. |
---|
| 109 | |
---|
| 110 | On Linux, they can be enabled with ``--enable-blas``. On Debian (etch), |
---|
| 111 | `atlas`_, `openblas`_, and `libblas`_ have been successfully tested. |
---|
| 112 | |
---|
| 113 | When enabled, ``waf`` will check for the current blas configuration by running |
---|
| 114 | ``pkg-config --libs blas``. Depending of the library path returned by |
---|
| 115 | ``pkg-config``, different headers will be searched for. |
---|
| 116 | |
---|
| 117 | .. note:: |
---|
| 118 | |
---|
| 119 | On Debian systems, `multiple versions of BLAS and LAPACK |
---|
| 120 | <https://wiki.debian.org/DebianScience/LinearAlgebraLibraries>`_ can be |
---|
| 121 | installed. To configure which libblas is being used: |
---|
| 122 | |
---|
| 123 | .. code-block:: console |
---|
| 124 | |
---|
| 125 | $ sudo update-alternatives --config libblas.so |
---|
| 126 | |
---|
| 127 | .. |
---|
| 128 | Expected pkg-config output for each alternative: |
---|
| 129 | /usr/lib/atlas-base/atlas/libblas.so |
---|
| 130 | -L/usr/lib/atlas-base/atlas -lblas |
---|
| 131 | /usr/lib/openblas-base/libblas.so |
---|
| 132 | -L/usr/lib/openblas-base -lblas |
---|
| 133 | /usr/lib/libblas/libblas.so |
---|
| 134 | -lblas |
---|
| 135 | |
---|
| 136 | atlas |
---|
| 137 | ..... |
---|
| 138 | |
---|
| 139 | `ATLAS BLAS APIs <http://math-atlas.sourceforge.net/>`_ will be used the path |
---|
| 140 | returned by ``pkg-config --libs blas`` contains ``atlas``. |
---|
| 141 | |
---|
| 142 | .. |
---|
| 143 | ``<atlas/cblas.h>`` will be included. |
---|
| 144 | |
---|
| 145 | Example: |
---|
| 146 | |
---|
| 147 | .. code-block:: console |
---|
| 148 | |
---|
| 149 | $ pkg-config --libs blas |
---|
| 150 | -L/usr/lib/atlas-base/atlas -lblas |
---|
| 151 | $ ./waf configure --enable-atlas |
---|
| 152 | [...] |
---|
| 153 | Checking for 'blas' : yes |
---|
| 154 | Checking for header atlas/cblas.h : yes |
---|
| 155 | |
---|
| 156 | openblas |
---|
| 157 | ........ |
---|
| 158 | |
---|
| 159 | `OpenBlas libraries <https://www.openblas.net/>`_ will be used when the output |
---|
| 160 | of ``pkg-config --libs blas`` contains 'openblas', |
---|
| 161 | |
---|
| 162 | .. |
---|
| 163 | ``<openblas/cblas.h>`` will be included. |
---|
| 164 | |
---|
| 165 | Example: |
---|
| 166 | |
---|
| 167 | .. code-block:: console |
---|
| 168 | |
---|
| 169 | $ pkg-config --libs blas |
---|
| 170 | -L/usr/lib/openblas-base -lblas |
---|
| 171 | $ ./waf configure --enable-atlas |
---|
| 172 | [...] |
---|
| 173 | Checking for 'blas' : yes |
---|
| 174 | Checking for header openblas/cblas.h : yes |
---|
| 175 | |
---|
| 176 | libblas |
---|
| 177 | ....... |
---|
| 178 | |
---|
| 179 | `Netlib's libblas (LAPACK) <https://www.netlib.org/lapack/>`_ will be used if |
---|
| 180 | no specific library path is specified by ``pkg-config`` |
---|
| 181 | |
---|
| 182 | .. |
---|
| 183 | ``<cblas.h>`` will be included. |
---|
| 184 | |
---|
| 185 | Example: |
---|
| 186 | |
---|
| 187 | .. code-block:: console |
---|
| 188 | |
---|
| 189 | $ pkg-config --libs blas |
---|
| 190 | -lblas |
---|
| 191 | $ ./waf configure --enable-atlas |
---|
| 192 | [...] |
---|
| 193 | Checking for 'blas' : yes |
---|
| 194 | Checking for header cblas.h : yes |
---|
| 195 | |
---|
| 196 | |
---|
[5069da3] | 197 | Platform notes |
---|
| 198 | -------------- |
---|
| 199 | |
---|
[a9a1e79] | 200 | On all platforms, you will need to have installed: |
---|
| 201 | |
---|
| 202 | - a compiler (gcc, clang, msvc, ...) |
---|
| 203 | - python (any version >= 2.7, including 3.x) |
---|
| 204 | - a terminal to run command lines in |
---|
| 205 | |
---|
[5069da3] | 206 | Linux |
---|
| 207 | ..... |
---|
| 208 | |
---|
| 209 | The following `External libraries`_ will be used if found: `libav`_, |
---|
| 210 | `libsamplerate`_, `libsndfile`_, `libfftw3`_. |
---|
| 211 | |
---|
| 212 | macOS |
---|
| 213 | ..... |
---|
| 214 | |
---|
| 215 | The following system frameworks will be used on Mac OS X systems: |
---|
| 216 | |
---|
| 217 | - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute |
---|
| 218 | FFTs and other vectorized operations optimally. |
---|
| 219 | |
---|
| 220 | - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and |
---|
| 221 | `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to |
---|
| 222 | decode audio from files and network streams. |
---|
| 223 | |
---|
| 224 | .. note:: |
---|
| 225 | |
---|
| 226 | To build a fat binary for both ``i386`` and ``x86_64``, use ``./waf configure |
---|
| 227 | --enable-fat``. |
---|
| 228 | |
---|
| 229 | The following `External libraries`_ will also be checked: `libav`_, |
---|
| 230 | `libsamplerate`_, `libsndfile`_, `libfftw3`_. |
---|
| 231 | |
---|
[e15d7d0] | 232 | To build a fat binary on a darwin like system (macOS, tvOS, appleOS, ...) |
---|
| 233 | platforms, configure with ``--enable-fat``. |
---|
| 234 | |
---|
[5069da3] | 235 | Windows |
---|
| 236 | ....... |
---|
| 237 | |
---|
[7b3668c] | 238 | To use a specific version of the compiler, ``--msvc_version``. To build for a |
---|
| 239 | specific architecture, use ``--msvc_target``. For instance, to build aubio |
---|
| 240 | for ``x86`` using ``msvc 12.0``, use: |
---|
| 241 | |
---|
| 242 | .. code:: bash |
---|
| 243 | |
---|
| 244 | waf configure --msvc_version='msvc 12.0' --msvc_target='x86' |
---|
| 245 | |
---|
| 246 | |
---|
[5069da3] | 247 | The following `External libraries`_ will be used if found: `libav`_, |
---|
| 248 | `libsamplerate`_, `libsndfile`_, `libfftw3`_. |
---|
| 249 | |
---|
| 250 | iOS |
---|
| 251 | ... |
---|
| 252 | |
---|
| 253 | The following system frameworks will be used on iOS and iOS Simulator. |
---|
| 254 | |
---|
| 255 | - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute |
---|
| 256 | FFTs and other vectorized operations optimally. |
---|
| 257 | |
---|
| 258 | - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and |
---|
| 259 | `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to |
---|
| 260 | decode audio from files and network streams. |
---|
| 261 | |
---|
| 262 | To build aubio for iOS, configure with ``--with-target-platform=ios``. For the |
---|
| 263 | iOS Simulator, use ``--with-target-platform=iosimulator`` instead. |
---|
| 264 | |
---|
| 265 | By default, aubio is built with the following flags on iOS: |
---|
| 266 | |
---|
| 267 | .. code:: bash |
---|
| 268 | |
---|
| 269 | CFLAGS="-fembed-bitcode -arch arm64 -arch armv7 -arch armv7s -miphoneos-version-min=6.1" |
---|
| 270 | |
---|
| 271 | and on iOS Simulator: |
---|
| 272 | |
---|
| 273 | .. code:: |
---|
| 274 | |
---|
[6f29fe3] | 275 | CFLAGS="-arch i386 -arch x86_64 -mios-simulator-version-min=6.1" |
---|
[5069da3] | 276 | |
---|
| 277 | Set ``CFLAGS`` and ``LINKFLAGS`` to change these default values, or edit |
---|
| 278 | ``wscript`` directly. |
---|
| 279 | |
---|
[e15d7d0] | 280 | Other options |
---|
[5069da3] | 281 | ------------- |
---|
| 282 | |
---|
[a9a1e79] | 283 | Some additional options can be passed to the configure step. For the complete |
---|
| 284 | list of options, run: |
---|
| 285 | |
---|
[385a9c1e] | 286 | .. code:: bash |
---|
| 287 | |
---|
[e15d7d0] | 288 | $ ./waf --help |
---|
| 289 | |
---|
| 290 | Here is an example of a custom command: |
---|
| 291 | |
---|
| 292 | .. code:: bash |
---|
| 293 | |
---|
| 294 | $ ./waf --verbose configure build install \ |
---|
| 295 | --enable-avcodec --enable-wavread --disable-wavwrite \ |
---|
| 296 | --enable-sndfile --enable-samplerate --enable-docs \ |
---|
| 297 | --destdir $PWD/build/destdir --testcmd="echo %s" \ |
---|
| 298 | --prefix=/opt --libdir=/opt/lib/multiarch \ |
---|
| 299 | --manpagesdir=/opt/share/man \ |
---|
| 300 | uninstall clean distclean dist distcheck |
---|
[5069da3] | 301 | |
---|
[6d4802f] | 302 | .. _doubleprecision: |
---|
| 303 | |
---|
[5069da3] | 304 | Double precision |
---|
| 305 | ................ |
---|
| 306 | |
---|
[8924bdf] | 307 | The datatype used to store real numbers in aubio is named `smpl_t`. By default, |
---|
| 308 | `smpl_t` is defined as `float`, a `single-precision format |
---|
| 309 | <https://en.wikipedia.org/wiki/Single-precision_floating-point_format>`_ |
---|
| 310 | (32-bit). Some algorithms require a floating point representation with a |
---|
| 311 | higher precision, for instance to prevent arithmetic underflow in recursive |
---|
| 312 | filters. In aubio, these special samples are named `lsmp_t` and defined as |
---|
| 313 | `double` by default (64-bit). |
---|
| 314 | |
---|
| 315 | Sometimes it may be useful to compile aubio in `double-precision`, for instance |
---|
| 316 | to reproduce numerical results obtained with 64-bit routines. In this case, |
---|
| 317 | `smpl_t` will be defined as `double`. |
---|
| 318 | |
---|
| 319 | The following table shows how `smpl_t` and `lsmp_t` are defined in single- and |
---|
| 320 | double-precision modes: |
---|
| 321 | |
---|
| 322 | .. list-table:: Single and double-precision modes |
---|
| 323 | :align: center |
---|
| 324 | |
---|
| 325 | * - |
---|
| 326 | - single |
---|
| 327 | - double |
---|
| 328 | * - `smpl_t` |
---|
| 329 | - ``float`` |
---|
| 330 | - ``double`` |
---|
| 331 | * - `lsmp_t` |
---|
| 332 | - ``double`` |
---|
| 333 | - ``long double`` |
---|
| 334 | |
---|
[5069da3] | 335 | To compile aubio in double precision mode, configure with ``--enable-double``. |
---|
| 336 | |
---|
[8924bdf] | 337 | To compile in single-precision mode (default), use ``--disable-double`` (or |
---|
| 338 | simply none of these two options). |
---|
[5069da3] | 339 | |
---|
[9682d9d] | 340 | Disabling the tests |
---|
| 341 | ................... |
---|
| 342 | |
---|
| 343 | In some case, for instance when cross-compiling, unit tests should not be run. |
---|
| 344 | Option ``--notests`` can be used for this purpose. The tests will not be |
---|
| 345 | executed, but the binaries will be compiled, ensuring that linking against |
---|
| 346 | libaubio works as expected. |
---|
| 347 | |
---|
| 348 | .. note:: |
---|
| 349 | |
---|
| 350 | The ``--notests`` option should be passed to both ``build`` and ``install`` |
---|
| 351 | targets, otherwise waf will try to run them. |
---|
| 352 | |
---|
[e15d7d0] | 353 | Edit wscript |
---|
| 354 | ............ |
---|
[5069da3] | 355 | |
---|
[e15d7d0] | 356 | Many of the options are gathered in the file `wscript`. a good starting point |
---|
| 357 | when looking for additional options. |
---|
[5069da3] | 358 | |
---|
[e15d7d0] | 359 | .. _build_docs: |
---|
[5069da3] | 360 | |
---|
[e15d7d0] | 361 | Building the docs |
---|
| 362 | ----------------- |
---|
[5069da3] | 363 | |
---|
[e15d7d0] | 364 | If the following command line tools are found, the documentation will be built |
---|
| 365 | built: |
---|
[5069da3] | 366 | |
---|
[7a8a07e] | 367 | - `doxygen <http://doxygen.org>`_ to build the :ref:`doxygen-documentation`. |
---|
[5069da3] | 368 | - `txt2man <https://github.com/mvertes/txt2man>`_ to build the :ref:`manpages` |
---|
[e15d7d0] | 369 | - `sphinx <http://sphinx-doc.org>`_ to build this document |
---|
[5069da3] | 370 | |
---|
| 371 | These tools are searched for in the current ``PATH`` environment variable. |
---|
| 372 | By default, the documentation is built only if the tools are found. |
---|
| 373 | |
---|
| 374 | To disable the documentation, configure with ``--disable-docs``. To build with |
---|
| 375 | the documentation, configure with ``--enable-docs``. |
---|