Meson and NInja build system: specify where binaries are stored
Asked Answered
H

1

6

I have a project that needs to be built like this:

  1. ./meson.py build

  2. ./ninja -C build install

This works well. The only thing is: the binaries are stored in (on Linux): /usr/local/bin. This would require me to input root password because the binaries are being written to a root-access folder, aka /usr/local/bin.

Is there a way to install the binaries in some folder in the /user/home directory, so that no passwords are required?

The thing is that everytime I debug and change something, the rebuilding process forces the binaries to be rewritten, which asks for password everytime.

This is what I tried:

  1. Create a folder in home: mkdir ~/projectbin
  2. Use ninja with --prefix option: ./ninja -C --prefix=~/projectbin install

This throws an error of unrecognized option --prefix.

I am new to ninja and meson, please let me know how to resolve this.

Humanist answered 19/6, 2020 at 17:1 Comment(0)
P
16

The way to pass an option to Meson is using the -D option. So to set the prefix, you should use meson -Dprefix=$HOME/projectbin build.

Note that you set this at configure time (ie when calling meson), not at build time (when calling ninja).

Phlogopite answered 20/6, 2020 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.