3 Before you can start compiling tinc from a fresh git clone, you have
4 to install the very latest versions of the following packages:
8 - `pkgconf` or `pkg-config`
9 - `GCC` or `Clang` (any version with C11 support, although older versions might work)
10 - `OpenSSL`\* (1.1.0+) or `LibreSSL` or `libgcrypt` (not needed if legacy protocol is disabled)
12 Plus a few optional dependencies. Support for them will be enabled if they're present:
14 - `ncurses` or `PDCurses`
20 If packages marked by `*` are not available, tinc will fall back to its own vendored copies.
21 This behavior can be disabled by setting the appropriate meson option to `disabled`.
23 To build `info` documentation you'll also need these packages:
25 - `texinfo` or `makeinfo`
27 You might also need some additional command-line utilities to be able to run the integration test suite:
34 Please consult your operating system's documentation for more details.
38 You will need to install [msys2][msys2] to build tinc under Windows.
40 [msys2]: https://msys2.org/
42 By default, tinc produces a static Windows build, so you don't need to install anything
43 in order to _run_ the compiled binaries.
49 Have a look at the available configuration options in `meson_options.txt`, or run:
53 The project can be built as any other meson project:
55 $ meson setup build -Dprefix=/usr/local -Dbuildtype=release
57 This creates a build directory (named `build`) with build type set to `release`
58 (which enables compiler optimizations) and path prefix set to `/usr/local`.
60 Pass any additional options in the same way. Typically, this is not needed: tinc will
61 autodetect available libraries and adjust its functionality accordingly.
63 If you'd like to reconfigure the project after running `setup`, you can either remove
64 the build directory and start anew, or use:
66 $ meson configure build -Dlzo=disabled -Dlz4=enabled
68 You then need to build the project:
72 You might want to run the test suite to ensure tinc is working correctly:
76 To install tinc to your system, run:
78 # ninja -C build install
80 Please be aware that this is not the best method of installing software
81 because it will not be tracked by your operating system's package manager. You
82 should use packages provided by your operating system, or build your own
83 (this is a large and complicated topic which is out of the scope of this document).
85 To uninstall tinc, run:
87 # ninja -C build uninstall
93 Cross-compilation is easy to do on Debian or its derivatives.
94 Set `$HOST` to your target architecture and install the cross-compilation toolchain and `-dev` versions of all libraries you'd like to link:
97 $ dpkg --add-architecture $HOST
99 $ apt install -y crossbuild-essential-$HOST zlib1g-dev:$HOST …
101 If you'd like to run tests on emulated hardware, install `qemu-user`:
103 $ apt install -y qemu-user
104 $ update-binfmts --enable
106 Set two environment variables: the C compiler, and pkg-config, and then proceed as usual:
108 $ export CC=arm-linux-gnueabihf-gcc
109 $ export PKG_CONFIG=arm-linux-gnueabihf-pkg-config
110 $ meson setup build --cross-file /dev/null
112 or put the names into a [cross file][cross] and pass it to meson:
114 $ cat >cross-armhf <<EOF
116 c = 'arm-linux-gnueabihf-gcc'
117 pkgconfig = 'arm-linux-gnueabihf-pkg-config'
120 $ meson setup build --cross-file cross-armhf
122 [cross]: https://mesonbuild.com/Cross-compilation.html
126 Install cross-compilation toolchain:
128 $ apt install -y mingw-w64 mingw-w64-tools
130 tinc will use its own vendored libraries, so you don't need to install or build anything manually.
132 Prepare the [cross file][cross] to let meson know you're building binaries for a different opearting system.
133 Take a look at the [file](.ci/cross/windows/amd64) used by CI for an example, or refer to examples provided
134 by the meson project: [x86][mingw32], [x86_64][mingw64].
136 Then build as usual. Because Windows binaries are built with static linkage by default,
137 you might want to enable link-time optimization. It is much slower than building without LTO,
138 but produces binaries that are 80%+ smaller:
140 $ meson setup build -Dbuildtype=release -Db_lto=true --cross-file cross-windows
143 [mingw64]: https://github.com/mesonbuild/meson/blob/master/cross/linux-mingw-w64-64bit.txt
144 [mingw32]: https://github.com/mesonbuild/meson/blob/master/cross/linux-mingw-w64-32bit.txt
148 First you need to install [Android NDK][ndk].
150 [ndk]: https://developer.android.com/studio/projects/install-ndk
152 Prepare a [cross file][cross]. Here's a working example for reference:
162 c = 'aarch64-linux-android24-clang'
167 $ export ANDROID_NDK_ROOT=/tmp/ndk/android-ndk-r24
168 $ export PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
169 $ meson setup android-aarch64 -Dcrypto=nolegacy --cross-file android
170 $ ninja -C android-aarch64
174 The same instructions should work for iOS.
175 Refer to this [cross file][ios] for an example.
177 [ios]: https://github.com/mesonbuild/meson/blob/master/cross/iphone.txt