summary refs log tree commit diff
path: root/pkgs/development/em-modules/generic/default.nix
blob: 16b8f1df595e915f9a5c6b4c2052894c19d844f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ pkgs, lib, emscripten }:

{ buildInputs ? [], nativeBuildInputs ? []

, enableParallelBuilding ? true

, meta ? {}, ... } @ args:

pkgs.stdenv.mkDerivation (
  args // 
  {

  name = "emscripten-${args.name}";
  buildInputs = [ emscripten ] ++ buildInputs;
  nativeBuildInputs = [ emscripten ] ++ nativeBuildInputs;

  # fake conftest results with emscripten's python magic
  EMCONFIGURE_JS=2;

  configurePhase = args.configurePhase or ''
    # FIXME: Some tests require writing at $HOME
    HOME=$TMPDIR
    runHook preConfigure

    # probably requires autotools as dependency
    ./autogen.sh
    emconfigure ./configure --prefix=$out

    runHook postConfigure
  '';

  buildPhase = args.buildPhase or ''
    runHook preBuild

    HOME=$TMPDIR
    emmake make

    runHook postBuild
  '';

  checkPhase = args.checkPhase or ''
    runHook preCheck

    runHook postCheck
  '';

  enableParallelBuilding = args.enableParallelBuilding or true;

  meta = {
    # Add default meta information
    platforms = lib.platforms.all;
    # Do not build this automatically
    hydraPlatforms = [];
  } // meta // {
    # add an extra maintainer to every package
    maintainers = (meta.maintainers or []) ++
                  [ lib.maintainers.qknight ];
  };
})