diff --git a/build.cake b/build.cake index c4eaab302b..d163e399ee 100644 --- a/build.cake +++ b/build.cake @@ -75,6 +75,11 @@ var TRACKED_NUGETS = new Dictionary { { "SkiaSharp.Vulkan.SharpVk", new Version (1, 57, 0) }, }; +Information("Arguments:"); +foreach (var arg in CAKE_ARGUMENTS) { + Information($" {arg.Key.PadRight(30)} {{0}}", arg.Value); +} + #load "cake/msbuild.cake" #load "cake/UtilsManaged.cake" #load "cake/externals.cake" diff --git a/cake/native-shared.cake b/cake/native-shared.cake index 0dbd9d1f1f..9abdbaa829 100644 --- a/cake/native-shared.cake +++ b/cake/native-shared.cake @@ -1,11 +1,5 @@ #load "shared.cake" -var BUILD_ARCH = Argument("arch", Argument("buildarch", EnvironmentVariable("BUILD_ARCH") ?? "")) - .ToLower().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - -var BUILD_VARIANT = Argument("variant", EnvironmentVariable("BUILD_VARIANT")); -var ADDITIONAL_GN_ARGS = Argument("gnArgs", EnvironmentVariable("ADDITIONAL_GN_ARGS")); - var PYTHON_EXE = Argument("python", EnvironmentVariable("PYTHON_EXE") ?? "python"); if (!string.IsNullOrEmpty(PYTHON_EXE) && FileExists(PYTHON_EXE)) { @@ -85,7 +79,7 @@ void GnNinja(DirectoryPath outDir, string target, string skiaArgs) void StripSign(FilePath target) { if (!IsRunningOnMac()) - throw new InvalidOperationException("lipo is only available on Unix."); + throw new InvalidOperationException("lipo is only available on macOS."); target = MakeAbsolute(target); var archive = target; @@ -107,7 +101,7 @@ void StripSign(FilePath target) void RunLipo(DirectoryPath directory, FilePath output, FilePath[] inputs) { if (!IsRunningOnMac()) - throw new InvalidOperationException("lipo is only available on Unix."); + throw new InvalidOperationException("lipo is only available on macOS."); EnsureDirectoryExists(directory.CombineWithFilePath(output).GetDirectory()); diff --git a/cake/shared.cake b/cake/shared.cake index 12e2a459a7..b01206ebf4 100644 --- a/cake/shared.cake +++ b/cake/shared.cake @@ -13,6 +13,12 @@ var CAKE_ARGUMENTS = (IReadOnlyDictionary)Context.Arguments .GetProperty("Arguments") .GetValue(Context.Arguments); +var BUILD_ARCH = Argument("arch", Argument("buildarch", EnvironmentVariable("BUILD_ARCH") ?? "")) + .ToLower().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + +var BUILD_VARIANT = Argument("variant", EnvironmentVariable("BUILD_VARIANT")); +var ADDITIONAL_GN_ARGS = Argument("gnArgs", EnvironmentVariable("ADDITIONAL_GN_ARGS")); + DirectoryPath PROFILE_PATH = EnvironmentVariable("USERPROFILE") ?? EnvironmentVariable("HOME"); void RunCake(FilePath cake, string target = null, Dictionary arguments = null) diff --git a/externals/skia b/externals/skia index 042510730b..dce303a105 160000 --- a/externals/skia +++ b/externals/skia @@ -1 +1 @@ -Subproject commit 042510730b439ae43829e5200f08889878e282e4 +Subproject commit dce303a105cd8f03cd911bd0b6d662caa830e971 diff --git a/native/linux-clang-cross/build.cake b/native/linux-clang-cross/build.cake new file mode 100644 index 0000000000..c7fed1eadd --- /dev/null +++ b/native/linux-clang-cross/build.cake @@ -0,0 +1,61 @@ +DirectoryPath ROOT_PATH = MakeAbsolute(Directory("../..")); + +#load "../../cake/shared.cake" + +if (BUILD_ARCH.Length == 0) + BUILD_ARCH = new [] { "arm" }; + +string GetGnArgs(string arch) +{ + var toolchainArch = arch == "arm" + ? "arm-linux-gnueabihf" + : "aarch64-linux-gnu"; + var targetArch = arch == "arm" + ? "armv7a-linux-gnueabihf" + : "aarch64-linux-gnu"; + + var sysroot = $"/usr/{toolchainArch}"; + var init = $"'--sysroot={sysroot}', '--target={targetArch}'"; + var bin = $"'-B{sysroot}/bin/' "; + var libs = $"'-L{sysroot}/lib/' "; + var includes = + $"'-I{sysroot}/include', " + + $"'-I{sysroot}/include/c++/current', " + + $"'-I{sysroot}/include/c++/current/{toolchainArch}' "; + + return + $"extra_asmflags+=[ {init}, '-no-integrated-as', {bin}, {includes} ] " + + $"extra_cflags+=[ {init}, {bin}, {includes} ] " + + $"extra_ldflags+=[ {init}, {bin}, {libs} ] " + + ADDITIONAL_GN_ARGS; +} + +Task("libSkiaSharp") + .WithCriteria(IsRunningOnLinux()) + .Does(() => +{ + foreach (var arch in BUILD_ARCH) { + RunCake("../linux/build.cake", "libSkiaSharp", new Dictionary { + { "arch", arch }, + { "gnArgs", GetGnArgs(arch) }, + }); + } +}); + +Task("libHarfBuzzSharp") + .WithCriteria(IsRunningOnLinux()) + .Does(() => +{ + foreach (var arch in BUILD_ARCH) { + RunCake("../linux/build.cake", "libHarfBuzzSharp", new Dictionary { + { "arch", arch }, + { "gnArgs", GetGnArgs(arch) }, + }); + } +}); + +Task("Default") + .IsDependentOn("libSkiaSharp") + .IsDependentOn("libHarfBuzzSharp"); + +RunTarget(TARGET); diff --git a/native/linux/build.cake b/native/linux/build.cake index 29328a0bc5..a419a2dc15 100644 --- a/native/linux/build.cake +++ b/native/linux/build.cake @@ -6,32 +6,35 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native")); string SUPPORT_GPU_VAR = Argument("supportGpu", EnvironmentVariable("SUPPORT_GPU") ?? "true").ToLower(); bool SUPPORT_GPU = SUPPORT_GPU_VAR == "1" || SUPPORT_GPU_VAR == "true"; -string SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? "true"); -bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower () == "true"; +string SUPPORT_VULKAN_VAR = Argument("supportVulkan", EnvironmentVariable("SUPPORT_VULKAN") ?? "true"); +bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower() == "true"; + +var VERIFY_EXCLUDED = Argument("verifyExcluded", "") + .ToLower().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string CC = Argument("cc", EnvironmentVariable("CC")); string CXX = Argument("cxx", EnvironmentVariable("CXX")); string AR = Argument("ar", EnvironmentVariable("AR")); -string VARIANT = BUILD_VARIANT ?? "linux"; +string VARIANT = string.IsNullOrEmpty(BUILD_VARIANT) ? "linux" : BUILD_VARIANT?.Trim(); + +if (BUILD_ARCH.Length == 0) + BUILD_ARCH = new [] { "x64" }; + +var COMPILERS = ""; +if (!string.IsNullOrEmpty(CC)) + COMPILERS += $"cc='{CC}' "; +if (!string.IsNullOrEmpty(CXX)) + COMPILERS += $"cxx='{CXX}' "; +if (!string.IsNullOrEmpty(AR)) + COMPILERS += $"ar='{AR}' "; 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}' "; - - Build("x64", "x64", "x64"); - - void Build(string arch, string skiaArch, string dir) - { + foreach (var arch in BUILD_ARCH) { if (Skip(arch)) return; var soname = GetVersion("libSkiaSharp", "soname"); @@ -52,49 +55,64 @@ Task("libSkiaSharp") $"skia_use_system_libpng=false " + $"skia_use_system_libwebp=false " + $"skia_use_system_zlib=false " + - $"skia_use_vulkan={SUPPORT_VULKAN} ".ToLower () + + $"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}"); CopyFileToDirectory(so, outDir); CopyFile(so, outDir.CombineWithFilePath("libSkiaSharp.so")); + + foreach (var exclude in VERIFY_EXCLUDED) { + RunProcess("readelf", $"-d {so}", out var stdout); + + if (stdout.Any(o => o.Contains($"[{exclude}."))) + throw new Exception($"libSkiaSharp.so contained a dependency on {exclude}."); + } } }); Task("libHarfBuzzSharp") + .IsDependentOn("git-sync-deps") .WithCriteria(IsRunningOnLinux()) .Does(() => { - var COMPILERS = ""; - if (!string.IsNullOrEmpty(CC)) - COMPILERS += $"CC='{CC}' "; - if (!string.IsNullOrEmpty(CXX)) - COMPILERS += $"CXX='{CXX}' "; - - Build("x64", "x64"); - - void Build(string arch, string dir) - { + foreach (var arch in BUILD_ARCH) { if (Skip(arch)) return; var soname = GetVersion("HarfBuzz", "soname"); + var map = MakeAbsolute((FilePath)"libHarfBuzzSharp/libHarfBuzzSharp.map"); - RunProcess("make", new ProcessSettings { - Arguments = $"{COMPILERS} ARCH={arch} SONAME_VERSION={soname} VARIANT={VARIANT} LDFLAGS=-static-libstdc++", - WorkingDirectory = "libHarfBuzzSharp", - }); + GnNinja($"{VARIANT}/{arch}", "HarfBuzzSharp", + $"target_os='linux' " + + $"target_cpu='{arch}' " + + $"is_official_build=true " + + $"visibility_hidden=false " + + $"extra_asmflags=[] " + + $"extra_cflags=[] " + + $"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 = $"libHarfBuzzSharp/bin/{VARIANT}/{arch}/libHarfBuzzSharp.so.{soname}"; + var so = SKIA_PATH.CombineWithFilePath($"out/{VARIANT}/{arch}/libHarfBuzzSharp.so.{soname}"); CopyFileToDirectory(so, outDir); CopyFile(so, outDir.CombineWithFilePath("libHarfBuzzSharp.so")); + + foreach (var exclude in VERIFY_EXCLUDED) { + RunProcess("readelf", $"-d {so}", out var stdout); + + if (stdout.Any(o => o.Contains($"[{exclude}."))) + throw new Exception($"libHarfBuzzSharp.so contained a dependency on {exclude}."); + } } }); diff --git a/native/linux/libHarfBuzzSharp/Makefile b/native/linux/libHarfBuzzSharp/Makefile deleted file mode 100644 index 68f9364a1b..0000000000 --- a/native/linux/libHarfBuzzSharp/Makefile +++ /dev/null @@ -1,125 +0,0 @@ -ARCH ?= x64 -SONAME_VERSION ?= 0.0.0 -CC ?= clang -CXX ?= clang++ -LDFLAGS += -VARIANT ?= linux - -noop = -space = ${noop} ${noop} - -src_root = ../../../externals/harfbuzz/src -obj_root = obj/${VARIANT} -bin_root = bin/${VARIANT} -objarch_root = ${obj_root}/${ARCH} -target_name = libHarfBuzzSharp.so -target = ${bin_root}/${ARCH}/${target_name}.${SONAME_VERSION} - -library_dirs = -include_dirs = \ - . \ - ${src_root} -library_paths = -defines = \ - -DHAVE_CONFIG_H -DNDEBUG -cflags = \ - -fno-rtti -fno-exceptions -fno-threadsafe-statics -fPIC \ - -g -Os -ffunction-sections -fdata-sections -ifeq "${ARCH}" "x86" - arch_cflags = -m32 -else - arch_cflags = -endif -cflags_c = ${cflags} ${CFLAGS} -cflags_cc = -std=c++11 ${CXXFLAGS} -ldflags = -s -Wl,--gc-sections $(library_dirs:%=-L%) ${LDFLAGS} -includes = $(include_dirs:%=-I%) -library_names = $(notdir ${library_paths}) -libraries = $(library_names:lib%.a=-l%) - -src = \ - ${src_root}/hb-aat-layout.cc \ - ${src_root}/hb-aat-map.cc \ - ${src_root}/hb-blob.cc \ - ${src_root}/hb-buffer-serialize.cc \ - ${src_root}/hb-buffer.cc \ - ${src_root}/hb-common.cc \ - ${src_root}/hb-face.cc \ - ${src_root}/hb-fallback-shape.cc \ - ${src_root}/hb-font.cc \ - ${src_root}/hb-map.cc \ - ${src_root}/hb-ot-cff1-table.cc \ - ${src_root}/hb-ot-cff2-table.cc \ - ${src_root}/hb-ot-color.cc \ - ${src_root}/hb-ot-face.cc \ - ${src_root}/hb-ot-font.cc \ - ${src_root}/hb-ot-layout.cc \ - ${src_root}/hb-ot-map.cc \ - ${src_root}/hb-ot-math.cc \ - ${src_root}/hb-ot-meta.cc \ - ${src_root}/hb-ot-metrics.cc \ - ${src_root}/hb-ot-name.cc \ - ${src_root}/hb-ot-shape-complex-arabic.cc \ - ${src_root}/hb-ot-shape-complex-default.cc \ - ${src_root}/hb-ot-shape-complex-hangul.cc \ - ${src_root}/hb-ot-shape-complex-hebrew.cc \ - ${src_root}/hb-ot-shape-complex-indic-table.cc \ - ${src_root}/hb-ot-shape-complex-indic.cc \ - ${src_root}/hb-ot-shape-complex-khmer.cc \ - ${src_root}/hb-ot-shape-complex-myanmar.cc \ - ${src_root}/hb-ot-shape-complex-thai.cc \ - ${src_root}/hb-ot-shape-complex-use-table.cc \ - ${src_root}/hb-ot-shape-complex-use.cc \ - ${src_root}/hb-ot-shape-complex-vowel-constraints.cc \ - ${src_root}/hb-ot-shape-fallback.cc \ - ${src_root}/hb-ot-shape-normalize.cc \ - ${src_root}/hb-ot-shape.cc \ - ${src_root}/hb-ot-tag.cc \ - ${src_root}/hb-ot-var.cc \ - ${src_root}/hb-set.cc \ - ${src_root}/hb-shape-plan.cc \ - ${src_root}/hb-shape.cc \ - ${src_root}/hb-shaper.cc \ - ${src_root}/hb-static.cc \ - ${src_root}/hb-subset-cff-common.cc \ - ${src_root}/hb-subset-cff1.cc \ - ${src_root}/hb-subset-cff2.cc \ - ${src_root}/hb-subset-input.cc \ - ${src_root}/hb-subset-plan.cc \ - ${src_root}/hb-subset.cc \ - ${src_root}/hb-ucd.cc \ - ${src_root}/hb-unicode.cc \ - ${src_root}/hb-warning.cc - -src_names = $(subst ${src_root}/,${noop},${src}) -objs = $(src_names:%=${objarch_root}/%.o) -deps = $(objs:.o=.d) - -${objarch_root}/%.o: ${src_root}/% -# build the local source - @echo Building $<... - @mkdir -p $(dir $@) - @if [ "$(filter %.cc,$<)" = "" ]; then \ - $(CC) -MMD -MF $@.d \ - ${defines} ${includes} ${arch_cflags} ${cflags_c} \ - -c $< -o $@ \ - ; else \ - $(CXX) -MMD -MF $@.d \ - ${defines} ${includes} ${arch_cflags} ${cflags_c} ${cflags_cc} \ - -c $< -o $@ \ - ; fi - -${target}: ${objs} -# link - @echo Linking $@... - @mkdir -p $(dir $@) - $(CXX) -shared -rdynamic -s -o $@ \ - ${defines} ${includes} ${arch_cflags} ${cflags_c} ${cflags_cc} \ - -Wl,--start-group ${objarch_root}/*.o ${library_paths} -Wl,--end-group \ - ${ldflags} -Wl,--gc-sections -Wl,--no-undefined \ - -Wl,-soname,libHarfBuzzSharp.so.${SONAME_VERSION} - -all: ${target} - -clean: - rm -rf ${obj_root} ${bin_root} diff --git a/native/linux/libHarfBuzzSharp/config.h b/native/linux/libHarfBuzzSharp/config.h deleted file mode 100644 index 2fa53a6326..0000000000 --- a/native/linux/libHarfBuzzSharp/config.h +++ /dev/null @@ -1,192 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* The normal alignment of `struct{char;}', in bytes. */ -#define ALIGNOF_STRUCT_CHAR__ 1 - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Have cairo graphics library */ -/* #undef HAVE_CAIRO */ - -/* Have cairo-ft support in cairo graphics library */ -/* #undef HAVE_CAIRO_FT */ - -/* Have Core Text backend */ -/* #undef HAVE_CORETEXT */ - -/* Define to 1 if you have the declaration of `round', and to 0 if you don't. - */ -/* #undef HAVE_DECL_ROUND */ - -/* Have DirectWrite library */ -/* #undef HAVE_DIRECTWRITE */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DWRITE_H */ - -/* Have simple TrueType Layout backend */ -/* #undef HAVE_FALLBACK */ - -/* Have fontconfig library */ -/* #undef HAVE_FONTCONFIG */ - -/* Have FreeType 2 library */ -/* #undef HAVE_FREETYPE */ - -/* Define to 1 if you have the `FT_Done_MM_Var' function. */ -/* #undef HAVE_FT_DONE_MM_VAR */ - -/* Define to 1 if you have the `FT_Get_Var_Blend_Coordinates' function. */ -#define HAVE_FT_GET_VAR_BLEND_COORDINATES 1 - -/* Define to 1 if you have the `FT_Set_Var_Blend_Coordinates' function. */ -#define HAVE_FT_SET_VAR_BLEND_COORDINATES 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Have glib2 library */ -/* #undef HAVE_GLIB */ - -/* Have gobject2 library */ -/* #undef HAVE_GOBJECT */ - -/* Have Graphite2 library */ -/* #undef HAVE_GRAPHITE2 */ - -/* Have ICU library */ -/* #undef HAVE_ICU */ - -/* Use hb-icu Unicode callbacks */ -/* #undef HAVE_ICU_BUILTIN */ - -/* Have Intel __sync_* atomic primitives */ -#define HAVE_INTEL_ATOMIC_PRIMITIVES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `isatty' function. */ -#define HAVE_ISATTY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the `mprotect' function. */ -#define HAVE_MPROTECT 1 - -/* Define to 1 if you have the `newlocale' function. */ -#define HAVE_NEWLOCALE 1 - -/* Define to 1 if you have the `posix_memalign' function. */ -#define HAVE_POSIX_MEMALIGN 1 - -/* Have POSIX threads */ -#define HAVE_PTHREAD 1 - -/* Have PTHREAD_PRIO_INHERIT. */ -#define HAVE_PTHREAD_PRIO_INHERIT 1 - -/* Define to 1 if you have the `round' function. */ -#define HAVE_ROUND 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SCHED_H */ - -/* Have sched_yield */ -/* #undef HAVE_SCHED_YIELD */ - -/* Have Solaris __machine_*_barrier and atomic_* operations */ -/* #undef HAVE_SOLARIS_ATOMIC_OPS */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strtod_l' function. */ -#define HAVE_STRTOD_L 1 - -/* Define to 1 if you have the `sysconf' function. */ -#define HAVE_SYSCONF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Have Uniscribe library */ -/* #undef HAVE_UNISCRIBE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_USP10_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WINDOWS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_XLOCALE_H */ - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "https://github.com/harfbuzz/harfbuzz/issues/new" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "HarfBuzz" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "HarfBuzz 2.6.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "harfbuzz" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "http://harfbuzz.org/" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.6.1" - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ diff --git a/native/linux/libHarfBuzzSharp/libHarfBuzzSharp.map b/native/linux/libHarfBuzzSharp/libHarfBuzzSharp.map new file mode 100644 index 0000000000..c695972de4 --- /dev/null +++ b/native/linux/libHarfBuzzSharp/libHarfBuzzSharp.map @@ -0,0 +1,6 @@ +libHarfBuzzSharp { + global: + hb_*; + local: + *; +}; diff --git a/native/linuxnodeps/build.cake b/native/linuxnodeps/build.cake index d52257ff7c..9095350451 100644 --- a/native/linuxnodeps/build.cake +++ b/native/linuxnodeps/build.cake @@ -1,24 +1,15 @@ 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") ?? "linuxnodeps"); -OUTPUT_PATH = OUTPUT_PATH.Combine(BUILD_VARIANT); - Task("libSkiaSharp") .WithCriteria(IsRunningOnLinux()) .Does(() => { RunCake("../linux/build.cake", "libSkiaSharp", new Dictionary { - { "variant", BUILD_VARIANT }, - { "gnArgs", "skia_use_fontconfig=false" }, + { "gnArgs", "skia_use_fontconfig=false " + ADDITIONAL_GN_ARGS }, + { "verifyExcluded", "fontconfig" }, }); - - 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") @@ -26,13 +17,9 @@ Task("libHarfBuzzSharp") .Does(() => { RunCake("../linux/build.cake", "libHarfBuzzSharp", new Dictionary { - { "variant", BUILD_VARIANT }, + { "gnArgs", ADDITIONAL_GN_ARGS }, + { "verifyExcluded", "fontconfig" }, }); - - 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") diff --git a/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec b/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec index 61159f62ea..91e368241a 100644 --- a/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec +++ b/nuget/HarfbuzzSharp.NativeAssets.Linux.nuspec @@ -44,6 +44,8 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release + + diff --git a/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec b/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec index ed3ec9ea18..bfcff4df5e 100644 --- a/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec +++ b/nuget/SkiaSharp.NativeAssets.Linux.NoDependencies.nuspec @@ -57,6 +57,8 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release + + diff --git a/nuget/SkiaSharp.NativeAssets.Linux.nuspec b/nuget/SkiaSharp.NativeAssets.Linux.nuspec index 4007d49b0f..9fd18cbd23 100644 --- a/nuget/SkiaSharp.NativeAssets.Linux.nuspec +++ b/nuget/SkiaSharp.NativeAssets.Linux.nuspec @@ -45,6 +45,8 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release + + diff --git a/scripts/Docker/alpine/amd64/Dockerfile b/scripts/Docker/alpine/amd64/Dockerfile index b17d01b623..697b475653 100644 --- a/scripts/Docker/alpine/amd64/Dockerfile +++ b/scripts/Docker/alpine/amd64/Dockerfile @@ -5,4 +5,6 @@ RUN apk add --no-cache samurai --repository http://dl-cdn.alpinelinux.org/alpine RUN apk add --no-cache mono clang gn --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing RUN cert-sync /etc/ssl/certs/ca-certificates.crt +ENV GN_EXE=gn NINJA_EXE=ninja + WORKDIR /work diff --git a/scripts/Docker/ubuntu16/amd64/Dockerfile b/scripts/Docker/ubuntu16/amd64/Dockerfile index 5f9c2a13f4..e54e50ca04 100644 --- a/scripts/Docker/ubuntu16/amd64/Dockerfile +++ b/scripts/Docker/ubuntu16/amd64/Dockerfile @@ -1,13 +1,13 @@ FROM amd64/ubuntu:16.04 RUN apt-get update \ - && apt-get install -y apt-transport-https curl wget \ + && apt-get install -y apt-transport-https curl wget python git make \ && 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 \ + && apt-get install -y mono-devel libfontconfig1-dev clang-10 \ && rm -rf /var/lib/apt/lists/* ENV CC=clang-10 CXX=clang++-10 diff --git a/scripts/Docker/ubuntu16/clang-cross/Dockerfile b/scripts/Docker/ubuntu16/clang-cross/Dockerfile new file mode 100644 index 0000000000..2967866bfa --- /dev/null +++ b/scripts/Docker/ubuntu16/clang-cross/Dockerfile @@ -0,0 +1,62 @@ +FROM amd64/ubuntu:16.04 + +# Arguments: +# MONO_VERSION - the version of mono for the Cake script [ 6.4.0 | * ] +# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 4.8 | * ] +# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu] +# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 ] +# FONTCONFIG_VERSION - the exact version of libfontconfig1 to use [ 2.11.0-6.7+b1 | * ] +# +# To build a arm64 image: +# --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64 + +# pre-requisites for building (python, git, mono) +ARG MONO_VERSION=6.4.0 +RUN apt-get update \ + && apt-get install -y apt-transport-https curl wget python git make \ + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ + && echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/${MONO_VERSION} 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-devel clang-10 \ + && rm -rf /var/lib/apt/lists/* + +# toolchain (gcc/g++) +ARG TOOLCHAIN_VERSION=4.8 +ARG TOOLCHAIN_ARCH=arm-linux-gnueabihf +ARG TOOLCHAIN_ARCH_SHORT=armhf +RUN apt-get update \ + && apt-get install -y \ + libstdc++-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \ + libgcc-${TOOLCHAIN_VERSION}-dev-${TOOLCHAIN_ARCH_SHORT}-cross \ + binutils-${TOOLCHAIN_ARCH} \ + && rm -rf /var/lib/apt/lists/* + +# make it easier for the build script +RUN ln -s /usr/${TOOLCHAIN_ARCH}/include/c++/${TOOLCHAIN_VERSION}.* /usr/${TOOLCHAIN_ARCH}/include/c++/current \ + && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libpthread.so \ + && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so + +# skia dependencies (fontconfig) +ARG FONTCONFIG_VERSION=2.11.0-6.7+b1 +RUN (mkdir -p /skia-utils/libfontconfig1-dev \ + && cd /skia-utils/libfontconfig1-dev \ + && wget -O libfontconfig1-dev.deb http://ftp.nl.debian.org/debian/pool/main/f/fontconfig/libfontconfig1-dev_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb \ + && ar vx libfontconfig1-dev.deb \ + && tar -xJvf data.tar.xz \ + && rm libfontconfig1-dev.deb \ + && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ \ + && cp -R usr/include/* /usr/${TOOLCHAIN_ARCH}/include/ ) +RUN (mkdir -p /skia-utils/libfontconfig1 \ + && cd /skia-utils/libfontconfig1 \ + && wget -O libfontconfig1.deb http://ftp.nl.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${TOOLCHAIN_ARCH_SHORT}.deb \ + && ar vx libfontconfig1.deb \ + && tar -xJvf data.tar.xz \ + && rm libfontconfig1.deb \ + && cp -R usr/lib/*/* /usr/${TOOLCHAIN_ARCH}/lib/ ) + +# container environment +ENV CC=clang-10 CXX=clang++-10 + +WORKDIR /work diff --git a/scripts/Docker/ubuntu16/gcc-cross/Dockerfile b/scripts/Docker/ubuntu16/gcc-cross/Dockerfile new file mode 100644 index 0000000000..37fa135162 --- /dev/null +++ b/scripts/Docker/ubuntu16/gcc-cross/Dockerfile @@ -0,0 +1,46 @@ +FROM amd64/ubuntu:16.04 + +ARG MONO_VERSION=6.4.0 +ARG TOOLCHAIN_VERSION=9.2-2019.12 +ARG TOOLCHAIN_ARCH=arm-none-linux-gnueabihf +ARG FONTCONFIG_VERSION=2.11.0-6.7+b1 +ARG FONTCONFIG_ARCH=armhf + +# pre-requisites for building (python, git, mono) +RUN apt-get update \ + && apt-get install -y apt-transport-https curl wget python git make \ + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ + && echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/${MONO_VERSION} main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ + && apt-get update \ + && apt-get install -y mono-devel \ + && rm -rf /var/lib/apt/lists/* + +# toolchain (gcc/g++) +RUN (mkdir -p /skia-utils/toolchain \ + && cd /skia-utils/toolchain \ + && wget -O toolchain.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/${TOOLCHAIN_VERSION}/binrel/gcc-arm-${TOOLCHAIN_VERSION}-x86_64-${TOOLCHAIN_ARCH}.tar.xz \ + && tar -xJvf toolchain.tar.xz \ + && mv gcc-arm-${TOOLCHAIN_VERSION}-x86_64-${TOOLCHAIN_ARCH} /opt/${TOOLCHAIN_ARCH}) + +# skia dependencies (fontconfig) +RUN (mkdir -p /skia-utils/libfontconfig1-dev \ + && cd /skia-utils/libfontconfig1-dev \ + && wget -O libfontconfig1-dev.deb http://ftp.nl.debian.org/debian/pool/main/f/fontconfig/libfontconfig1-dev_${FONTCONFIG_VERSION}_${FONTCONFIG_ARCH}.deb \ + && ar vx libfontconfig1-dev.deb \ + && tar -xJvf data.tar.xz \ + && cp -R usr/lib/*/* /opt/${TOOLCHAIN_ARCH}/${TOOLCHAIN_ARCH}/lib/ \ + && cp -R usr/include/* /opt/${TOOLCHAIN_ARCH}/${TOOLCHAIN_ARCH}/include/ ) +RUN (mkdir -p /skia-utils/libfontconfig1 \ + && cd /skia-utils/libfontconfig1 \ + && wget -O libfontconfig1.deb http://ftp.nl.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_${FONTCONFIG_VERSION}_${FONTCONFIG_ARCH}.deb \ + && ar vx libfontconfig1.deb \ + && tar -xJvf data.tar.xz \ + && cp -R usr/lib/*/* /opt/${TOOLCHAIN_ARCH}/${TOOLCHAIN_ARCH}/lib/ ) + +# container environment +ENV PATH="${PATH}:/opt/${TOOLCHAIN_ARCH}/bin" +ENV CC=${TOOLCHAIN_ARCH}-gcc \ + CXX=${TOOLCHAIN_ARCH}-g++ \ + AR=${TOOLCHAIN_ARCH}-gcc-ar + +WORKDIR /work diff --git a/scripts/Docker/wasm/Dockerfile b/scripts/Docker/wasm/Dockerfile index b1d998d39c..9e29022b40 100644 --- a/scripts/Docker/wasm/Dockerfile +++ b/scripts/Docker/wasm/Dockerfile @@ -3,11 +3,11 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201-bionic ARG EMSCRIPTEN_VERSION=1.39.11 RUN apt-get update \ - && apt-get install -y apt-transport-https curl wget \ + && apt-get install -y apt-transport-https curl wget python git make \ && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ && echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ && apt-get update \ - && apt-get install -y mono-complete msbuild python git \ + && apt-get install -y mono-devel \ && rm -rf /var/lib/apt/lists/* RUN git clone https://github.com/emscripten-core/emsdk ~/emsdk && \ diff --git a/scripts/azure-pipelines.yml b/scripts/azure-pipelines.yml index 93a60269c9..df09335723 100644 --- a/scripts/azure-pipelines.yml +++ b/scripts/azure-pipelines.yml @@ -55,248 +55,261 @@ stages: parameters: updateBuild: true - - stage: native - displayName: Build Native + - stage: native_windows + displayName: Native Windows dependsOn: prepare jobs: - # NATIVE JOBS - WINDOWS - - template: azure-templates-bootstrapper.yml # Build Native Android|x86 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Android|x86 (Win) parameters: name: native_android_x86_windows - displayName: Build Native Android|x86 (Windows) + displayName: Android x86 vmImage: $(VM_IMAGE_WINDOWS) target: externals-android additionalArgs: --buildarch=x86 - - template: azure-templates-bootstrapper.yml # Build Native Android|x64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Android|x64 (Win) parameters: name: native_android_x64_windows - displayName: Build Native Android|x64 (Windows) + displayName: Android x64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-android additionalArgs: --buildarch=x64 - - template: azure-templates-bootstrapper.yml # Build Native Android|arm (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Android|arm (Win) parameters: name: native_android_arm_windows - displayName: Build Native Android|arm (Windows) + displayName: Android arm vmImage: $(VM_IMAGE_WINDOWS) target: externals-android additionalArgs: --buildarch=arm - - template: azure-templates-bootstrapper.yml # Build Native Android|arm64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Android|arm64 (Win) parameters: name: native_android_arm64_windows - displayName: Build Native Android|arm64 (Windows) + displayName: Android arm64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-android additionalArgs: --buildarch=arm64 - - template: azure-templates-bootstrapper.yml # Build Native Tizen (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Tizen (Win) parameters: name: native_tizen_windows - displayName: Build Native Tizen (Windows) + displayName: Tizen vmImage: $(VM_IMAGE_WINDOWS) target: externals-tizen - - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|x86 (Windows) + - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|x86 (Win) parameters: name: native_uwp_angle_x86_windows - displayName: Build ANGLE UWP|x86 (Windows) + displayName: ANGLE x86 vmImage: $(VM_IMAGE_WINDOWS) target: ANGLE additionalArgs: -Script .\native\uwp\build.cake --buildarch=x86 - - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|x64 (Windows) + - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|x64 (Win) parameters: name: native_uwp_angle_x64_windows - displayName: Build ANGLE UWP|x64 (Windows) + displayName: ANGLE x64 vmImage: $(VM_IMAGE_WINDOWS) target: ANGLE additionalArgs: -Script .\native\uwp\build.cake --buildarch=x64 - - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|arm (Windows) + - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|arm (Win) parameters: name: native_uwp_angle_arm_windows - displayName: Build ANGLE UWP|arm (Windows) + displayName: ANGLE arm vmImage: $(VM_IMAGE_WINDOWS) target: ANGLE additionalArgs: -Script .\native\uwp\build.cake --buildarch=arm - - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|arm64 (Windows) + - template: azure-templates-bootstrapper.yml # Build ANGLE UWP|arm64 (Win) parameters: name: native_uwp_angle_arm64_windows - displayName: Build ANGLE UWP|arm64 (Windows) + displayName: ANGLE arm64 vmImage: $(VM_IMAGE_WINDOWS) target: ANGLE additionalArgs: -Script .\native\uwp\build.cake --buildarch=arm64 - - template: azure-templates-bootstrapper.yml # Build Native UWP|x86 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native UWP|x86 (Win) parameters: name: native_uwp_x86_windows - displayName: Build Native UWP|x86 (Windows) + displayName: UWP x86 vmImage: $(VM_IMAGE_WINDOWS) target: externals-uwp additionalArgs: --buildarch=x86 --skipAngle=true - - template: azure-templates-bootstrapper.yml # Build Native UWP|x64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native UWP|x64 (Win) parameters: name: native_uwp_x64_windows - displayName: Build Native UWP|x64 (Windows) + displayName: UWP x64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-uwp additionalArgs: --buildarch=x64 --skipAngle=true - - template: azure-templates-bootstrapper.yml # Build Native UWP|arm (Windows) + - template: azure-templates-bootstrapper.yml # Build Native UWP|arm (Win) parameters: name: native_uwp_arm_windows - displayName: Build Native UWP|arm (Windows) + displayName: UWP arm vmImage: $(VM_IMAGE_WINDOWS) target: externals-uwp additionalArgs: --buildarch=arm --skipAngle=true - - template: azure-templates-bootstrapper.yml # Build Native UWP|arm64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native UWP|arm64 (Win) parameters: name: native_uwp_arm64_windows - displayName: Build Native UWP|arm64 (Windows) + displayName: UWP arm64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-uwp additionalArgs: --buildarch=arm64 --skipAngle=true - - template: azure-templates-bootstrapper.yml # Build Native Win32|x86 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Win32|x86 (Win) parameters: name: native_win32_x86_windows - displayName: Build Native Win32|x86 (Windows) + displayName: Win32 x86 vmImage: $(VM_IMAGE_WINDOWS) target: externals-windows additionalArgs: --buildarch=x86 - - template: azure-templates-bootstrapper.yml # Build Native Win32|x64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Win32|x64 (Win) parameters: name: native_win32_x64_windows - displayName: Build Native Win32|x64 (Windows) + displayName: Win32 x64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-windows additionalArgs: --buildarch=x64 - - template: azure-templates-bootstrapper.yml # Build Native Win32|arm64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native Win32|arm64 (Win) parameters: name: native_win32_arm64_windows - displayName: Build Native Win32|arm64 (Windows) + displayName: Win32 arm64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-windows additionalArgs: --buildarch=arm64 - - template: azure-templates-bootstrapper.yml # Build Native NanoServer|x64 (Windows) + - template: azure-templates-bootstrapper.yml # Build Native NanoServer|x64 (Win) parameters: name: native_win32_x64_nanoserver_windows - displayName: Build Native NanoServer|x64 (Windows) + displayName: Nano Server x64 vmImage: $(VM_IMAGE_WINDOWS) target: externals-nanoserver additionalArgs: --buildarch=x64 tools: - nano-api-scan - # NATIVE JOBS - MAC + + - stage: native_macos + displayName: Native macOS + dependsOn: prepare + jobs: - template: azure-templates-bootstrapper.yml # Build Native Android|x86 (macOS) parameters: name: native_android_x86_macos - displayName: Build Native Android|x86 (macOS) + displayName: Android x86 vmImage: $(VM_IMAGE_MAC) target: externals-android additionalArgs: --buildarch=x86 - template: azure-templates-bootstrapper.yml # Build Native Android|x64 (macOS) parameters: name: native_android_x64_macos - displayName: Build Native Android|x64 (macOS) + displayName: Android x64 vmImage: $(VM_IMAGE_MAC) target: externals-android additionalArgs: --buildarch=x64 - template: azure-templates-bootstrapper.yml # Build Native Android|arm (macOS) parameters: name: native_android_arm_macos - displayName: Build Native Android|arm (macOS) + displayName: Android arm vmImage: $(VM_IMAGE_MAC) target: externals-android additionalArgs: --buildarch=arm - template: azure-templates-bootstrapper.yml # Build Native Android|arm64 (macOS) parameters: name: native_android_arm64_macos - displayName: Build Native Android|arm64 (macOS) + displayName: Android arm64 vmImage: $(VM_IMAGE_MAC) target: externals-android additionalArgs: --buildarch=arm64 - template: azure-templates-bootstrapper.yml # Build Native iOS (macOS) parameters: name: native_ios_macos - displayName: Build Native iOS (macOS) + displayName: iOS vmImage: $(VM_IMAGE_MAC) target: externals-ios - template: azure-templates-bootstrapper.yml # Build Native macOS (macOS) parameters: name: native_macos_macos - displayName: Build Native macOS (macOS) + displayName: macOS vmImage: $(VM_IMAGE_MAC) target: externals-macos - - template: azure-templates-bootstrapper.yml # Build Native Tizen (macOS) - parameters: - name: native_tizen_macos - displayName: Build Native Tizen (macOS) - vmImage: $(VM_IMAGE_MAC) - target: externals-tizen - condition: false # TODO: TIZEN INSTALL BUGS - template: azure-templates-bootstrapper.yml # Build Native tvOS (macOS) parameters: name: native_tvos_macos - displayName: Build Native tvOS (macOS) + displayName: tvOS vmImage: $(VM_IMAGE_MAC) target: externals-tvos - template: azure-templates-bootstrapper.yml # Build Native watchOS (macOS) parameters: name: native_watchos_macos - displayName: Build Native watchOS (macOS) + displayName: watchOS vmImage: $(VM_IMAGE_MAC) target: externals-watchos - # NATIVE JOBS - LINUX - - template: azure-templates-bootstrapper.yml # Build Native Linux (Linux) - parameters: - name: native_linux_linux - displayName: Build Native Linux (Linux) - vmImage: $(VM_IMAGE_LINUX) - docker: scripts/Docker/ubuntu16/amd64 - target: externals-linux - additionalArgs: --buildarch=x64 - - template: azure-templates-bootstrapper.yml # Build Native Linux [No Dependencies] (Linux) - parameters: - name: native_linux_nodependencies_linux - displayName: Build Native Linux [No Dependencies] (Linux) - vmImage: $(VM_IMAGE_LINUX) - docker: scripts/Docker/ubuntu16/amd64 - target: externals-linuxnodeps - additionalArgs: --buildarch=x64 - - template: azure-templates-bootstrapper.yml # Build Native Linux [Alpine] (Linux) - parameters: - name: native_linux_alpine_linux - displayName: Build Native Linux [Alpine] (Linux) - vmImage: $(VM_IMAGE_LINUX) - docker: scripts/Docker/alpine/amd64 - target: externals-linux - additionalArgs: --buildarch=x64 --gn=gn --ninja=ninja --variant=alpine - - template: azure-templates-bootstrapper.yml # Build Native Linux [Alpine, No Dependencies] (Linux) + - template: azure-templates-bootstrapper.yml # Build Native Tizen (macOS) parameters: - name: native_linux_alpinenodependencies_linux - displayName: Build Native Linux [Alpine, No Dependencies] (Linux) - vmImage: $(VM_IMAGE_LINUX) - docker: scripts/Docker/alpine/amd64 - target: externals-linuxnodeps - additionalArgs: --buildarch=x64 --gn=gn --ninja=ninja --variant=alpinenodeps + name: native_tizen_macos + displayName: Tizen + vmImage: $(VM_IMAGE_MAC) + target: externals-tizen + condition: false # TODO: TIZEN INSTALL BUGS + + - stage: native_linux + displayName: Native Linux + dependsOn: prepare + jobs: + - template: azure-templates-linux-matrix.yml # Build Native Linux (Linux) + parameters: + builds: + - name: '' + - name: nodeps + desc: 'No Deps' + additionalArgs: --verifyExcluded=fontconfig + gnArgs: skia_use_fontconfig=false + matrix: + - arch: x64 + docker: scripts/Docker/ubuntu16/amd64 + - arch: x64 + variant: alpine + docker: scripts/Docker/alpine/amd64 + - arch: arm + docker: scripts/Docker/ubuntu16/clang-cross + target: externals-linux-clang-cross + - arch: arm64 + docker: scripts/Docker/ubuntu16/clang-cross + dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64 + target: externals-linux-clang-cross + - arch: arm + docker: scripts/Docker/ubuntu16/gcc-cross + gnArgs: extra_cflags+=[ \'-Wno-psabi\' ] + alt: gcc + - arch: arm64 + docker: scripts/Docker/ubuntu16/gcc-cross + dockerArgs: --build-arg TOOLCHAIN_ARCH=aarch64-none-linux-gnu --build-arg FONTCONFIG_ARCH=arm64 + gnArgs: extra_cflags+=[ \'-Wno-psabi\' ] + alt: gcc - template: azure-templates-bootstrapper.yml # Build Native Tizen (Linux) parameters: name: native_tizen_linux - displayName: Build Native Tizen (Linux) + displayName: Tizen vmImage: $(VM_IMAGE_LINUX) packages: $(TIZEN_LINUX_PACKAGES) target: externals-tizen - # NATIVE JOBS - WASM + + - stage: native_wasm + displayName: Native WASM + dependsOn: prepare + jobs: - template: azure-templates-bootstrapper.yml # Build Native WASM (Linux) parameters: name: native_wasm_linux - displayName: Build Native WASM (Linux) + displayName: WASM vmImage: $(VM_IMAGE_LINUX) docker: scripts/Docker/wasm target: externals-wasm - stage: managed displayName: Build Managed - dependsOn: native + dependsOn: + - native_windows + - native_macos + - native_linux + - native_wasm jobs: - template: azure-templates-bootstrapper.yml # Build Managed (Windows) parameters: name: managed_windows - displayName: Build Managed (Windows) + displayName: Managed (Windows) vmImage: $(VM_IMAGE_WINDOWS) target: libs additionalArgs: --exclusive @@ -321,7 +334,7 @@ stages: - template: azure-templates-bootstrapper.yml # Build Managed (macOS) parameters: name: managed_macos - displayName: Build Managed (macOS) + displayName: Managed (macOS) vmImage: $(VM_IMAGE_MAC) target: libs additionalArgs: --exclusive @@ -339,16 +352,20 @@ stages: - template: azure-templates-bootstrapper.yml # Build Managed (Linux) parameters: name: managed_linux - displayName: Build Managed (Linux) + displayName: Managed (Linux) vmImage: $(VM_IMAGE_LINUX) packages: $(MANAGED_LINUX_PACKAGES) target: libs additionalArgs: --exclusive requiredArtifacts: - - native_linux_linux - - native_linux_nodependencies_linux - - native_linux_alpinenodependencies_linux - - native_linux_alpine_linux + - native_linux_x64_linux + - native_linux_arm_linux + - native_linux_arm64_linux + - native_linux_x64_nodeps_linux + - native_linux_arm_nodeps_linux + - native_linux_arm64_nodeps_linux + - native_linux_x64_alpine_linux + - native_linux_x64_alpine_nodeps_linux - native_tizen_linux - stage: package @@ -420,13 +437,17 @@ stages: additionalConditions: eq(variables['Build.SourceBranch'], 'refs/heads/master') - stage: tests - displayName: Run Tests - dependsOn: native + displayName: Tests + dependsOn: + - native_windows + - native_macos + - native_linux + - native_wasm jobs: - template: azure-templates-bootstrapper.yml # Tests (Windows) parameters: name: tests_windows - displayName: Tests (Windows) + displayName: Windows vmImage: $(VM_IMAGE_WINDOWS) target: tests additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=$(ENABLE_CODE_COVERAGE) @@ -434,8 +455,6 @@ stages: requiredArtifacts: - native_win32_x86_windows - native_win32_x64_windows - - native_win32_arm64_windows - - native_win32_x64_nanoserver_windows tools: - dotnet-reportgenerator-globaltool postBuildSteps: @@ -461,7 +480,7 @@ stages: - template: azure-templates-bootstrapper.yml # Tests (macOS) parameters: name: tests_macos - displayName: Tests (macOS) + displayName: macOS vmImage: $(VM_IMAGE_MAC) target: tests additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=$(ENABLE_CODE_COVERAGE) @@ -493,17 +512,14 @@ stages: - template: azure-templates-bootstrapper.yml # Tests (Linux) parameters: name: tests_linux - displayName: Tests (Linux) + displayName: Linux vmImage: $(VM_IMAGE_LINUX) packages: $(MANAGED_LINUX_PACKAGES) target: tests additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=$(ENABLE_CODE_COVERAGE) shouldPublish: false requiredArtifacts: - - native_linux_linux - - native_linux_nodependencies_linux - - native_linux_alpinenodependencies_linux - - native_linux_alpine_linux + - native_linux_x64_linux tools: - dotnet-reportgenerator-globaltool postBuildSteps: @@ -529,7 +545,7 @@ stages: - template: azure-templates-bootstrapper.yml # Tests [WASM] (Linux) parameters: name: tests_wasm_linux - displayName: Tests [WASM] (Linux) + displayName: WASM (Linux) vmImage: $(VM_IMAGE_LINUX) packages: $(MANAGED_LINUX_PACKAGES) ninja-build target: tests-wasm @@ -586,13 +602,13 @@ stages: summaryFileLocation: 'output/**/Cobertura.xml' - stage: samples - displayName: Build Samples + displayName: Samples dependsOn: package jobs: - template: azure-templates-bootstrapper.yml # Build Samples (Windows) parameters: name: samples_windows - displayName: Build Samples (Windows) + displayName: Windows vmImage: $(VM_IMAGE_WINDOWS) target: samples shouldPublish: false @@ -606,7 +622,7 @@ stages: - template: azure-templates-bootstrapper.yml # Build Samples (macOS) parameters: name: samples_macos - displayName: Build Samples (macOS) + displayName: macOS vmImage: $(VM_IMAGE_MAC) target: samples shouldPublish: false @@ -635,7 +651,7 @@ stages: - template: azure-templates-bootstrapper.yml # Build Samples (Linux) parameters: name: samples_linux - displayName: Build Samples (Linux) + displayName: Linux vmImage: $(VM_IMAGE_LINUX) packages: $(MANAGED_LINUX_PACKAGES) target: samples diff --git a/scripts/azure-templates-bootstrapper.yml b/scripts/azure-templates-bootstrapper.yml index 8b4bb6cd1f..9b5bb2b732 100644 --- a/scripts/azure-templates-bootstrapper.yml +++ b/scripts/azure-templates-bootstrapper.yml @@ -18,6 +18,7 @@ parameters: buildExternals: '' # the build number to download externals from verbosity: $(VERBOSITY) # the level of verbosity to use when building docker: '' # the Docker image to build and use + dockerArgs: '' # any additional arguments to pass to docker build jobs: # - ${{ if and(ne(parameters.buildExternals, ''), startsWith(parameters.name, 'native_')) }}: @@ -159,7 +160,7 @@ jobs: JavaSdkDirectory: $(JAVA_HOME) displayName: Run the bootstrapper for ${{ parameters.target }} - ${{ if ne(parameters.docker, '') }}: - - bash: docker build --tag skiasharp . + - bash: docker build --tag skiasharp ${{ parameters.dockerArgs }} . workingDirectory: ${{ parameters.docker }} displayName: Build the Docker image for ${{ parameters.docker }} - bash: | diff --git a/scripts/azure-templates-linux-matrix.yml b/scripts/azure-templates-linux-matrix.yml new file mode 100644 index 0000000000..50826bc2e9 --- /dev/null +++ b/scripts/azure-templates-linux-matrix.yml @@ -0,0 +1,27 @@ +parameters: + builds: + - name: '' + desc: '' + additionalArgs: '' + gnArgs: '' + matrix: + - arch: '' + variant: '' + docker: '' + dockerArgs: '' + target: '' + gnArgs: '' + alt: '' + +jobs: + - ${{ each build in parameters.builds }}: + - ${{ each item in parameters.matrix }}: + - template: azure-templates-bootstrapper.yml + parameters: + name: ${{ replace(replace(format('native_linux_{0}_{1}_{2}_{3}_linux', item.arch, item.variant, build.name, item.alt), '__', '_'), '__', '_') }} + displayName: Linux ${{ replace(replace(replace(replace(replace(format('({0}|{1}|{2}|{3})', item.arch, item.variant, build.name, item.alt), '||', '|'), '||', '|'), '(|', '('), '|)', ')'), '|', ', ') }} + vmImage: $(VM_IMAGE_LINUX) + docker: ${{ item.docker }} + dockerArgs: ${{ item.dockerArgs }} + target: ${{ coalesce(item.target, 'externals-linux') }} + additionalArgs: --buildarch=${{ item.arch }} --variant=${{ coalesce(item.variant, 'linux') }}${{ build.name }} ${{ build.additionalArgs }} ${{ item.additionalArgs }} diff --git a/utils/NativeLibraryMiniTest/docker/.gitignore b/utils/NativeLibraryMiniTest/docker/.gitignore new file mode 100644 index 0000000000..eef52883d8 --- /dev/null +++ b/utils/NativeLibraryMiniTest/docker/.gitignore @@ -0,0 +1 @@ +source/ diff --git a/utils/NativeLibraryMiniTest/docker/Dockerfile b/utils/NativeLibraryMiniTest/docker/Dockerfile new file mode 100644 index 0000000000..65f547c94a --- /dev/null +++ b/utils/NativeLibraryMiniTest/docker/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build +WORKDIR /app +COPY source . +RUN dotnet publish -c Release -o /app/out -r linux-arm + +FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim-arm32v7 +RUN apt-get update \ + && apt-get install -y --no-install-recommends libfontconfig1 \ + && rm -rf /var/lib/apt/lists/* +WORKDIR /app +COPY --from=build /app/out . +ENTRYPOINT [ "./NativeLibraryMiniTest" ] diff --git a/utils/NativeLibraryMiniTest/docker/NativeLibraryMiniTest.csproj b/utils/NativeLibraryMiniTest/docker/NativeLibraryMiniTest.csproj new file mode 100644 index 0000000000..21aa313d61 --- /dev/null +++ b/utils/NativeLibraryMiniTest/docker/NativeLibraryMiniTest.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp3.1 + True + + + + + + + \ No newline at end of file diff --git a/utils/NativeLibraryMiniTest/docker/build.sh b/utils/NativeLibraryMiniTest/docker/build.sh new file mode 100755 index 0000000000..2470eb0183 --- /dev/null +++ b/utils/NativeLibraryMiniTest/docker/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +mkdir -p $DIR/source +cp -R $DIR/../source/* $DIR/source/ +cp -R $DIR/NativeLibraryMiniTest.csproj $DIR/source/ +cp -R $DIR/nuget.config $DIR/source/ +cp -R $DIR/../../../output/native/linux/arm/libSkiaSharp.so $DIR/source/ + +(cd $DIR && docker build --tag skiasharp/minitest .) +(cd $DIR && docker run --rm skiasharp/minitest) diff --git a/utils/NativeLibraryMiniTest/docker/nuget.config b/utils/NativeLibraryMiniTest/docker/nuget.config new file mode 100644 index 0000000000..b2a3df49f8 --- /dev/null +++ b/utils/NativeLibraryMiniTest/docker/nuget.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/utils/NativeLibraryMiniTest/source/Program.cs b/utils/NativeLibraryMiniTest/source/Program.cs index 0a708704cc..26aef70ef9 100644 --- a/utils/NativeLibraryMiniTest/source/Program.cs +++ b/utils/NativeLibraryMiniTest/source/Program.cs @@ -13,6 +13,9 @@ unsafe class Program { static int Main() { Console.WriteLine("Starting test..."); + Console.WriteLine($"OS = {RuntimeInformation.OSDescription}"); + Console.WriteLine($"OS Arch = {RuntimeInformation.OSArchitecture}"); + Console.WriteLine($"Proc Arch = {RuntimeInformation.ProcessArchitecture}"); Console.WriteLine("Version test..."); Console.WriteLine($"sk_version_get_milestone() = {sk_version_get_milestone()}"); @@ -49,7 +52,6 @@ static int Main() { } [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.LPStr)] static extern void* sk_version_get_string(); [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]