1{ pkgs, lib, emscripten }:
2
3{ buildInputs ? [], nativeBuildInputs ? []
4
5, enableParallelBuilding ? true
6
7, meta ? {}, ... } @ args:
8
9pkgs.stdenv.mkDerivation (
10 args //
11 {
12
13 name = "emscripten-${args.name}";
14 buildInputs = [ emscripten ] ++ buildInputs;
15 nativeBuildInputs = [ emscripten ] ++ nativeBuildInputs;
16
17 # fake conftest results with emscripten's python magic
18 EMCONFIGURE_JS=2;
19
20 configurePhase = args.configurePhase or ''
21 # FIXME: Some tests require writing at $HOME
22 HOME=$TMPDIR
23 runHook preConfigure
24
25 # probably requires autotools as dependency
26 ./autogen.sh
27 emconfigure ./configure --prefix=$out
28
29 runHook postConfigure
30 '';
31
32 buildPhase = args.buildPhase or ''
33 runHook preBuild
34
35 HOME=$TMPDIR
36 emmake make
37
38 runHook postBuild
39 '';
40
41 checkPhase = args.checkPhase or ''
42 runHook preCheck
43
44 runHook postCheck
45 '';
46
47 enableParallelBuilding = args.enableParallelBuilding or true;
48
49 meta = {
50 # Add default meta information
51 platforms = lib.platforms.all;
52 # Do not build this automatically
53 hydraPlatforms = [];
54 } // meta // {
55 # add an extra maintainer to every package
56 maintainers = (meta.maintainers or []) ++
57 [ lib.maintainers.qknight ];
58 };
59})