diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-08-11 20:55:24 -0700 |
---|---|---|
committer | jade <lix@jade.fyi> | 2024-08-21 17:09:10 +0000 |
commit | dba615098d3d28fdb3339e244a4aec778d269e85 (patch) | |
tree | 9764c3e73c9aa818a7793b087382b7cc3999f4e0 /meson.build | |
parent | e38410799b5b78b2fc2b0c9e4b1dc0dfc5801097 (diff) |
build: move to a Cargo workspace
This is purely to let Cargo's dependency resolver do stuff for us, we do
not actually intend to build this stuff with Cargo to begin with.
Change-Id: I4c08d55595c7c27b7096375022581e1e34308a87
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meson.build b/meson.build index bcf0d06bc..596373c8c 100644 --- a/meson.build +++ b/meson.build @@ -545,6 +545,32 @@ if cxx.get_id() in ['clang', 'gcc'] ) endif +# Until Meson 1.5ยน, we can't just give Meson a Cargo.lock file and be done with it. +# Meson will *detect* what dependencies are needed from Cargo files; it just won't +# fetch them. The Meson 1.5 feature essentially internally translates Cargo.lock entries +# to .wrap files, and that translation is incredibly straightforward, so let's just +# use a simple Python script to generate the .wrap files ourselves while we wait for +# Meson 1.5. Weirdly, it seems Meson will only detect dependencies from other +# dependency() calls, so we have to specify lix-doc's two top-level dependencies, +# rnix and rowan, manually, and then their dependencies will be recursively translated +# into more dependency() calls. +# +# When Meson translates a Cargo dependency, the string passed to `dependency()` follows +# a fixed format, which is important as the .wrap files' basenames must match the string +# passed to `dependency()` exactly. +# In Meson 1.4, this format is `$packageName-rs`. Meson 1.5 changes this to +# `$packageName-$shortenedVersionString-rs`, because of course it does, but we'll cross +# that bridge when we get there... +# +# [1]: https://github.com/mesonbuild/meson/commit/9b8378985dbdc0112d11893dd42b33b7bc8d1e62 +run_command( + python, + meson.project_source_root() / 'meson/cargo-lock-to-wraps.py', + meson.project_source_root() / 'Cargo.lock', + meson.project_source_root() / 'subprojects', + check : true, +) + if is_darwin configure_file( input : 'misc/launchd/org.nixos.nix-daemon.plist.in', |