Commit e100ad4e authored by Anderson Torres's avatar Anderson Torres
Browse files

quickjs-ng: adopt and refactor

- strictDeps
- pushd/popd instead of subshell
- adopt by AndersonTorres
parent 726d02f6
Loading
Loading
Loading
Loading
+36 −19
Original line number Diff line number Diff line
{ lib
, stdenv
, cmake
, fetchFromGitHub
, testers
, texinfo
{
  lib,
  cmake,
  fetchFromGitHub,
  stdenv,
  testers,
  texinfo,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -17,7 +18,13 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-gULpJhOOmhzq2Ydl4soNBiiONtdt2T4sgcSqIBCo3SM=";
  };

  outputs = [ "bin" "out" "dev" "doc" "info" ];
  outputs = [
    "out"
    "bin"
    "dev"
    "doc"
    "info"
  ];

  nativeBuildInputs = [
    cmake
@@ -25,18 +32,28 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=ON"
    (lib.cmakeBool "BUILD_SHARED_LIBS" true)
    (lib.cmakeBool "BUILD_STATIC_QJS_EXE" stdenv.hostPlatform.isStatic)
  ];

  env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
  env.NIX_CFLAGS_COMPILE = toString (
    lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
      "-Wno-error=stringop-overflow"
  ]);
    ]
  );

  strictDeps = true;

  postBuild = ''
    pushd ../doc
    makeinfo *texi
    popd
  '';

  postInstall = ''
    (cd ../doc
     makeinfo --output quickjs.info quickjs.texi
     install -Dt $info/share/info/ quickjs.info)
    pushd ../doc
    install -Dm644 -t ''${!outputInfo}/share/info *info
    popd
  '';

  passthru.tests = {
@@ -46,12 +63,12 @@ stdenv.mkDerivation (finalAttrs: {
    };
  };

  meta = with lib; {
    description = "Mighty JavaScript engine";
  meta = {
    homepage = "https://github.com/quickjs-ng/quickjs";
    license = licenses.mit;
    maintainers = [ ];
    platforms = platforms.all;
    description = "Mighty JavaScript engine";
    license = lib.licenses.mit;
    mainProgram = "qjs";
    maintainers = with lib.maintainers; [ AndersonTorres ];
    platforms = lib.platforms.all;
  };
})