From 4f09c3ca6d7ee2645d1b107ad5b7a4e3907cbf11 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Aug 2022 12:25:48 -0400 Subject: Update installation instructions for meson --- INSTALL.md | 95 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 623cddd..15c39f4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,59 +1,76 @@ Installation Instructions ========================= -Basic Installation ------------------- +Prerequisites +------------- -Building this software requires only Python. To install with default options: +To build from source, you will need: - ./waf configure - ./waf - ./waf install + * A relatively modern C and C++ compiler (GCC, Clang, and MSVC are known to work). -You may need to become root for the install stage, for example: + * [Meson](http://mesonbuild.com/), which depends on + [Python](http://python.org/). - sudo ./waf install +This is a brief overview of building this project with meson. See the meson +documentation for more detailed information. -Configuration Options ---------------------- +Configuration +------------- -All supported options can be viewed using the command: +The build is configured with the `setup` command, which creates a new build +directory with the given name: - ./waf --help + meson setup build -Most options only need to be passed during the configure stage, for example: +Some environment variables are read during `setup` and stored with the +configuration: - ./waf configure --prefix=/usr - ./waf - ./waf install + * `CC`: Path to C compiler. + * `CFLAGS`: C compiler options. + * `CXX`: Path to C++ compiler. + * `CXXFLAGS`: C++ compiler options. + * `LDFLAGS`: Linker options. -Compiler Configuration ----------------------- +However, it is better to use meson options for configuration. All options can +be inspected with the `configure` command from within the build directory: -Several standard environment variables can be used to control how compilers are -invoked: + cd build + meson configure - * CC: Path to C compiler - * CFLAGS: C compiler options - * CXX: Path to C++ compiler - * CXXFLAGS: C++ compiler options - * CPPFLAGS: C preprocessor options - * LINKFLAGS: Linker options +Options can be set by passing C-style "define" options to `configure`: -Installation Directories ------------------------- + meson configure -Dc_args="-march=native" -Dprefix="/opt/mypackage/" -The --prefix option (or the PREFIX environment variable) can be used to change -the prefix which all files are installed under. There are also several options -allowing for more fine-tuned control, see the --help output for details. +Note that some options, such as `strict` and `werror` are for +developer/maintainer use only. Please don't file issues about anything that +happens when they are enabled. -Packaging ---------- +Building +-------- -Everything can be installed to a specific root directory by passing a --destdir -option to the install stage (or setting the DESTDIR environment variable), -which adds a prefix to all install paths. For example: +From within a configured build directory, everything can be built with the +`compile` command: - ./waf configure --prefix=/usr - ./waf - ./waf install --destdir=/tmp/package + meson compile + +Similarly, tests can be run with the `test` command: + + meson test + +Meson can also generate a project for several popular IDEs, see the `backend` +option for details. + +Installation +------------ + +A compiled project can be installed with the `install` command: + + meson install + +You may need to acquire root permissions to install to a system-wide prefix. +For packaging, the installation may be staged to a directory using the +`DESTDIR` environment variable or the `--destdir` option: + + DESTDIR=/tmp/mypackage/ meson install + + meson install --destdir=/tmp/mypackage/ -- cgit v1.2.1