fix: build with meson 1.5 also
nixpkgs delivered us the untimely gift of a meson 1.5 upgrade, which *does* make our lives easier by allowing us to delete wrap generation code, but it does so at the cost of renaming all rust crates in such a way that the wrap logic cannot tolerate the new names on the old meson version 😭. It also means that support burden for this is going to be atrocious until we either give in and vendor meson 1.5 or we make a CI target for it. Neither seems appealing, though the latter is not super absurd for ensuring we don't break nixpkgs unstable. This commit causes meson 1.5 to ignore the .wrap files in subprojects/ entirely (since they have the wrong names lol) and instead use Cargo.lock, so it now hard-depends on our workspace reshuffling improvement. It also deletes the hack that we were using to get the sources of Cargo deps into meson by using a feature that went unnoticed when this code was originally written: MESON_PACKAGE_CACHE_DIR:8a202de6ec/mesonbuild/wrap/wrap.py (L490-L502)
Change-Id:I7a28f12fc2812c6ed7537b60bc3025c141a05874
This commit is contained in:
parent
dba615098d
commit
651cc0e5b4
|
@ -563,6 +563,7 @@ endif
|
|||
# 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',
|
||||
|
|
16
package.nix
16
package.nix
|
@ -288,6 +288,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
env = {
|
||||
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
|
||||
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
||||
|
||||
# Meson allows referencing a /usr/share/cargo/registry shaped thing for subproject sources.
|
||||
# Turns out the Nix-generated Cargo dependencies are named the same as they
|
||||
# would be in a Cargo registry cache.
|
||||
MESON_PACKAGE_CACHE_DIR = finalAttrs.cargoDeps;
|
||||
};
|
||||
|
||||
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
|
||||
|
@ -313,17 +318,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
||||
''
|
||||
+ ''
|
||||
# Copy the Cargo dependencies to where Meson expects them to be, so we
|
||||
# can seamlessly use Meson's subproject wraps, but just do the download
|
||||
# ahead of time. Luckily for us, importCargoLock-downloaded crates use
|
||||
# the exact naming scheme Meson expects!
|
||||
# The directory from importCargoLock does contain a lockfile, which we
|
||||
# don't need, but all the crate directories start with a word character,
|
||||
# then have a hyphen, and then a sequence of digits or periods for the
|
||||
# version.
|
||||
find "$cargoDeps" -type l -regex '.*/\w.+-[0-9.]+$' -exec \
|
||||
ln -sv "{}" "$PWD/subprojects/" ";"
|
||||
|
||||
# Fix up /usr/bin/env shebangs relied on by the build
|
||||
patchShebangs --build tests/ doc/manual/
|
||||
'';
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
# The external crate rowan has an ambiguous pointer comparison warning, which
|
||||
# we don't want to fail our whole build if werror is on.
|
||||
subproject('rowan-rs', default_options : ['werror=false'])
|
||||
# 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-rs')
|
||||
rowan = dependency('rowan-rs')
|
||||
subproject(rowan_name, default_options : ['werror=false'])
|
||||
|
||||
rnix = dependency(rnix_name)
|
||||
rowan = dependency(rowan_name)
|
||||
|
||||
lix_doc = static_library(
|
||||
'lix_doc',
|
||||
|
|
Loading…
Reference in a new issue