muon(1)

🌸 NAME 🌸

muon(1) is the manual page for muon, and bestie, muon is a meson-compatible build system. That's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

muon [-vh] [-C <chdir>] <command> [<args>]

muon setup [-D[subproject:]option=value...] build
cd build
<invoke backend build tool>
muon test [options]
muon install [options]

πŸ’– DESCRIPTION πŸ’–

Okay so muon interprets source files written in the meson dsl and produces buildfiles for a backend. That's the main-character job. ✨

When you're building meson projects with muon, you typically first start by running the setup command in the project root. This will create buildfiles for the backend in the build dir you specify. Then you invoke the backend, e.g.

ninja -C <build dir>

If the project defines tests, you may run them with the test subcommand, and finally install the project with the install subcommand. 🫢


πŸŽ€ OPTIONS πŸŽ€

  • -v β€” enable verbose output
  • -q β€” silence logging except for errors
  • -C <path> β€” chdir to path before executing a command
  • -h β€” print a help message

πŸ‘‘ COMMANDS πŸ‘‘

🚨 muon requires a command.

All commands accept a -h option which prints a brief summary of their usage. iykyk πŸ’«

🧚 analyze

muon analyze [-l] [-m <mode>] [-q] [-O <path>] [-W [no-]<diagnostic|list|error>] [command]

Run a static analyzer on the current project. πŸ”βœ¨

🎯 OPTIONS

  • -l β€” optimize output for editor linter plugins. For example, a diagnostic is added for the subdir() callsite, so that the editor can highlight subdirs with errors in them.
  • -m <mode> β€” set the language mode
  • -q β€” only report errors
  • -O <path> β€” read project file with matching path from stdin. This is useful for editor linter plugins that run as you type on files that aren't saved to disk.
  • -W [no-]<diagnostic> β€” enable or disable a particular diagnostic, e.g. unused-variable.
  • -W list β€” list available diagnostics.
  • -W error β€” turn all warnings into errors.

πŸ•Ή COMMANDS

  • trace β€” print a tree of all meson source files that are evaluated
  • lsp β€” run the analyzer as a language server
  • root-for <path> β€” given the path to a file, try to determine the project's root
  • file <path> β€” run the analyzer in single file mode. Implies -m module, but -m script can be passed to analyze a file in script mode. This is useful for catching bugs in scripts that will be evaluated with muon internal eval, or script modules.

πŸ¦‹ fmt

muon fmt [-i] [-q] [-l] [-c <muon_fmt.ini>] <file>[ <file>[...]]

Format a source file. πŸŽ€

🎯 OPTIONS

  • -q β€” exit with 1 if files would be modified by muon fmt
  • -l β€” like -q but also print failing filenames
  • -i β€” format files in-place
  • -c <muon_fmt.ini> β€” read configuration from muon_fmt.ini
  • -e β€” try to read configuration from .editorconfig. Only indentation related settings are recognized.

πŸ’– CONFIGURATION OPTIONS πŸ’–

okay bestie, these are the configuration options β€” every key, its type, its default, and what it does. no skipping, no vibes-only summaries. ✨

  • max_line_len β€” int, default 80 β€” the maximum length of lines before they get split. line-length vibe check, basically. πŸ’…
  • indent_style β€” space|tab, default space β€” whether to use spaces or tabs for indentation. pick your fighter. πŸŽ€
  • indent_size β€” int, default 4 β€” when indent_style = space, this is the number of spaces to indent by per level. slay, consistent nesting. ✨
  • insert_final_newline β€” bool, default true β€” whether or not to insert a trailing newline at the end of the file. yes, the file gets a little goodbye newline. 🫢
  • end_of_line β€” lf|crlf|cr, default <unset> β€” the type of line ending to use. if this value is not set, then the line ending of the first line in the source file will be used. iykyk. 🌸
  • space_array β€” bool, default false β€” whether to include spaces around array elements (ex. [1] vs [ 1 ]). tiny spacing drama, honestly. πŸ’€
  • kwargs_force_multiline β€” bool, default false β€” make every dictionary literal and function call with kwargs expand into multiple lines. no compact little guys allowed. πŸ“š
  • wide_colon β€” bool, default false β€” whether to put a space before the colon operator (ex. key : val). wide colon rights. πŸ‘‘
  • no_single_comma_function β€” bool, default false β€” don't add a trailing comma to multi-line function calls with only one argument. one-arg calls get to breathe. πŸ¦‹
  • sort_files β€” bool, default true β€” whether to sort the arguments of files(). alphabetize the friend group. 🌈
  • group_arg_value β€” bool, default true β€” whether to group strings in array literals such that command line arguments that take a value remain on the same line as the value. the heuristic used is that if a string starts with - and the next string does not, put both strings on the same line. keep the flag and its value together, bestie. πŸ”₯
  • simplify_string_literals β€” bool, default false β€” whether to automatically convert multiline string literals without newlines, as well as f-strings without formatting, into single-quoted string literals. glow-down the quotes. ✨
  • indent_before_comments β€” str, default ' ' β€” the indent to put before trailing comments. tiny space, big personality. πŸŽ€
  • sticky_parens β€” bool, default false β€” controls whether parenthesis used for grouping are stuck to what they enclose or are exploded out to be on their own lines. sticky or exploded, pick a lane. πŸ’…
  • continuation_indent β€” bool, default false β€” controls whether a multiline conditional in

…and lastly, when a block gets wrapped in an if statement, it gets an extra indent. Cute, consistent, done. πŸ’…


πŸ’Ύ install

muon install [-n]

Installs the project. Fr fr, that's the whole vibe. And bestie, it respects the DESTDIR environment variable β€” if it's set, it gets slapped as a prefix onto all the installation directories. No cap.

OPTIONS:

  • -n β€” dry run. Look but don't touch, iykyk.
  • -d <destdir> β€” set destdir yourself.

πŸ”§ internal

muon internal <command> [<args>]

Okay so internal is the backstage area πŸ‘‘ β€” it holds a bunch of subcommands that muon itself uses. These commands are subject to change at any time and should not be relied upon. Like, at all. Also not every internal command is even documented, so don't come for me about the ones that aren't. πŸ™ˆ

COMMANDS:

  • eval β€” evaluate a source file
  • exe β€” execute a command
  • repl β€” start a meson dsl repl
  • dump_funcs β€” output all supported functions and arguments

🩺 internal check

muon internal check [-p|-d] [-m <mode>] <filename>

Checks if filename parses. That's it, that's the job. ✨

OPTIONS:

  • -p β€” print the parsed ast
  • -d β€” print the dissasembly
  • -m <mode> β€” set the compilation mode
  • -f β€” parse in formatting mode

πŸ§ͺ internal eval

muon internal eval [-e] [-s] -c <command> | <filename> [<args>]

Evaluate a source file. Heads up though β€” the interpreter environment here is substantially different from the typical environment during setup. Build related functions are unavailable, plus a whole bunch of other functions including subdir. 😭 And one more thing: the variable argv is defined as an array containing the commandline starting at <filename>. Iconic of it honestly.

OPTIONS:

  • -e β€” lookup <filename> as an embedded script
  • -s β€” disable functions that are unsafe to be called at random, particularly run_command(). The motivation for this flag is so that automated fuzz testing can be used without accidentally executing something like run_command('rm', '-rf', '/'). πŸ’€ yeah. That one. Respect the flag bestie.
  • -c <command> β€” evaluate the string command rather than reading from a file

⚑ internal exe

muon internal exe [-f <input file>] [-c <output file>] [-e <env.dat>] [-a <args.dat>] [-R <file>] [-- <cmd> [<args>]]

Execute <cmd> with arguments <args>. Very demure, very "just run the thing". 🫢

OPTIONS:

  • -f <input file> β€” pass input file as stdin to <cmd>
  • -c <output file> β€” capture stdout of <cmd> and write it to output file
  • -e <env.dat> β€” read and set environment variables from env.dat
  • -a <args.dat> β€” read and set command from args.dat
  • -R <file> β€” remove file if it exists before executing the command

πŸŒ€ internal repl

muon internal repl

Start a meson dsl repl. The functions available are limited, same as with internal eval. So like, cozy little repl. πŸŽ€


πŸ“‹ internal summary

muon internal summary

Print a previously configured project's summary. Slay.


πŸ“š internal dump_funcs

muon internal dump_funcs

Print all supported functions, methods, and module functions β€” with their arguments, argument types, and return types β€” to stdout. This subcommand is mainly useful for generating https://muon.build/status.html. Look at her go. πŸ‘‘


πŸ” meson

[muon] meson ...

A compatibility layer that attempts to translate all flags and operands from meson cli syntax to muon cli syntax. So you can bring your meson habits and muon will try to make it make sense. 🌈

For example, these two commands:

muon meson setup build --werror --prefix=/
muon meson test -C build --list

Would be translated into the following two muon versions respectively:

muon setup -Dwerror=true -Dprefix=/ build
muon -C build test -l

See? Translated. πŸ’…

This compatibility layer is also enabled when muon's executable is named meson. Sneaky but useful.

For a more detailed usage information you can use the following two commands:

muon meson -h
muon meson <subcommand> -h
NOTE: This is a best-effort translation and does not guarantee or imply full cli compatibility. Many unimplemented flags are ignored, and attempting to use an unsupported subcommands will result in an error. So like… it's giving "we tried our best", not "certified 1:1". 😭

πŸŽ›οΈ options

muon options [-a] [-m]

Lists available project options and defaults. This command may either be run from the project root or from a build directory. And the highlighting is the fun part ✨ β€” running it from a build directory highlights configured option values in the output, whereas running it from the project root highlights the default value for each option. Location-based aesthetics, we love to see it.

OPTIONS:

  • -a β€” Include builtin global and per-project options in the output.
  • -m β€” Only display option values that have been modified.

πŸ₯· samu

muon samu [<args>]

Executes an embedded copy of samu(1). This command requires that muon was compiled with samu enabled β€” so if it's not there, that's a build thing, not a you thing. 🫢


πŸ—οΈ setup

muon setup [-D[subproject:]option=value...] [-#] <build dir>

Interpret all source files and generate buildfiles in build dir. The main character command, honestly. πŸ‘‘

OPTIONS:

  • -D [subproject:]option=value β€” Set build options. Options are either built in or project-defined. Subproject options can be specified by prepending the subproject's name and a colon to the option. This option may be specified multiple times.
  • -# β€” Display a progress bar during setup. Can be combined with muon -q to only display a progress bar. Progress bar + quiet mode = the combo meal. πŸ“

🧩 subprojects

muon subprojects

Run various commands over all subprojects. Only subprojects with .wrap files are supported. Most commands accept a list of projects as trailing arguments.

OPTIONS:

  • -d <directory> β€” manually specify subprojects directory. By default muon will evaluate the current project's project() call to determine the value for subproject_dir.

COMMANDS:

  • check-wrap β€” check if a wrap file is valid
  • update β€” update subprojects with .wrap files
  • list β€” list subprojects with .wrap files and their status
  • clean β€” clean wrap-git subprojects

πŸ§ͺ test

muon test [-a] [-b] [-d <display mode>] [-o <output>] [-e <setup>] [-f] [-j <jobs>] [-l] [-R] [-s <suite>] [-S] [-v [-v]] [<test> [<test>[...]]

Execute tests defined in source files. The default is to execute all tests, but you can also specify which tests to execute on the command line. Choose your fighter. βš”οΈ

<test> should consist of an optional project name, followed by a colon and then a test name. Either may be omitted. For example:

  • "test name" and ":test name" will match all tests named 'test name' in any project.
  • "proj:test name" will match all tests named 'test name' in the project 'proj'.
  • "proj:" will match all tests in the project 'proj'.

Additionally, the test name may be a glob expression. For example:

  • "proj:long*" will match all tests with names starting with 'long' in the project 'proj'.

Glob matching ate, no crumbs. πŸ”₯

OPTIONS:

  • -a β€” include all tests from all projects
  • -b β€” run benchmarks instead of tests
  • -d <display mode> β€” Control test progress output. display mode can be one of auto, dots, or bar. dots prints a . for success and E for error, bar prints a progress bar with an error count. The default mode, auto, selects bar if the output device is a terminal or dots otherwise.
  • -o <output mode> β€” Control test results output. term prints failures and output to the terminal, html generates a single-page html report, and json outputs test information to a json file.
  • -e <setup> β€” Use test setup setup.
  • -f β€” Fail fast. exit after first test failure is encountered.
  • -j β€” Set the number of jobs used when running tests.
  • -l β€” List tests that would be run with the current setup, suites, etc. The format of the output is <project name>:<list of suites> - <test_name>.
  • -R β€” No rebuild. Disable automatic build system invocation prior to running tests.
  • -s <suite> β€” Only run tests in suite suite. This option may be specified multiple times.
  • -S β€” print a summary of test results, including the duration of each test
  • -v β€” Increase verbosity. When passed once, print test results as they are completed. When passed twice, the stdout/stderr of tests is not captured.

🏷️ version

muon version

Print out version information as well as enabled features. Short, sweet, and honestly kind of a flex. πŸŽ€


✨ EXTENSIONS ✨

muon provides some extra functions that may be called within source files. They are documented below. Bonus content, bestie!! πŸ¦‹

  • dbg() β€” Begin an interactive debugger.
  • p(value) β€” Print any value's internal representation. For example, p('hello') prints 'hello'.

πŸ‘€ SEE ALSO πŸ‘€

meson.build(5) meson-reference(3) meson(1)


πŸ’Œ AUTHORS πŸ’Œ

Maintained by Stone Tickle <lattis@mochiro.moe>, who is assisted by other open source contributors. For more information about muon development, see https://sr.ht/~lattis/muon.


okay that's the whole page bestie, you're officially fluent in muon πŸ’œ this one's muon(1), dated 2025-10-17 β€” go forth and build something iconic. periodt. 🌸

πŸ“¦ where this page comes from