Files
nixpkgs/pkgs/development/em-modules/generic/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

101 lines
2.3 KiB
Nix

{
pkgs,
lib,
emscripten,
python3,
}:
argsFun:
let
wrapDerivation = f: pkgs.stdenv.mkDerivation (finalAttrs: f (lib.toFunction argsFun finalAttrs));
in
wrapDerivation (
{
buildInputs ? [ ],
nativeBuildInputs ? [ ],
enableParallelBuilding ? true,
meta ? { },
...
}@args:
args
// {
pname = "emscripten-${lib.getName args}";
version = lib.getVersion args;
buildInputs = [
emscripten
python3
] ++ buildInputs;
nativeBuildInputs = [
emscripten
python3
] ++ nativeBuildInputs;
# fake conftest results with emscripten's python magic
EMCONFIGURE_JS = 2;
# removes archive indices
dontStrip = args.dontStrip or true;
configurePhase =
args.configurePhase or ''
# FIXME: Some tests require writing at $HOME
HOME=$TMPDIR
runHook preConfigure
emconfigure ./configure --prefix=$out
mkdir -p .emscriptencache
export EM_CACHE=$(pwd)/.emscriptencache
runHook postConfigure
'';
buildPhase =
args.buildPhase or ''
runHook preBuild
HOME=$TMPDIR
emmake make
runHook postBuild
'';
doCheck = true;
checkPhase =
args.checkPhase or ''
runHook preCheck
echo "Please provide a test for your emscripten based library/tool, see libxml2 as an exmple on how to use emcc/node to verify your build"
echo ""
echo "In normal C 'unresolved symbols' would yield an error and a breake of execution. In contrast, in emscripten they are only a warning which is ok given that emscripten assumptions about shared libraries."
echo " -> https://github.com/kripken/emscripten/wiki/Linking"
echo "So just assume the dependencies were built using hydra, then YOU WILL NEVER see the warning and your code depending on a library will always fail!"
exit 1
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 ];
};
}
)