flare-signal: support cross compilation

This commit is contained in:
2023-10-30 11:02:01 +00:00
parent 3667484e80
commit 000bae364e
2 changed files with 33 additions and 3 deletions

View File

@@ -562,6 +562,18 @@ in {
};
});
flare-signal-nixified = prev.flare-signal-nixified.override {
# N.B. blueprint-compiler is in nativeBuildInputs.
# the trick here is to force the aarch64 versions to be used during build (via emulation).
# blueprint-compiler override shared with tangram.
blueprint-compiler = buildInQemu (final.blueprint-compiler.overrideAttrs (_: {
# default is to propagate gobject-introspection *as a buildInput*, when it's supposed to be native.
propagatedBuildInputs = [];
# "Namespace Gtk not available"
doCheck = false;
}));
};
# 2023/07/31: upstreaming is blocked on ostree dep
flatpak = prev.flatpak.overrideAttrs (upstream: {
# fixes "No package 'libxml-2.0' found"
@@ -1958,8 +1970,9 @@ in {
# };
tangram = (prev.tangram.override {
# N.B. blueprint-compiler is in nativeBuildInputs.
# the trick here is to force the aarch64 versions to be used during build (via emulation),
blueprint-compiler = buildInQemu (final.blueprint-compiler.overrideAttrs (upstream: {
# the trick here is to force the aarch64 versions to be used during build (via emulation).
# blueprint-compiler override shared with flare-signal-nixified.
blueprint-compiler = buildInQemu (final.blueprint-compiler.overrideAttrs (_: {
# default is to propagate gobject-introspection *as a buildInput*, when it's supposed to be native.
propagatedBuildInputs = [];
# "Namespace Gtk not available"

View File

@@ -3,7 +3,7 @@
# - `sed -i 's/target."curve25519_dalek_backend"/target."curve25519_dalek_backend" or ""/g' Cargo.nix`
#
# the generated Cargo.nix points to an impure source (~/ref/...), but that's resolved by overriding `src` below
{ stdenv
{ lib
, appstream-glib
, blueprint-compiler
, desktop-file-utils
@@ -11,6 +11,7 @@
, flare-signal
, gdk-pixbuf
, glib
, gobject-introspection
, gst_all_1
, gtk4
, gtksourceview5
@@ -22,7 +23,10 @@
, pkg-config
, pkgs
, protobuf
, rust
, stdenv
, wrapGAppsHook4
, writeText
}:
let
cargoNix = import ./Cargo.nix {
@@ -87,6 +91,7 @@ let
appstream-glib # for appstream-util
blueprint-compiler
desktop-file-utils # for update-desktop-database
gobject-introspection
meson
ninja
pkg-config
@@ -107,6 +112,18 @@ let
gst_all_1.gst-plugins-bad
];
mesonFlags = let
# this gets meson to shutup about rustc not producing executables.
# kinda silly though, since we patch out the actual cargo (rustc) invocations.
crossFile = writeText "cross-file.conf" ''
[binaries]
rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ]
'';
in
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-file=${crossFile}"
];
# patch so meson will invoke our `crate2nix_cmd.sh` instead of cargo
postPatch = ''
substituteInPlace src/meson.build \