2016-06-12 22:34:50 +00:00
|
|
|
{ pkgs }:
|
|
|
|
|
|
|
|
# emscripten toolchain abstraction for nix
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/16208
|
|
|
|
|
|
|
|
with pkgs; rec {
|
|
|
|
json_c = pkgs.json_c.override {
|
|
|
|
stdenv = emscriptenStdenv;
|
|
|
|
};
|
|
|
|
|
|
|
|
libxml2 = (pkgs.libxml2.override {
|
|
|
|
stdenv = emscriptenStdenv;
|
2016-11-08 09:55:21 +00:00
|
|
|
pythonSupport = false;
|
2016-06-12 22:34:50 +00:00
|
|
|
}).overrideDerivation
|
|
|
|
(old: {
|
2017-09-05 22:03:42 +00:00
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ autoreconfHook pkgconfig ];
|
2017-09-05 21:26:13 +00:00
|
|
|
buildInputs = old.buildInputs ++ [ zlib nodejs ];
|
2016-06-12 22:34:50 +00:00
|
|
|
# just override it with nothing so it does not fail
|
|
|
|
autoreconfPhase = "echo autoreconfPhase not used...";
|
|
|
|
checkPhase = ''
|
|
|
|
echo "================= testing xmllint using node ================="
|
|
|
|
emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 xmllint.o \
|
|
|
|
./.libs/libxml2.a `pkg-config zlib --cflags` `pkg-config zlib --libs` -o ./xmllint.test.js \
|
|
|
|
--embed-file ./test/xmlid/id_err1.xml
|
|
|
|
# test/xmlid/id_err2.xml:3: validity error : xml:id : attribute type should be ID
|
|
|
|
# <!ATTLIST foo xml:id CDATA #IMPLIED>
|
|
|
|
# ^
|
|
|
|
node ./xmllint.test.js --noout test/xmlid/id_err1.xml 2>&1 | grep 0bar
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "xmllint unit test failed, please fix this package"
|
|
|
|
exit 1;
|
|
|
|
else
|
|
|
|
echo "since there is no stupid text containing 'foo xml:id' it seems to work! very good."
|
|
|
|
fi
|
|
|
|
echo "================= /testing xmllint using node ================="
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
xmlmirror = buildEmscriptenPackage rec {
|
|
|
|
name = "xmlmirror";
|
|
|
|
|
2017-09-05 21:26:13 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ autoconf automake libtool gnumake libxml2 nodejs
|
2016-06-12 22:34:50 +00:00
|
|
|
python openjdk json_c zlib ];
|
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://gitlab.com/odfplugfest/xmlmirror.git";
|
|
|
|
rev = "4fd7e86f7c9526b8f4c1733e5c8b45175860a8fd";
|
|
|
|
sha256 = "1jasdqnbdnb83wbcnyrp32f36w3xwhwp0wq8lwwmhqagxrij1r4b";
|
|
|
|
};
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
rm -f fastXmlLint.js*
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
HOME=$TMPDIR
|
|
|
|
make -f Makefile.emEnv
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share
|
2016-08-29 21:08:46 +00:00
|
|
|
mkdir -p $doc/share/${name}
|
2016-06-12 22:34:50 +00:00
|
|
|
|
|
|
|
cp Demo* $out/share
|
|
|
|
cp -R codemirror-5.12 $out/share
|
|
|
|
cp fastXmlLint.js* $out/share
|
|
|
|
cp *.xsd $out/share
|
|
|
|
cp *.js $out/share
|
|
|
|
cp *.xhtml $out/share
|
|
|
|
cp *.html $out/share
|
|
|
|
cp *.json $out/share
|
|
|
|
cp *.rng $out/share
|
2016-08-29 21:08:46 +00:00
|
|
|
cp README.md $doc/share/${name}
|
2016-06-12 22:34:50 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
zlib = (pkgs.zlib.override {
|
|
|
|
stdenv = emscriptenStdenv;
|
|
|
|
}).overrideDerivation
|
|
|
|
(old: {
|
|
|
|
configurePhase = ''
|
|
|
|
# FIXME: Some tests require writing at $HOME
|
|
|
|
HOME=$TMPDIR
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
emconfigure ./configure --prefix=$out
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace configure \
|
|
|
|
--replace '/usr/bin/libtool' 'ar' \
|
|
|
|
--replace 'AR="libtool"' 'AR="ar"' \
|
|
|
|
--replace 'ARFLAGS="-o"' 'ARFLAGS="-r"'
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|