This commit is contained in:
Matthew Leibowitz 2020-07-03 07:27:03 +02:00
Родитель 35a7522bf8
Коммит 0f62144537
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: ECDB25CC0E22FC46
3 изменённых файлов: 96 добавлений и 29 удалений

Просмотреть файл

@ -15,31 +15,31 @@ string AR = Argument("ar", EnvironmentVariable("AR"));
string VARIANT = BUILD_VARIANT ?? "linux";
if (BUILD_ARCH.Length == 0)
BUILD_ARCH = new [] { "x64" };
Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnLinux())
.Does(() =>
{
var COMPILERS = "";
if (!string.IsNullOrEmpty(CC))
COMPILERS += $"cc='{CC}' ";
if (!string.IsNullOrEmpty(CXX))
COMPILERS += $"cxx='{CXX}' ";
if (!string.IsNullOrEmpty(AR))
COMPILERS += $"ar='{AR}' ";
foreach (var ARCH in BUILD_ARCH) {
if (Skip(ARCH)) return;
Build("x64", "x64", "x64");
void Build(string arch, string skiaArch, string dir)
{
if (Skip(arch)) return;
var COMPILERS = "";
if (!string.IsNullOrEmpty(CC))
COMPILERS += $"cc='{CC}' ";
if (!string.IsNullOrEmpty(CXX))
COMPILERS += $"cxx='{CXX}' ";
if (!string.IsNullOrEmpty(AR))
COMPILERS += $"ar='{AR}' ";
var soname = GetVersion("libSkiaSharp", "soname");
var map = MakeAbsolute((FilePath)"libSkiaSharp/libSkiaSharp.map");
GnNinja($"{VARIANT}/{arch}", "SkiaSharp",
GnNinja($"{VARIANT}/{ARCH}", "SkiaSharp",
$"target_os='linux' " +
$"target_cpu='{arch}' " +
$"target_cpu='{ARCH}' " +
$"is_official_build=true " +
$"skia_enable_gpu={(SUPPORT_GPU ? "true" : "false")} " +
$"skia_enable_tools=false " +
@ -53,15 +53,16 @@ Task("libSkiaSharp")
$"skia_use_system_libwebp=false " +
$"skia_use_system_zlib=false " +
$"skia_use_vulkan={SUPPORT_VULKAN} ".ToLower () +
$"extra_asmflags=[] " +
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_SYSCALL_GETRANDOM', '-DXML_DEV_URANDOM' ] " +
$"extra_ldflags=[ '-static-libstdc++', '-static-libgcc', '-Wl,--version-script={map}' ] " +
COMPILERS +
$"linux_soname_version='{soname}' " +
ADDITIONAL_GN_ARGS);
var outDir = OUTPUT_PATH.Combine($"{VARIANT}/{dir}");
var outDir = OUTPUT_PATH.Combine($"{VARIANT}/{ARCH}");
EnsureDirectoryExists(outDir);
var so = SKIA_PATH.CombineWithFilePath($"out/{VARIANT}/{arch}/libSkiaSharp.so.{soname}");
var so = SKIA_PATH.CombineWithFilePath($"out/{VARIANT}/{ARCH}/libSkiaSharp.so.{soname}");
CopyFileToDirectory(so, outDir);
CopyFile(so, outDir.CombineWithFilePath("libSkiaSharp.so"));
}
@ -71,28 +72,25 @@ Task("libHarfBuzzSharp")
.WithCriteria(IsRunningOnLinux())
.Does(() =>
{
var COMPILERS = "";
if (!string.IsNullOrEmpty(CC))
COMPILERS += $"CC='{CC}' ";
if (!string.IsNullOrEmpty(CXX))
COMPILERS += $"CXX='{CXX}' ";
foreach (var ARCH in BUILD_ARCH) {
if (Skip(ARCH)) return;
Build("x64", "x64");
void Build(string arch, string dir)
{
if (Skip(arch)) return;
var COMPILERS = "";
if (!string.IsNullOrEmpty(CC))
COMPILERS += $"CC='{CC}' ";
if (!string.IsNullOrEmpty(CXX))
COMPILERS += $"CXX='{CXX}' ";
var soname = GetVersion("HarfBuzz", "soname");
RunProcess("make", new ProcessSettings {
Arguments = $"{COMPILERS} ARCH={arch} SONAME_VERSION={soname} VARIANT={VARIANT} LDFLAGS=-static-libstdc++",
Arguments = $"{COMPILERS} ARCH={ARCH} SONAME_VERSION={soname} VARIANT={VARIANT} LDFLAGS=-static-libstdc++",
WorkingDirectory = "libHarfBuzzSharp",
});
var outDir = OUTPUT_PATH.Combine($"{VARIANT}/{dir}");
var outDir = OUTPUT_PATH.Combine($"{VARIANT}/{ARCH}");
EnsureDirectoryExists(outDir);
var so = $"libHarfBuzzSharp/bin/{VARIANT}/{arch}/libHarfBuzzSharp.so.{soname}";
var so = $"libHarfBuzzSharp/bin/{VARIANT}/{ARCH}/libHarfBuzzSharp.so.{soname}";
CopyFileToDirectory(so, outDir);
CopyFile(so, outDir.CombineWithFilePath("libHarfBuzzSharp.so"));
}

Просмотреть файл

@ -0,0 +1,51 @@
DirectoryPath ROOT_PATH = MakeAbsolute(Directory("../.."));
DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));
#load "../../cake/shared.cake"
var BUILD_VARIANT = Argument("variant", EnvironmentVariable("BUILD_VARIANT") ?? "linux");
OUTPUT_PATH = OUTPUT_PATH.Combine(BUILD_VARIANT);
Task("libSkiaSharp")
.WithCriteria(IsRunningOnLinux())
.Does(() =>
{
var sysroot = "/usr/arm-linux-gnueabihf";
var target = "armv7a-linux-gnueabihf";
RunCake("../linux/build.cake", "libSkiaSharp", new Dictionary<string, string> {
{ "variant", BUILD_VARIANT },
{ "arch", "arm" },
{ "gnArgs",
$"skia_use_fontconfig=false " + // TEMP:
$"extra_asmflags+=[ '--sysroot={sysroot}', '--target={target}', '-mfloat-abi=hard', '-march=armv7-a', '-mfpu=neon', '-mthumb' ] " +
$"extra_cflags+=[ '--sysroot={sysroot}', '--target={target}', '-mfloat-abi=hard', '-march=armv7-a', '-mfpu=neon', '-mthumb', '-I/usr/arm-linux-gnueabihf/include', '-I/usr/arm-linux-gnueabihf/include/c++/4.8.5', '-I/usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf' ] " +
$"extra_ldflags+=[ '--sysroot={sysroot}', '--target={target}' , '-mfloat-abi=hard', '-march=armv7-a', '-mfpu=neon', '-mthumb'] "
},
});
RunProcess("ldd", OUTPUT_PATH.CombineWithFilePath($"x64/libSkiaSharp.so").FullPath, out var stdout);
if (stdout.Any(o => o.Contains("fontconfig")))
throw new Exception("libSkiaSharp.so contained a dependency on fontconfig.");
});
Task("libHarfBuzzSharp")
.WithCriteria(IsRunningOnLinux())
.Does(() =>
{
RunCake("../linux/build.cake", "libHarfBuzzSharp", new Dictionary<string, string> {
{ "variant", BUILD_VARIANT },
});
RunProcess("ldd", OUTPUT_PATH.CombineWithFilePath($"x64/libHarfBuzzSharp.so").FullPath, out var stdout);
if (stdout.Any(o => o.Contains("fontconfig")))
throw new Exception("libHarfBuzzSharp.so contained a dependency on fontconfig.");
});
Task("Default")
.IsDependentOn("libSkiaSharp")
.IsDependentOn("libHarfBuzzSharp");
RunTarget(TARGET);

Просмотреть файл

@ -0,0 +1,18 @@
FROM amd64/ubuntu:16.04
RUN apt-get update \
&& apt-get install -y apt-transport-https curl wget \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/6.4.0 main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
&& curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" | tee /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
&& apt-get install -y mono-complete msbuild python git libfontconfig1-dev clang-10 make \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get install -y libstdc++-4.8-dev-armhf-cross libgcc-4.8-dev-armhf-cross binutils-arm-linux-gnueabihf
ENV CC=clang-10 CXX=clang++-10
WORKDIR /work