Merge "lix-doc: remove meson pre-1.5 hacks" into main

This commit is contained in:
Yureka
2025-05-11 19:14:44 +00:00
committed by Lix Systems Gerrit
15 changed files with 3 additions and 155 deletions
+2 -10
View File
@@ -1,13 +1,5 @@
# FIXME: remove hack once we get rid of meson 1.4
rnix_name = 'rnix-0.11-rs'
rowan_name = 'rowan-0.15-rs'
if meson.version().version_compare('< 1.5')
rnix_name = 'rnix-rs'
rowan_name = 'rowan-rs'
endif
rnix = dependency(rnix_name)
rowan = dependency(rowan_name)
rnix = dependency('rnix-0.11-rs')
rowan = dependency('rowan-0.15-rs')
lix_doc = static_library(
'lix_doc',
-8
View File
@@ -1,8 +0,0 @@
{ rustPlatform, lib }:
rustPlatform.buildRustPackage {
name = "lix-doc";
cargoLock.lockFile = ./Cargo.lock;
src = lib.cleanSource ./.;
}
+1 -28
View File
@@ -46,7 +46,7 @@
# in the build directory.
project('lix', 'cpp', 'rust',
meson_version : '>=1.4.0',
meson_version : '>=1.5.0',
version : run_command('bash', '-c', 'echo -n $(jq -r .version < ./version.json)$VERSION_SUFFIX', check : true).stdout().strip(),
default_options : [
'cpp_std=c++23',
@@ -606,33 +606,6 @@ 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
# FIXME: remove (along with its generated wrap files) when we get rid of meson 1.4
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
fs.copyfile(
'misc/launchd/org.nixos.nix-daemon.plist.in',
-43
View File
@@ -1,43 +0,0 @@
#!/usr/bin/env python3
import argparse
import tomllib
import sys
DOWNLOAD_URI_FORMAT = 'https://crates.io/api/v1/crates/{crate}/{version}/download'
WRAP_TEMPLATE = """
[wrap-file]
method = cargo
directory = {crate}-{version}
source_url = {url}
source_filename = {crate}-{version}.tar.gz
source_hash = {hash}
""".lstrip()
parser = argparse.ArgumentParser()
parser.add_argument('lockfile', help='path to the Cargo lockfile to generate wraps from')
parser.add_argument('outdir', help="the 'subprojects' directory to write .wrap files to")
args = parser.parse_args()
with open(args.lockfile, 'rb') as f:
lock_toml = tomllib.load(f)
for dependency in lock_toml['package']:
try:
hash = dependency['checksum']
except KeyError:
# The base package, e.g. lix-doc, won't have a checksum, and conveniently
# the base package is also not something we want a wrap file for.
# Doesn't that work out nicely?
continue
crate = dependency['name']
version = dependency['version']
url = DOWNLOAD_URI_FORMAT.format(crate=crate, version=version)
wrap_text = WRAP_TEMPLATE.format(crate=crate, version=version, url=url, hash=hash)
with open(f'{args.outdir}/{crate}-rs.wrap', 'w') as f:
f.write(wrap_text)
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = autocfg-1.1.0
source_url = https://crates.io/api/v1/crates/autocfg/1.1.0/download
source_filename = autocfg-1.1.0.tar.gz
source_hash = d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = countme-3.0.1
source_url = https://crates.io/api/v1/crates/countme/3.0.1/download
source_filename = countme-3.0.1.tar.gz
source_hash = 7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = dissimilar-1.0.9
source_url = https://crates.io/api/v1/crates/dissimilar/1.0.9/download
source_filename = dissimilar-1.0.9.tar.gz
source_hash = 59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = expect-test-1.5.0
source_url = https://crates.io/api/v1/crates/expect-test/1.5.0/download
source_filename = expect-test-1.5.0.tar.gz
source_hash = 9e0be0a561335815e06dab7c62e50353134c796e7a6155402a64bcff66b6a5e0
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = hashbrown-0.14.5
source_url = https://crates.io/api/v1/crates/hashbrown/0.14.5/download
source_filename = hashbrown-0.14.5.tar.gz
source_hash = e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = memoffset-0.9.1
source_url = https://crates.io/api/v1/crates/memoffset/0.9.1/download
source_filename = memoffset-0.9.1.tar.gz
source_hash = 488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = once_cell-1.19.0
source_url = https://crates.io/api/v1/crates/once_cell/1.19.0/download
source_filename = once_cell-1.19.0.tar.gz
source_hash = 3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = rnix-0.11.0
source_url = https://crates.io/api/v1/crates/rnix/0.11.0/download
source_filename = rnix-0.11.0.tar.gz
source_hash = bb35cedbeb70e0ccabef2a31bcff0aebd114f19566086300b8f42c725fc2cb5f
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = rowan-0.15.16
source_url = https://crates.io/api/v1/crates/rowan/0.15.16/download
source_filename = rowan-0.15.16.tar.gz
source_hash = 0a542b0253fa46e632d27a1dc5cf7b930de4df8659dc6e720b647fc72147ae3d
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = rustc-hash-1.1.0
source_url = https://crates.io/api/v1/crates/rustc-hash/1.1.0/download
source_filename = rustc-hash-1.1.0.tar.gz
source_hash = 08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2
-6
View File
@@ -1,6 +0,0 @@
[wrap-file]
method = cargo
directory = text-size-1.1.1
source_url = https://crates.io/api/v1/crates/text-size/1.1.1/download
source_filename = text-size-1.1.1.tar.gz
source_hash = f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233