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

View File

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