cross: rewrite newsflash patch as a nixpkgs commit

This commit is contained in:
2025-08-27 17:04:05 +00:00
parent a4b114fce2
commit 1204f4db69
2 changed files with 42 additions and 36 deletions

View File

@@ -349,45 +349,45 @@ in with final; {
# 2025/07/27: upstreaming is unblocked by deps; but turns out to not be this simple
# ncftp = addNativeInputs [ bintools ] prev.ncftp;
# 2025/08/26: upstreaming is unblocked
newsflash = (prev.newsflash.override {
cargo = crossCargo;
}).overrideAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
rm build.rs
# 2025/08/27: upstreaming is unblocked, implemented on desko branch `pr-newsflash-cross`
# newsflash = (prev.newsflash.override {
# cargo = crossCargo;
# }).overrideAttrs (upstream: {
# postPatch = (upstream.postPatch or "") + ''
# rm build.rs
export OUT_DIR=$(pwd)
# export OUT_DIR=$(pwd)
# from build.rs:
glib-compile-resources --sourcedir=data/resources --target=icons.gresource data/resources/icons.gresource.xml
glib-compile-resources --sourcedir=data/resources --target=styles.gresource data/resources/styles.gresource.xml
substitute data/io.gitlab.news_flash.NewsFlash.appdata.xml.in.in \
data/resources/io.gitlab.news_flash.NewsFlash.appdata.xml \
--replace-fail '@appid@' 'io.gitlab.news_flash.NewsFlash'
glib-compile-resources --sourcedir=data/resources --target=appdata.gresource data/resources/appdata.gresource.xml
'';
# # from build.rs:
# glib-compile-resources --sourcedir=data/resources --target=icons.gresource data/resources/icons.gresource.xml
# glib-compile-resources --sourcedir=data/resources --target=styles.gresource data/resources/styles.gresource.xml
# substitute data/io.gitlab.news_flash.NewsFlash.appdata.xml.in.in \
# data/resources/io.gitlab.news_flash.NewsFlash.appdata.xml \
# --replace-fail '@appid@' 'io.gitlab.news_flash.NewsFlash'
# glib-compile-resources --sourcedir=data/resources --target=appdata.gresource data/resources/appdata.gresource.xml
# '';
env = let
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 = stdenv.buildPlatform.rust.rustcTarget;
rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
in (upstream.env or {}) // {
# 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}";
# fails to fix "Failed to find OpenSSL development headers."
# OPENSSL_NO_VENDOR = 1;
# OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
# OPENSSL_DIR = "${lib.getDev openssl}";
};
});
# env = let
# 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 = stdenv.buildPlatform.rust.rustcTarget;
# rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
# in (upstream.env or {}) // {
# # 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}";
# # fails to fix "Failed to find OpenSSL development headers."
# # OPENSSL_NO_VENDOR = 1;
# # OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
# # OPENSSL_DIR = "${lib.getDev openssl}";
# };
# });
# fixes "properties/gresource.xml: Permission denied"
# - by providing glib-compile-resources

View File

@@ -103,6 +103,12 @@ in
hash = "sha256-F6RwprsXOWjk/xNHtBqQWge5edLGJeQUrupKZ1MNphU=";
})
(fetchpatch' {
name = "newsflash: fix cross compilation";
saneCommit = "0453c58e9acf42c4ba52f3fda21d7e51139c0141";
hash = "sha256-lLdPik9Iw9Cl7ZdAJIeKsbAfB7eyf57HEQpe3A0NHhM=";
})
# (fetchpatch' {
# # opencv used by alpaca, newelle
# name = "opencv: fix cross compliation by patching protobuf";