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 # 2023/07/31: upstreaming is blocked on ostree dep
flatpak = prev.flatpak.overrideAttrs (upstream: { flatpak = prev.flatpak.overrideAttrs (upstream: {
# fixes "No package 'libxml-2.0' found" # fixes "No package 'libxml-2.0' found"
@@ -1958,8 +1970,9 @@ in {
# }; # };
tangram = (prev.tangram.override { tangram = (prev.tangram.override {
# N.B. blueprint-compiler is in nativeBuildInputs. # N.B. blueprint-compiler is in nativeBuildInputs.
# the trick here is to force the aarch64 versions to be used during build (via emulation), # the trick here is to force the aarch64 versions to be used during build (via emulation).
blueprint-compiler = buildInQemu (final.blueprint-compiler.overrideAttrs (upstream: { # 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. # default is to propagate gobject-introspection *as a buildInput*, when it's supposed to be native.
propagatedBuildInputs = []; propagatedBuildInputs = [];
# "Namespace Gtk not available" # "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` # - `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 # the generated Cargo.nix points to an impure source (~/ref/...), but that's resolved by overriding `src` below
{ stdenv { lib
, appstream-glib , appstream-glib
, blueprint-compiler , blueprint-compiler
, desktop-file-utils , desktop-file-utils
@@ -11,6 +11,7 @@
, flare-signal , flare-signal
, gdk-pixbuf , gdk-pixbuf
, glib , glib
, gobject-introspection
, gst_all_1 , gst_all_1
, gtk4 , gtk4
, gtksourceview5 , gtksourceview5
@@ -22,7 +23,10 @@
, pkg-config , pkg-config
, pkgs , pkgs
, protobuf , protobuf
, rust
, stdenv
, wrapGAppsHook4 , wrapGAppsHook4
, writeText
}: }:
let let
cargoNix = import ./Cargo.nix { cargoNix = import ./Cargo.nix {
@@ -87,6 +91,7 @@ let
appstream-glib # for appstream-util appstream-glib # for appstream-util
blueprint-compiler blueprint-compiler
desktop-file-utils # for update-desktop-database desktop-file-utils # for update-desktop-database
gobject-introspection
meson meson
ninja ninja
pkg-config pkg-config
@@ -107,6 +112,18 @@ let
gst_all_1.gst-plugins-bad 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 # patch so meson will invoke our `crate2nix_cmd.sh` instead of cargo
postPatch = '' postPatch = ''
substituteInPlace src/meson.build \ substituteInPlace src/meson.build \