mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-16 02:29:50 +00:00
Improve cpp nix builder
This commit is contained in:
31
nix/squoosh-cxx-builder/default.nix
Normal file
31
nix/squoosh-cxx-builder/default.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
pkgs,
|
||||
stdenv,
|
||||
runCommand,
|
||||
}:
|
||||
{
|
||||
name,
|
||||
src,
|
||||
nativeBuildInputs ? [ ],
|
||||
encoder ? "enc",
|
||||
decoder ? "dec",
|
||||
...
|
||||
}@args:
|
||||
|
||||
stdenv.mkDerivation (
|
||||
final:
|
||||
args
|
||||
// {
|
||||
inherit name src;
|
||||
nativeBuildInputs = [ pkgs.emscripten ] ++ nativeBuildInputs;
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
emmake make -j$(nproc)
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
${if (encoder != null) then "cp -r ${encoder} $out" else ""}
|
||||
${if (decoder != null) then "cp -r ${decoder} $out" else ""}
|
||||
'';
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user