emscripten: use matching binaryen version (#37427)

This changes the emscripten package so that it specifies the rev from
the binaryen repo to use, and sets it to always use the version that has
been tagged for use with that version of emscripten.  This should force
future updates of emscripten to also update binaryen.

Binaryen can also be installed as a stand-alone package, so there's some
logic added to the binaryen package to allow building in both ways, and
distinguishing between them.
This commit is contained in:
Alastair Pharo 2018-03-21 01:45:19 +11:00 committed by Joachim Schiele
parent 06828573e7
commit 497e50cf16
2 changed files with 23 additions and 5 deletions

View File

@ -1,14 +1,31 @@
{ stdenv, cmake, fetchFromGitHub }:
{ stdenv, cmake, fetchFromGitHub, emscriptenRev ? null }:
let
defaultVersion = "44";
# Map from git revs to SHA256 hashes
sha256s = {
"version_44" = "0zsqppc05fm62807w6vyccxkk2y2gar7kxbxxixq8zz3xsp6w84p";
"1.37.36" = "1wgzfzjjzkiaz0rf2lnwrcvlcsjvjhyvbyh58jxhqq43vi34zyjc";
};
in
stdenv.mkDerivation rec {
version = "44";
rev = "version_${version}";
version = if emscriptenRev == null
then defaultVersion
else "emscripten-${emscriptenRev}";
rev = if emscriptenRev == null
then "version_${version}"
else emscriptenRev;
name = "binaryen-${version}";
src = fetchFromGitHub {
owner = "WebAssembly";
repo = "binaryen";
sha256 = "0zsqppc05fm62807w6vyccxkk2y2gar7kxbxxixq8zz3xsp6w84p";
sha256 =
if builtins.hasAttr rev sha256s
then builtins.getAttr rev sha256s
else null;
inherit rev;
};

View File

@ -5,6 +5,7 @@
let
rev = emscriptenVersion;
appdir = "share/emscripten";
binaryenVersioned = binaryen.override { emscriptenRev = rev; };
in
stdenv.mkDerivation {
@ -44,7 +45,7 @@ stdenv.mkDerivation {
echo "SPIDERMONKEY_ENGINE = []" >> $out/${appdir}/config
''
+ stdenv.lib.optionalString enableWasm ''
echo "BINARYEN_ROOT = '${binaryen}'" >> $out/share/emscripten/config
echo "BINARYEN_ROOT = '${binaryenVersioned}'" >> $out/share/emscripten/config
''
+
''