From c34276e7e64c5e264820cc1dc47218ee7aae0505 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 7 Sep 2026 00:30:41 +0200 Subject: [PATCH] boost191: fix loongarch64-linux build --- pkgs/by-name/bo/boost-build/package.nix | 17 +++++++++++++++++ pkgs/development/libraries/boost/generic.nix | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/bo/boost-build/package.nix b/pkgs/by-name/bo/boost-build/package.nix index 732b35fd8fda..956cbbcef8b7 100644 --- a/pkgs/by-name/bo/boost-build/package.nix +++ b/pkgs/by-name/bo/boost-build/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, bison, # boost derivation to use for the src and version. # This is used by the boost derivation to build @@ -34,6 +35,22 @@ stdenv.mkDerivation { patches = useBoost.boostBuildPatches or [ ] + ++ + lib.optional + ( + useBoost ? version + && lib.versionAtLeast useBoost.version "1.91" + && lib.versionOlder useBoost.version "1.92" + && stdenv.hostPlatform.isLoongArch64 + ) + # Fix crash in var_defines when define string is empty + # https://github.com/boostorg/boost/issues/1141 + ( + fetchpatch { + url = "https://github.com/boostorg/build/commit/708353cdeb6006757e7c6971283efb53f718ae25.patch"; + hash = "sha256-9WWgQPyiKrvQY1ox6sdWoeksgNPDIy0DAbDOfQKJ5y0="; + } + ) ++ lib.optional ( useBoost ? version && lib.versionAtLeast useBoost.version "1.81" diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index f7e9bde5524f..2c43d778f60f 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -269,7 +269,23 @@ stdenv.mkDerivation { hash = "sha256-0IHK55JSujYcwEVOuLkwOa/iPEkdAKQlwVWR42p/X2U="; } ) - + ++ + lib.optional + ( + lib.versionAtLeast version "1.91" + && lib.versionOlder version "1.92" + && stdenv.hostPlatform.isLoongArch64 + ) + # Fix crash in var_defines when define string is empty + # https://github.com/boostorg/boost/issues/1141 + ( + fetchpatch { + url = "https://github.com/boostorg/build/commit/708353cdeb6006757e7c6971283efb53f718ae25.patch"; + stripLen = 1; + extraPrefix = "tools/build/"; + hash = "sha256-uFdxuL3DXvr/jmz7jv/q76/S8JaNF//2ogTMwG/D2nY="; + } + ) ++ lib.optionals (version == "1.87.0") [ # Fix operator<< for shared_ptr and intrusive_ptr # https://github.com/boostorg/smart_ptr/issues/115