Merge pull request #172207 from willcohen/emscripten-fix
emscriptenStdenv: create writable cache directory
This commit is contained in:
commit
749c2d5b72
@ -1,4 +1,4 @@
|
|||||||
{ pkgs, lib, emscripten, python2 }:
|
{ pkgs, lib, emscripten, python3 }:
|
||||||
|
|
||||||
{ buildInputs ? [], nativeBuildInputs ? []
|
{ buildInputs ? [], nativeBuildInputs ? []
|
||||||
|
|
||||||
@ -12,8 +12,8 @@ pkgs.stdenv.mkDerivation (
|
|||||||
|
|
||||||
pname = "emscripten-${lib.getName args}";
|
pname = "emscripten-${lib.getName args}";
|
||||||
version = lib.getVersion args;
|
version = lib.getVersion args;
|
||||||
buildInputs = [ emscripten python2 ] ++ buildInputs;
|
buildInputs = [ emscripten python3 ] ++ buildInputs;
|
||||||
nativeBuildInputs = [ emscripten python2 ] ++ nativeBuildInputs;
|
nativeBuildInputs = [ emscripten python3 ] ++ nativeBuildInputs;
|
||||||
|
|
||||||
# fake conftest results with emscripten's python magic
|
# fake conftest results with emscripten's python magic
|
||||||
EMCONFIGURE_JS=2;
|
EMCONFIGURE_JS=2;
|
||||||
@ -25,6 +25,9 @@ pkgs.stdenv.mkDerivation (
|
|||||||
|
|
||||||
emconfigure ./configure --prefix=$out
|
emconfigure ./configure --prefix=$out
|
||||||
|
|
||||||
|
mkdir -p .emscriptencache
|
||||||
|
export EM_CACHE=$(pwd)/.emscriptencache
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -32,6 +35,7 @@ pkgs.stdenv.mkDerivation (
|
|||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
HOME=$TMPDIR
|
HOME=$TMPDIR
|
||||||
|
|
||||||
emmake make
|
emmake make
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
|
@ -14,6 +14,8 @@ rec {
|
|||||||
propagatedBuildInputs = [ zlib ];
|
propagatedBuildInputs = [ zlib ];
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
HOME=$TMPDIR
|
HOME=$TMPDIR
|
||||||
|
mkdir -p .emscriptencache
|
||||||
|
export EM_CACHE=$(pwd)/.emscriptencache
|
||||||
emcmake cmake . $cmakeFlags -DCMAKE_INSTALL_PREFIX=$out -DCMAKE_INSTALL_INCLUDEDIR=$dev/include
|
emcmake cmake . $cmakeFlags -DCMAKE_INSTALL_PREFIX=$out -DCMAKE_INSTALL_INCLUDEDIR=$dev/include
|
||||||
'';
|
'';
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
@ -54,6 +56,8 @@ rec {
|
|||||||
autoreconfPhase = "echo autoreconfPhase not used...";
|
autoreconfPhase = "echo autoreconfPhase not used...";
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
HOME=$TMPDIR
|
HOME=$TMPDIR
|
||||||
|
mkdir -p .emscriptencache
|
||||||
|
export EM_CACHE=$(pwd)/.emscriptencache
|
||||||
emconfigure ./configure --prefix=$out --without-python
|
emconfigure ./configure --prefix=$out --without-python
|
||||||
'';
|
'';
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
@ -102,6 +106,8 @@ rec {
|
|||||||
sed -e "s/\$(JSONC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(LIBXML20_LDFLAGS)/\$(JSONC_LDFLAGS) \$(LIBXML20_LDFLAGS) \$(ZLIB_LDFLAGS) /g" -i Makefile.emEnv
|
sed -e "s/\$(JSONC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(LIBXML20_LDFLAGS)/\$(JSONC_LDFLAGS) \$(LIBXML20_LDFLAGS) \$(ZLIB_LDFLAGS) /g" -i Makefile.emEnv
|
||||||
# https://gitlab.com/odfplugfest/xmlmirror/issues/11
|
# https://gitlab.com/odfplugfest/xmlmirror/issues/11
|
||||||
sed -e "s/-o fastXmlLint.js/-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -o fastXmlLint.js/g" -i Makefile.emEnv
|
sed -e "s/-o fastXmlLint.js/-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -o fastXmlLint.js/g" -i Makefile.emEnv
|
||||||
|
mkdir -p .emscriptencache
|
||||||
|
export EM_CACHE=$(pwd)/.emscriptencache
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@ -137,16 +143,6 @@ rec {
|
|||||||
buildInputs = old.buildInputs ++ [ pkg-config ];
|
buildInputs = old.buildInputs ++ [ pkg-config ];
|
||||||
# we need to reset this setting!
|
# we need to reset this setting!
|
||||||
NIX_CFLAGS_COMPILE="";
|
NIX_CFLAGS_COMPILE="";
|
||||||
configurePhase = ''
|
|
||||||
# FIXME: Some tests require writing at $HOME
|
|
||||||
HOME=$TMPDIR
|
|
||||||
runHook preConfigure
|
|
||||||
|
|
||||||
#export EMCC_DEBUG=2
|
|
||||||
emconfigure ./configure --prefix=$out --shared
|
|
||||||
|
|
||||||
runHook postConfigure
|
|
||||||
'';
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@ -161,7 +157,7 @@ rec {
|
|||||||
echo "Compiling a custom test"
|
echo "Compiling a custom test"
|
||||||
set -x
|
set -x
|
||||||
emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 test/example.c -DZ_SOLO \
|
emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 test/example.c -DZ_SOLO \
|
||||||
-L. libz.so.${old.version} -I . -o example.js
|
-L. libz.a -I . -o example.js
|
||||||
|
|
||||||
echo "Using node to execute the test"
|
echo "Using node to execute the test"
|
||||||
${pkgs.nodejs}/bin/node ./example.js
|
${pkgs.nodejs}/bin/node ./example.js
|
||||||
|
Loading…
Reference in New Issue
Block a user