quickjs-ng: adopt and refactor

- strictDeps
- pushd/popd instead of subshell
- adopt by AndersonTorres
This commit is contained in:
Anderson Torres 2024-09-27 10:16:46 -03:00
parent 726d02f644
commit e100ad4eb7

View File

@ -1,9 +1,10 @@
{ lib {
, stdenv lib,
, cmake cmake,
, fetchFromGitHub fetchFromGitHub,
, testers stdenv,
, texinfo testers,
texinfo,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -17,7 +18,13 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-gULpJhOOmhzq2Ydl4soNBiiONtdt2T4sgcSqIBCo3SM="; hash = "sha256-gULpJhOOmhzq2Ydl4soNBiiONtdt2T4sgcSqIBCo3SM=";
}; };
outputs = [ "bin" "out" "dev" "doc" "info" ]; outputs = [
"out"
"bin"
"dev"
"doc"
"info"
];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
@ -25,18 +32,28 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
cmakeFlags = [ cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON" (lib.cmakeBool "BUILD_SHARED_LIBS" true)
(lib.cmakeBool "BUILD_STATIC_QJS_EXE" stdenv.hostPlatform.isStatic) (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 (
"-Wno-error=stringop-overflow" lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
]); "-Wno-error=stringop-overflow"
]
);
strictDeps = true;
postBuild = ''
pushd ../doc
makeinfo *texi
popd
'';
postInstall = '' postInstall = ''
(cd ../doc pushd ../doc
makeinfo --output quickjs.info quickjs.texi install -Dm644 -t ''${!outputInfo}/share/info *info
install -Dt $info/share/info/ quickjs.info) popd
''; '';
passthru.tests = { passthru.tests = {
@ -46,12 +63,12 @@ stdenv.mkDerivation (finalAttrs: {
}; };
}; };
meta = with lib; { meta = {
description = "Mighty JavaScript engine";
homepage = "https://github.com/quickjs-ng/quickjs"; homepage = "https://github.com/quickjs-ng/quickjs";
license = licenses.mit; description = "Mighty JavaScript engine";
maintainers = [ ]; license = lib.licenses.mit;
platforms = platforms.all;
mainProgram = "qjs"; mainProgram = "qjs";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.all;
}; };
}) })