cross: fix upstream fractal build

it still takes like an hour to build though
This commit is contained in:
Colin 2024-05-19 23:16:29 +00:00
parent 5a92b07f5d
commit 9c2cc9641b

View File

@ -651,51 +651,13 @@ in with final; {
'';
});
# future: use `buildRustPackage`?
# - find another rust package that uses a `-sys` crate (with a build script)?
# - `halloy` uses openssl-sys (1 patch version ahead of fractal), builds
# - uses `cargoBuildHook`, which sets the x86 CC
# - copy from gst_all_1.gst-plugins-rs
# - that's the rust dep which fails to build; nixpkgs chatter makes it sound like cargo-c is the culprit
# fractal = prev.fractal.overrideAttrs (upstream: {
# env = let
# inherit buildPackages stdenv rust;
# ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
# cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
# ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
# cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
# rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform;
# rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
# rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;
# in {
# # taken from <pkgs/build-support/rust/hooks/default.nix>
# # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64"
# # XXX: these aren't necessarily valid environment variables: the referenced nix file is more clever to get them to work.
# "CC_${rustBuildPlatform}" = "${ccForBuild}";
# "CXX_${rustBuildPlatform}" = "${cxxForBuild}";
# "CC_${rustTargetPlatform}" = "${ccForHost}";
# "CXX_${rustTargetPlatform}" = "${cxxForHost}";
# };
# mesonFlags = (upstream.mesonFlags or []) ++
# (let
# # ERROR: 'rust' compiler binary not defined in cross or native file
# crossFile = writeText "cross-file.conf" ''
# [binaries]
# rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ]
# '';
# in
# lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]
# );
# # 2023/09/15: fails with:
# # - error: linking with `/nix/store/75slks1wr3b3sxr5advswjzg9lvbv9jc-gcc-wrapper-12.3.0/bin/cc` failed: exit status: 1
# # - error: could not compile `gst-plugin-gtk4` (lib) due to previous error
# # seems it's trying to link something for the build platform instead of the host platform
# # fractal-next 5.beta2 is using gst-plugin-gtk4 0.11.
# # - gst-plugin-gtk4 tip is at 0.12.0-alpha1, but that's not published to Crates.io
# # - <https://lib.rs/crates/gst-plugin-gtk4>
# # - no obvious PRs that merged after 0.11 release relevant to cross compilation
# # patching gst-plugin-gtk4 to not build cdylib fixes the issue in the `fractal-nixified` variant of this package
# });
fractal = prev.fractal.overrideAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
substituteInPlace src/meson.build \
--replace-fail "cargo, 'build'," "'${lib.getExe crossCargo}', 'build'," \
--replace-fail "'src' / rust_target" "'src' / '${rust.envVars.rustHostPlatformSpec}' / rust_target"
'';
});
# 2024/02/27: upstreaming is unblocked -- if i can rework to not use emulation
# fwupd-efi = prev.fwupd-efi.override {