-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,764 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ writeShellScript | ||
, runtimeShell | ||
, nix | ||
, lib | ||
, substituteAll | ||
, nuget-to-nix | ||
, cacert | ||
, mkNugetDeps | ||
}: | ||
|
||
{ depsFile | ||
, overrideFetchAttrs ? x: {} | ||
}: fnOrAttrs: finalAttrs: | ||
let | ||
attrs = | ||
if builtins.isFunction fnOrAttrs | ||
then fnOrAttrs finalAttrs | ||
else fnOrAttrs; | ||
|
||
deps = mkNugetDeps { | ||
name = "${finalPackage.name}-nuget-deps"; | ||
sourceFile = depsFile; | ||
}; | ||
|
||
finalPackage = finalAttrs.finalPackage; | ||
|
||
in attrs // { | ||
buildInputs = attrs.buildInputs or [] ++ [ | ||
deps | ||
]; | ||
|
||
passthru = attrs.passthru or {} // { | ||
fetch-deps = let | ||
pkg' = finalPackage.overrideAttrs (old: { | ||
buildInputs = lib.remove deps old.buildInputs; | ||
keepNugetConfig = true; | ||
dontBuild = true; | ||
dontInstall = true; | ||
}); | ||
|
||
pkg'' = pkg'.overrideAttrs overrideFetchAttrs; | ||
|
||
drv = builtins.unsafeDiscardOutputDependency pkg''.drvPath; | ||
|
||
innerScript = substituteAll { | ||
src = ./fetch-deps.sh; | ||
isExecutable = true; | ||
inherit cacert; | ||
defaultDepsFile = | ||
# Wire in the depsFile such that running the script with no args | ||
# runs it agains the correct deps file by default. | ||
# Note that toString is necessary here as it results in the path at | ||
# eval time (i.e. to the file in your local Nixpkgs checkout) rather | ||
# than the Nix store path of the path after it's been imported. | ||
if lib.isPath depsFile | ||
&& !lib.hasPrefix "${builtins.storeDir}/" (toString depsFile) then | ||
toString depsFile | ||
else | ||
''$(mktemp -t "${finalPackage.name}-deps-XXXXXX.nix")''; | ||
nugetToNix = nuget-to-nix; | ||
}; | ||
|
||
in writeShellScript "${finalPackage.name}-fetch-deps" '' | ||
NIX_BUILD_SHELL="${runtimeShell}" exec ${nix}/bin/nix-shell \ | ||
--pure --run 'source "${innerScript}"' "${drv}" | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
set -e | ||
|
||
tmp=$(mktemp -d) | ||
trap 'chmod -R +w "$tmp" && rm -fr "$tmp"' EXIT | ||
|
||
HOME=$tmp/.home | ||
mkdir "$HOME" | ||
cd "$tmp" | ||
|
||
export NIX_SSL_CERT_FILE=@cacert@/etc/ssl/certs/ca-bundle.crt | ||
|
||
genericBuild | ||
|
||
depsFile=$(realpath "${1:-@defaultDepsFile@}") | ||
tmpFile="$tmp"/deps.nix | ||
echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$tmpFile" | ||
@nugetToNix@/bin/nuget-to-nix "$NUGET_PACKAGES" >> "$tmpFile" | ||
mv "$tmpFile" "$depsFile" | ||
echo "Succesfully wrote lockfile to $depsFile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
pkgs/build-support/dotnet/make-nuget-deps/overrides/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
callPackage, | ||
autoPatchelfHook, | ||
fontconfig, | ||
}: | ||
{ | ||
|
||
"SkiaSharp.NativeAssets.Linux" = | ||
package: | ||
package.overrideAttrs (old: { | ||
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ autoPatchelfHook ]; | ||
|
||
buildInputs = old.buildInputs or [ ] ++ [ fontconfig ]; | ||
|
||
preInstall = | ||
old.preInstall or "" | ||
+ '' | ||
rm -r runtimes/linux-{arm,arm64,musl-x64} | ||
''; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
pkgs/by-name/av/avalonia/0001-use-files-for-unicode-character-database.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
From f4c599a48d153d15ccb1879ff511617c8e310515 Mon Sep 17 00:00:00 2001 | ||
From: David McFarland <[email protected]> | ||
Date: Sat, 10 Aug 2024 23:14:12 -0300 | ||
Subject: [PATCH 1/2] use files for unicode character database | ||
|
||
--- | ||
.../BiDiClassTestDataGenerator.cs | 1 - | ||
.../TextFormatting/BiDiTestDataGenerator.cs | 1 - | ||
.../GraphemeBreakClassTrieGenerator.cs | 1 - | ||
.../GraphemeBreakTestDataGenerator.cs | 1 - | ||
.../LineBreakEnumuratorTests.cs | 1 - | ||
.../TextFormatting/UnicodeDataGenerator.cs | 28 +++++++++++++++++-- | ||
.../TextFormatting/UnicodeEnumsGenerator.cs | 1 - | ||
7 files changed, 26 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs | ||
index f6b01d737..bc7278ef8 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTestDataGenerator.cs | ||
@@ -3,7 +3,6 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
-using System.Net.Http; | ||
using Avalonia.Base.UnitTests.Media.TextFormatting; | ||
|
||
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting | ||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs | ||
index 28d37130a..5e26edf49 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs | ||
@@ -3,7 +3,6 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
-using System.Net.Http; | ||
using Avalonia.Base.UnitTests.Media.TextFormatting; | ||
using Avalonia.Media.TextFormatting.Unicode; | ||
|
||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs | ||
index 1a8d41caa..185b6ea62 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs | ||
@@ -1,7 +1,6 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
-using System.Net.Http; | ||
using System.Text.RegularExpressions; | ||
using Avalonia.Media.TextFormatting.Unicode; | ||
|
||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs | ||
index 029f8e236..44c2aaf6a 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs | ||
@@ -3,7 +3,6 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
-using System.Net.Http; | ||
using Avalonia.Base.UnitTests.Media.TextFormatting; | ||
|
||
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting | ||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs | ||
index 3db9a32b6..b8df1f446 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs | ||
@@ -3,7 +3,6 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
-using System.Net.Http; | ||
using Avalonia.Media.TextFormatting; | ||
using Avalonia.Media.TextFormatting.Unicode; | ||
using Xunit; | ||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs | ||
index f05a1e574..7e698ae0a 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs | ||
@@ -1,16 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
-using System.Net.Http; | ||
using System.Text.RegularExpressions; | ||
+using System.Threading.Tasks; | ||
using Avalonia.Media.TextFormatting.Unicode; | ||
using Xunit; | ||
|
||
namespace Avalonia.Base.UnitTests.Media.TextFormatting | ||
{ | ||
+ class HttpContent : IDisposable { | ||
+ readonly string url; | ||
+ public HttpContent(string url) => this.url = url; | ||
+ | ||
+ public void Dispose() {} | ||
+ public Task<Stream> ReadAsStreamAsync() => | ||
+ Task.FromResult<Stream>(File.OpenRead(url)); | ||
+ } | ||
+ | ||
+ class HttpResponseMessage : IDisposable { | ||
+ HttpContent content; | ||
+ public HttpResponseMessage(string url) => Content = new(url); | ||
+ | ||
+ public void Dispose() {} | ||
+ public bool IsSuccessStatusCode => true; | ||
+ public HttpContent Content { get; init; } | ||
+ } | ||
+ | ||
+ class HttpClient : IDisposable { | ||
+ public void Dispose() {} | ||
+ public Task<HttpResponseMessage> GetAsync(string url) => | ||
+ Task.FromResult<HttpResponseMessage>(new (url)); | ||
+ } | ||
+ | ||
internal static class UnicodeDataGenerator | ||
{ | ||
- public const string Ucd = "https://www.unicode.org/Public/15.0.0/ucd/"; | ||
+ public static readonly string Ucd = Environment.GetEnvironmentVariable("UNICODE_CHARACTER_DATABASE"); | ||
|
||
public static UnicodeTrie GenerateBiDiTrie(out BiDiDataEntries biDiDataEntries, out Dictionary<int, BiDiDataItem> biDiData) | ||
{ | ||
diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs | ||
index 110e57cbd..7073ea508 100644 | ||
--- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs | ||
+++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs | ||
@@ -2,7 +2,6 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
-using System.Net.Http; | ||
|
||
namespace Avalonia.Base.UnitTests.Media.TextFormatting | ||
{ | ||
-- | ||
2.42.2 | ||
|
Oops, something went wrong.