newsflash: simplify cross compilation

This commit is contained in:
2024-08-09 09:52:21 +00:00
parent fd0188025d
commit 7b043d0c87

View File

@@ -864,31 +864,23 @@ in with final; {
# 2023/07/31: upstreaming is blocked on vpnc cross compilation # 2023/07/31: upstreaming is blocked on vpnc cross compilation
# networkmanager-vpnc = mvToNativeInputs [ glib ] prev.networkmanager-vpnc; # networkmanager-vpnc = mvToNativeInputs [ glib ] prev.networkmanager-vpnc;
newsflash = prev.newsflash.overrideAttrs (upstream: { newsflash = (prev.newsflash.override {
nativeBuildInputs = (lib.filter (p: !lib.elem (p.pname or p.name) [ "gdk-pixbuf" "blueprint-compiler" ]) upstream.nativeBuildInputs) ++ [ blueprint-compiler = buildPackages.writeShellScriptBin "blueprint-compiler" ''
buildPackages.git export GI_TYPELIB_PATH=${typelibPath [
(buildPackages.writeShellScriptBin "blueprint-compiler" '' buildPackages.clapper
export GI_TYPELIB_PATH=${typelibPath [ buildPackages.glib
buildPackages.clapper buildPackages.gtk4
buildPackages.glib buildPackages.gst_all_1.gstreamer
buildPackages.gtk4 buildPackages.gst_all_1.gst-plugins-base
buildPackages.gst_all_1.gstreamer buildPackages.gdk-pixbuf
# some of these below are probably *not* needed buildPackages.pango
buildPackages.gst_all_1.gst-plugins-base buildPackages.graphene
buildPackages.gst_all_1.gst-plugins-good buildPackages.harfbuzz
buildPackages.gst_all_1.gst-plugins-bad buildPackages.libadwaita
buildPackages.gdk-pixbuf ]}
buildPackages.graphene exec ${lib.getExe buildPackages.blueprint-compiler} "$@"
buildPackages.harfbuzz '';
buildPackages.libadwaita }).overrideAttrs (upstream: {
buildPackages.pango
]}
exec ${lib.getExe buildPackages.blueprint-compiler} "$@"
'')
];
# strictDeps = false;
postPatch = (upstream.postPatch or "") + '' postPatch = (upstream.postPatch or "") + ''
substituteInPlace src/meson.build --replace-fail \ substituteInPlace src/meson.build --replace-fail \
"'src' / rust_target" \ "'src' / rust_target" \
@@ -917,40 +909,28 @@ in with final; {
runHook postBuild runHook postBuild
''; '';
env = let env = let
inherit buildPackages stdenv rust; inherit buildPackages stdenv rust;
ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform;
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;
in (upstream.env or {}) // { in (upstream.env or {}) // {
# taken from <pkgs/build-support/rust/hooks/default.nix> # taken from <pkgs/build-support/rust/hooks/default.nix>
# fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64" # 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. # XXX: these aren't necessarily valid environment variables: the referenced nix file is more clever to get them to work.
"CC_${rustBuildPlatform}" = "${ccForBuild}"; "CC_${rustBuildPlatform}" = "${ccForBuild}";
"CXX_${rustBuildPlatform}" = "${cxxForBuild}"; "CXX_${rustBuildPlatform}" = "${cxxForBuild}";
"CC_${rustTargetPlatform}" = "${ccForHost}"; "CC_${rustTargetPlatform}" = "${ccForHost}";
"CXX_${rustTargetPlatform}" = "${cxxForHost}"; "CXX_${rustTargetPlatform}" = "${cxxForHost}";
# fails to fix "Failed to find OpenSSL development headers." # fails to fix "Failed to find OpenSSL development headers."
# OPENSSL_NO_VENDOR = 1; # OPENSSL_NO_VENDOR = 1;
# OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib"; # OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
# OPENSSL_DIR = "${lib.getDev openssl}"; # OPENSSL_DIR = "${lib.getDev openssl}";
}; };
# mesonFlags = let
# crossFile = writeText "cross-file.conf" ''
# [binaries]
# rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ]
# '';
# in
# (upstream.mesonFlags or []) ++ [
# "-Dprofile=development"
# ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# "--cross-file=${crossFile}"
# ];
}); });
# fixes "properties/gresource.xml: Permission denied" # fixes "properties/gresource.xml: Permission denied"