* Add LoongArch64 build support * Delete binding/HarfBuzzSharp.NativeAssets.Linux/HarfBuzzSharp.NativeAssets.Linux.csproj * Create HarfBuzzSharp.NativeAssets.Linux.csproj * Delete binding/SkiaSharp.NativeAssets.Linux.NoDependencies/SkiaSharp.NativeAssets.Linux.NoDependencies.csproj * Create SkiaSharp.NativeAssets.Linux.NoDependencies.csproj * Delete binding/SkiaSharp.NativeAssets.Linux/SkiaSharp.NativeAssets.Linux.csproj * Create SkiaSharp.NativeAssets.Linux.csproj * Update _clang-cross-common.sh * Update Dockerfile * Update build-local.sh * Update build-local.sh * azure-templates-stages.yml:updated to add loong * azure-templates-stages.yml:LoongArch64 * Dockerfile:Changed to trixie docker and back to gcc13 * build-local.sh:update instruction * azure-templates-stages.yml:Fix loongarch64 build * azure-templates-stages.yml:Fix loongarch64 build 2 * Create startup.sh * Dockerfile:changes libpthread.so to libpthread.so.0 * azure-templates-stages.yml:Revert because alpine official support loong * Dockerfile:Back to GCC 14 to compat libc6-loong64-cross * Update scripts/azure-templates-stages.yml * azure-templates-stages.yml:https://packages.debian.org/trixie/binutils-loongarch64-linux-gnu needs glibc at least 2.38 * Update scripts/Docker/debian/clang-cross/13/Dockerfile * Create deepin 23 Dockerfile for backup purposes * Dockerfile:Use stable version LLVM 18 * Create startup.sh * Create .dockerignore * Create Deepin 23 build-local.sh * azure-templates-stages.yml:Try to use deepin 23 to build * azure-templates-stages.yml:Revert to debian trixie * Delete scripts/Docker/deepin/clang-cross/23/Dockerfile * Delete scripts/Docker/deepin/clang-cross/23/startup.sh * Delete scripts/Docker/deepin/clang-cross/.dockerignore * Delete scripts/Docker/deepin/clang-cross/build-local.sh --------- Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
142 lines
4.8 KiB
C#
142 lines
4.8 KiB
C#
#load "shared.cake"
|
|
|
|
var PYTHON_EXE = Argument("python", EnvironmentVariable("PYTHON_EXE") ?? "python3");
|
|
|
|
if (!string.IsNullOrEmpty(PYTHON_EXE) && FileExists(PYTHON_EXE)) {
|
|
var dir = MakeAbsolute((FilePath)PYTHON_EXE).GetDirectory();
|
|
var oldPath = EnvironmentVariable("PATH");
|
|
System.Environment.SetEnvironmentVariable("PATH", dir.FullPath + System.IO.Path.PathSeparator + oldPath);
|
|
}
|
|
|
|
DirectoryPath DEPOT_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/depot_tools"));
|
|
DirectoryPath SKIA_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/skia"));
|
|
DirectoryPath HARFBUZZ_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/skia/third_party/externals/harfbuzz"));
|
|
|
|
var EXE_EXTENSION = IsRunningOnWindows() ? ".exe" : "";
|
|
var GN_EXE = Argument("gn", EnvironmentVariable("GN_EXE") ?? SKIA_PATH.CombineWithFilePath($"bin/gn{EXE_EXTENSION}").FullPath);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// TASKS
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Task("git-sync-deps")
|
|
.Does(() =>
|
|
{
|
|
// first run some checks to make sure all the versions are in sync
|
|
|
|
var milestoneFile = SKIA_PATH.CombineWithFilePath("include/core/SkMilestone.h");
|
|
var incrementFile = SKIA_PATH.CombineWithFilePath("include/c/sk_types.h");
|
|
|
|
var expectedMilestone = GetVersion("libSkiaSharp", "milestone");
|
|
var expectedIncrement = GetVersion("libSkiaSharp", "increment");
|
|
|
|
var actualMilestone = GetRegexValue(@"^#define SK_MILESTONE (\d+)\s*$", milestoneFile);
|
|
var actualIncrement = GetRegexValue(@"^#define SK_C_INCREMENT (\d+)\s*$", incrementFile);
|
|
|
|
if (actualMilestone != expectedMilestone)
|
|
throw new Exception($"The libskia C++ API version did not match the expected '{expectedMilestone}', instead was '{actualMilestone}'.");
|
|
if (actualIncrement != expectedIncrement)
|
|
throw new Exception($"The libSkiaSharp C API version did not match the expected '{expectedIncrement}', instead was '{actualIncrement}'.");
|
|
|
|
RunPython(SKIA_PATH, SKIA_PATH.CombineWithFilePath("tools/git-sync-deps"));
|
|
});
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// HELPERS
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void RunPython(DirectoryPath working, FilePath script, string args = "")
|
|
{
|
|
RunProcess(PYTHON_EXE, new ProcessSettings {
|
|
Arguments = $"{script.FullPath} {args}",
|
|
WorkingDirectory = working.FullPath,
|
|
});
|
|
}
|
|
|
|
void RunGn(DirectoryPath working, DirectoryPath outDir, string args = "")
|
|
{
|
|
var isCore = Context.Environment.Runtime.IsCoreClr;
|
|
|
|
var quote = IsRunningOnWindows() || isCore ? "\"" : "'";
|
|
var innerQuote = IsRunningOnWindows() || isCore ? "\\\"" : "\"";
|
|
|
|
RunProcess(GN_EXE, new ProcessSettings {
|
|
Arguments = $"gen {outDir} --script-executable={quote}{PYTHON_EXE}{quote} --args={quote}{args.Replace("'", innerQuote)}{quote}",
|
|
WorkingDirectory = working.FullPath,
|
|
});
|
|
}
|
|
|
|
void RunNinja(DirectoryPath working, DirectoryPath outDir, string target = "")
|
|
{
|
|
var script = DEPOT_PATH.CombineWithFilePath("ninja.py");
|
|
|
|
RunPython(working, script, $"-C {outDir} {target}");
|
|
}
|
|
|
|
void GnNinja(DirectoryPath outDir, string target, string skiaArgs)
|
|
{
|
|
// override win_vc with the command line args
|
|
if (!string.IsNullOrEmpty(VS_INSTALL)) {
|
|
DirectoryPath win_vc = VS_INSTALL;
|
|
win_vc = win_vc.Combine("VC");
|
|
skiaArgs += $" win_vc='{win_vc}' ";
|
|
}
|
|
|
|
skiaArgs +=
|
|
$" skia_enable_tools=false " +
|
|
$" is_official_build={CONFIGURATION.ToLower() == "release"} ".ToLower();
|
|
|
|
// generate native skia build files
|
|
RunGn(SKIA_PATH, $"out/{outDir}", skiaArgs);
|
|
|
|
// build native skia
|
|
RunNinja(SKIA_PATH, $"out/{outDir}", target);
|
|
}
|
|
|
|
string ReduceArch(string arch)
|
|
{
|
|
arch = arch?.ToLower() ?? "";
|
|
|
|
switch (arch) {
|
|
case "win32":
|
|
case "i386":
|
|
case "i586":
|
|
case "x86":
|
|
return "x86";
|
|
case "x86_64":
|
|
case "x64":
|
|
return "x64";
|
|
case "armeabi-v7a":
|
|
case "armel":
|
|
case "armv7":
|
|
case "armv7k":
|
|
case "arm":
|
|
return "arm";
|
|
case "arm64_32":
|
|
case "arm64-v8a":
|
|
case "aarch64":
|
|
case "arm64":
|
|
return "arm64";
|
|
case "riscv64":
|
|
return "riscv64";
|
|
case "loongarch64":
|
|
return "loongarch64";
|
|
}
|
|
|
|
throw new Exception($"Unknown architecture: {arch}");
|
|
}
|
|
|
|
bool Skip(string arch)
|
|
{
|
|
if (BUILD_ARCH.Length == 0 || BUILD_ARCH.Contains("all"))
|
|
return false;
|
|
|
|
arch = ReduceArch(arch);
|
|
|
|
if (BUILD_ARCH.Contains(arch))
|
|
return false;
|
|
|
|
Warning($"Skipping architecture: {arch}");
|
|
|
|
return true;
|
|
}
|