1# Installation 2 3## Requirements 4 5* meson and a C and C++ compiler 6* optionally libjpeg v6 or later 7* optionally Qt5 for building qv4l2 8 9## Basic installation 10 11v4l-utils can be built and installed using meson as follows: 12 13``` 14meson setup build/ 15ninja -C build/ 16sudo ninja -C build/ install 17``` 18 19## Configuration 20 21You can get a summary of possible configurations running: 22 23``` 24meson configure build/ 25``` 26 27To change the options values use the `-D` option: 28 29``` 30meson configure -Doption=newvalue build/ 31``` 32 33After configuration you need to start the build process with: 34 35``` 36ninja -C build/ 37``` 38 39More info about meson options: 40[https://mesonbuild.com/Build-options.html](https://mesonbuild.com/Build-options.html) 41 42## Installing 43 44If you need to install to a different directory than the install prefix, use 45the `DESTDIR` environment variable: 46 47``` 48DESTDIR=/path/to/staging/area ninja -C build/ install 49``` 50 51## Static builds 52 53Meson provides a built-in option to set the default library type: 54 55``` 56Core options Default Value Possible Values Description 57------------ ------------- --------------- ----------- 58default_library shared [shared, static, both] Default library type 59``` 60 61As previously described, it can be set as follows during the configuration step: 62 63``` 64meson configure -Ddefault_library=static build/ 65``` 66 67Note that this will just build static libraries, but linking to dependencies and 68system libraries dynamically. 69 70*Fully static* builds are not supported yet and would require custom 71configuration and setting proper flags. By the time of this writing, there's an 72ongoing issue in meson to add this feature, see 73https://github.com/mesonbuild/meson/issues/7621 74 75## Cross Compiling 76 77Meson supports cross-compilation by specifying a number of binary paths and 78settings in a file and passing this file to `meson` or `meson configure` with 79the `--cross-file` parameter. 80 81Below are a few example of cross files, but keep in mind that you will likely 82have to alter them for your system. 83 8432-bit build on x86 linux: 85 86``` 87[binaries] 88c = '/usr/bin/gcc' 89cpp = '/usr/bin/g++' 90ar = '/usr/bin/gcc-ar' 91strip = '/usr/bin/strip' 92pkgconfig = '/usr/bin/pkg-config-32' 93llvm-config = '/usr/bin/llvm-config32' 94 95[properties] 96c_args = ['-m32'] 97c_link_args = ['-m32'] 98cpp_args = ['-m32'] 99cpp_link_args = ['-m32'] 100 101[host_machine] 102system = 'linux' 103cpu_family = 'x86' 104cpu = 'i686' 105endian = 'little' 106``` 107 10864-bit build on ARM linux: 109 110``` 111[binaries] 112c = '/usr/bin/aarch64-linux-gnu-gcc' 113cpp = '/usr/bin/aarch64-linux-gnu-g++' 114ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' 115strip = '/usr/bin/aarch64-linux-gnu-strip' 116pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config' 117exe_wrapper = '/usr/bin/qemu-aarch64-static' 118 119[host_machine] 120system = 'linux' 121cpu_family = 'aarch64' 122cpu = 'aarch64' 123endian = 'little' 124``` 125 12664-bit build on x86 windows: 127 128``` 129[binaries] 130c = '/usr/bin/x86_64-w64-mingw32-gcc' 131cpp = '/usr/bin/x86_64-w64-mingw32-g++' 132ar = '/usr/bin/x86_64-w64-mingw32-ar' 133strip = '/usr/bin/x86_64-w64-mingw32-strip' 134pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' 135exe_wrapper = 'wine' 136 137[host_machine] 138system = 'windows' 139cpu_family = 'x86_64' 140cpu = 'i686' 141endian = 'little' 142``` 143