Skip to content

Commit

Permalink
feat: Update to mono master latest
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Mar 13, 2020
1 parent ceacaac commit 5df9be6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 30 deletions.
6 changes: 2 additions & 4 deletions .vsts-ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
EMSCRIPTEN_VERSION: 1.39.7
EMSCRIPTEN_VERSION: 1.39.9
NETCORE_VERSION: ${{ parameters.netcore_version }}

steps:
Expand Down Expand Up @@ -60,10 +60,8 @@ jobs:
- bash: |
cd ~/emsdk
wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/emscripten-pr-8457.diff
wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/fix-emscripten-8511.diff
wget https://raw.githubusercontent.com/mono/mono/b777471fcace85325e2c2af0e460f4ecd8059b5a/sdks/builds/fix-emscripten-8511.diff
cd ~/emsdk/upstream/emscripten
patch -N -p1 < ~/emsdk/emscripten-pr-8457.diff
patch -N -p1 < ~/emsdk/fix-emscripten-8511.diff
displayName: 'Apply Emscripten Mono patches'
Expand Down
6 changes: 3 additions & 3 deletions build/gitpod/build-all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
export EMSCRIPTEN_VERSION=1.38.48-upstream
export EMSCRIPTEN_VERSION=1.39.7
export NUGET_PACKAGES=/workspace/.nuget

cd ~
Expand All @@ -9,8 +9,8 @@ echo Installing emscripten $EMSCRIPTEN_VERSION
./emsdk install $EMSCRIPTEN_VERSION
./emsdk activate $EMSCRIPTEN_VERSION

wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/emscripten-pr-8457.diff
wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/fix-emscripten-8511.diff
wget https://raw.githubusercontent.com/mono/mono/b777471fcace85325e2c2af0e460f4ecd8059b5a/sdks/builds/emscripten-pr-8457.diff
wget https://raw.githubusercontent.com/mono/mono/b777471fcace85325e2c2af0e460f4ecd8059b5a/sdks/builds/fix-emscripten-8511.diff

# apply patches
cd upstream/emscripten
Expand Down
6 changes: 3 additions & 3 deletions src/Uno.Wasm.Bootstrap/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Uno.Wasm.Bootstrap
internal class Constants
{
// NOTE: The SDK version may be overriden by an installation of the https://www.nuget.org/packages/Uno.Wasm.MonoRuntime nuget package
public const string DefaultSdkUrl = @"https://unowasmbootstrap.blob.core.windows.net/runtime/mono-wasm-91e026de9db.zip";
public const string DefaultAotSDKUrl = "https://unowasmbootstrap.blob.core.windows.net/runtime/mono-wasm-91e026de9db.aot.zip";
public const string DefaultSdkUrl = @"https://unowasmbootstrap.blob.core.windows.net/runtime/mono-wasm-b777471fcac.zip";
public const string DefaultAotSDKUrl = "https://unowasmbootstrap.blob.core.windows.net/runtime/wasm-release-Linux-b777471fcace85325e2c2af0e460f4ecd8059b5a.zip";

/// <summary>
/// Min version of the emscripten SDK. Must be aligned with mono's SDK build in <see cref="DefaultAotSDKUrl"/>.
Expand All @@ -17,6 +17,6 @@ internal class Constants
/// The emscripten version use by mono can be found here:
/// https://github.com/mono/mono/blob/master/sdks/builds/wasm.mk#L4
/// </remarks>
public static Version EmscriptenMinVersion { get; } = new Version("1.39.7");
public static Version EmscriptenMinVersion { get; } = new Version("1.39.9");
}
}
49 changes: 32 additions & 17 deletions src/Uno.Wasm.Bootstrap/Packager/packager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ class WasmOptions {
public bool NativeStrip;
public bool Simd;
public bool EnableDynamicRuntime;
public bool LinkerExcludeDeserialization;
}

int Run (string[] args) {
Expand Down Expand Up @@ -422,22 +423,24 @@ int Run (string[] args) {
var netcore_sdkdir = "";
string coremode, usermode;
string aot_profile = null;
string wasm_runtime_path = null;
var runtime_config = "release";
string extra_emccflags = "";

var opts = new WasmOptions () {
AddBinding = true,
Debug = false,
DebugRuntime = false,
Linker = false,
ILStrip = true,
LinkerVerbose = false,
EnableZLib = false,
EnableFS = false,
NativeStrip = true,
Simd = false,
EnableDynamicRuntime = false
};
AddBinding = true,
Debug = false,
DebugRuntime = false,
Linker = false,
ILStrip = true,
LinkerVerbose = false,
EnableZLib = false,
EnableFS = false,
NativeStrip = true,
Simd = false,
EnableDynamicRuntime = false,
LinkerExcludeDeserialization = true
};

var p = new OptionSet () {
{ "nobinding", s => opts.AddBinding = false },
Expand All @@ -448,6 +451,7 @@ int Run (string[] args) {
{ "emscripten-sdkdir=", s => emscripten_sdkdir = s },
{ "netcore-sdkdir=", s => netcore_sdkdir = s },
{ "prefix=", s => app_prefix = s },
{ "wasm-runtime-path=", s => wasm_runtime_path = s },
{ "deploy=", s => deploy_prefix = s },
{ "vfs=", s => vfs_prefix = s },
{ "aot", s => ee_mode = ExecMode.Aot },
Expand Down Expand Up @@ -485,6 +489,7 @@ int Run (string[] args) {
AddFlag (p, new BoolFlag ("dynamic-runtime", "enable dynamic runtime (support for Emscripten's dlopen)", opts.EnableDynamicRuntime, b => opts.EnableDynamicRuntime = b));
AddFlag (p, new BoolFlag ("native-strip", "strip final executable", opts.NativeStrip, b => opts.NativeStrip = b));
AddFlag (p, new BoolFlag ("simd", "enable SIMD support", opts.Simd, b => opts.Simd = b));
AddFlag (p, new BoolFlag ("linker-exclude-deserialization", "Link out .NET deserialization support", opts.LinkerExcludeDeserialization, b => opts.LinkerExcludeDeserialization = b));

var new_args = p.Parse (args).ToArray ();
foreach (var a in new_args) {
Expand Down Expand Up @@ -618,6 +623,11 @@ int Run (string[] args) {
return 1;
}

if (enable_simd && !is_netcore) {
Console.Error.WriteLine ("--simd is only supported with netcore.");
return 1;
}

var tool_prefix = Path.GetDirectoryName (typeof (Driver).Assembly.Location);

//are we working from the tree?
Expand Down Expand Up @@ -766,16 +776,19 @@ int Run (string[] args) {
File.Delete (config_js);
File.WriteAllText (config_js, config);


if (wasm_runtime_path == null)
wasm_runtime_path = Path.Combine (tool_prefix, "builds");

string wasm_runtime_dir;
if (is_netcore)
wasm_runtime_dir = Path.Combine (tool_prefix, "builds", use_release_runtime ? "netcore-release" : "netcore-debug");
wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "netcore-release" : "netcore-debug");
else if (enable_threads)
wasm_runtime_dir = Path.Combine (tool_prefix, "builds", use_release_runtime ? "threads-release" : "threads-debug");
wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "threads-release" : "threads-debug");
else if (enable_dynamic_runtime)
wasm_runtime_dir = Path.Combine (tool_prefix, "builds", use_release_runtime ? "dynamic-release" : "dynamic-debug");
wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "dynamic-release" : "dynamic-debug");
else
wasm_runtime_dir = Path.Combine (tool_prefix, "builds", use_release_runtime ? "release" : "debug");

wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "release" : "debug");
if (!emit_ninja) {
var interp_files = new List<string> { "dotnet.js", "dotnet.wasm" };
if (enable_threads) {
Expand Down Expand Up @@ -1189,6 +1202,8 @@ int Run (string[] args) {
linker_args += "--used-attrs-only true ";
linker_args += "--substitutions linker-subs.xml ";
linker_infiles += "| linker-subs.xml";
if (opts.LinkerExcludeDeserialization)
linker_args += "--exclude-feature deserialization ";
if (!string.IsNullOrEmpty (linkDescriptor)) {
linker_args += $"-x {linkDescriptor} ";
foreach (var assembly in root_assemblies) {
Expand Down
4 changes: 1 addition & 3 deletions src/Uno.Wasm.Bootstrap/build/scripts/emscripten-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ if [ ! -f .uno-install-done ]; then
./emsdk activate --embedded $UNO_EMSDK_VERSION

# Those two files need to follow the currently used build of mono
wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/emscripten-pr-8457.diff 2>&1
wget https://raw.githubusercontent.com/mono/mono/27247739c68faee7b2a63ae805222d4b375d2161/sdks/builds/fix-emscripten-8511.diff 2>&1
wget https://raw.githubusercontent.com/mono/mono/b777471fcace85325e2c2af0e460f4ecd8059b5a/sdks/builds/fix-emscripten-8511.diff 2>&1

pushd upstream/emscripten
patch -N -p1 < ../../emscripten-pr-8457.diff
patch -N -p1 < ../../fix-emscripten-8511.diff
popd

Expand Down

0 comments on commit 5df9be6

Please sign in to comment.