amber-lang: fix build on darwin

aleksana d8c2dac2 5ddda189

+35
+29
pkgs/by-name/am/amber-lang/fix_gnused_detection.patch
···
··· 1 + From cae2ad70d6202bc97623be8c7c123ee2736a4644 Mon Sep 17 00:00:00 2001 2 + From: aleksana <me@aleksana.moe> 3 + Date: Sun, 9 Mar 2025 21:19:27 +0800 4 + Subject: [PATCH] replace_regex: remove bash word boundary when detecting 5 + gnused 6 + 7 + Bash linked against C libraries other than GLibc may not support GNU 8 + extensions of POSIX Extended Regular Regex. For example, 9 + 10 + > re='\bx'; [[ 'x' =~ $re ]] && echo "1" 11 + 12 + does not output the same result on Linux/GLibc and macOS. 13 + --- 14 + src/std/text.ab | 2 +- 15 + 1 file changed, 1 insertion(+), 1 deletion(-) 16 + 17 + diff --git a/src/std/text.ab b/src/std/text.ab 18 + index fe071e33..82449a02 100644 19 + --- a/src/std/text.ab 20 + +++ b/src/std/text.ab 21 + @@ -19,7 +19,7 @@ pub fun replace_regex(source: Text, search: Text, replace: Text, extended: Bool 22 + // GNU sed versions 4.0 through 4.2 support extended regex syntax, 23 + // but only via the "-r" option; use that if the version information 24 + // contains "GNU sed". 25 + - $ re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ 26 + + $ re='Copyright.+Free Software Foundation'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ 27 + let flag = status == 0 then "-r" else "-E" 28 + return $ echo "{source}" | sed "{flag}" -e "s/{search}/{replace}/g" $ 29 + } else {
+6
pkgs/by-name/am/amber-lang/package.nix
··· 4 rustPlatform, 5 bc, 6 util-linux, 7 makeWrapper, 8 installShellFiles, 9 stdenv, ··· 22 rev = version; 23 hash = "sha256-N9G/2G8+vrpr1/K7XLwgW+X2oAyAaz4qvN+EbLOCU1Q="; 24 }; 25 26 useFetchCargoVendor = true; 27 cargoHash = "sha256-e5+L7Qgd6hyqT1Pb9X7bVtRr+xm428Z5J4hhsYNnGtU=";
··· 4 rustPlatform, 5 bc, 6 util-linux, 7 + gnused, 8 makeWrapper, 9 installShellFiles, 10 stdenv, ··· 23 rev = version; 24 hash = "sha256-N9G/2G8+vrpr1/K7XLwgW+X2oAyAaz4qvN+EbLOCU1Q="; 25 }; 26 + 27 + patches = [ 28 + # https://github.com/amber-lang/amber/pull/686 29 + ./fix_gnused_detection.patch 30 + ]; 31 32 useFetchCargoVendor = true; 33 cargoHash = "sha256-e5+L7Qgd6hyqT1Pb9X7bVtRr+xm428Z5J4hhsYNnGtU=";