1{ lib
2, rustPlatform
3, fetchFromGitHub
4, fetchpatch
5, pkg-config
6, bzip2
7, openssl
8, zstd
9, stdenv
10, darwin
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "boa";
15 version = "0.17.3";
16
17 src = fetchFromGitHub {
18 owner = "boa-dev";
19 repo = "boa";
20 rev = "v${version}";
21 hash = "sha256-ROzdOanfHNPwHXA0SzU2fpuBonbDbgDqH+ZgOjwK/tg=";
22 fetchSubmodules = true;
23 };
24
25 patches = [
26 (fetchpatch {
27 name = "fix-rust-1.71-lints.patch";
28 url = "https://github.com/boa-dev/boa/commit/93d05bda6864aa6ee67682d84bd4fc2108093ef5.patch";
29 hash = "sha256-hMp4/UBN5moGBSqf8BJV2nBwgV3cry9uC2fJmdT5hkQ=";
30 })
31 ];
32
33 cargoHash = "sha256-UIUXayJwTrWbLm1UKnIXy1Df8a7ZoBzdNm/uZ1+H+SQ=";
34
35 cargoBuildFlags = [ "--package" "boa_cli" ];
36
37 nativeBuildInputs = [ pkg-config ];
38
39 buildInputs =
40 [ bzip2 openssl zstd ]
41 ++ lib.optionals stdenv.isDarwin [
42 darwin.apple_sdk.frameworks.CoreFoundation
43 darwin.apple_sdk.frameworks.Security
44 ];
45
46 env = { ZSTD_SYS_USE_PKG_CONFIG = true; };
47
48 meta = with lib; {
49 description = "Embeddable and experimental Javascript engine written in Rust";
50 mainProgram = "boa";
51 homepage = "https://github.com/boa-dev/boa";
52 changelog = "https://github.com/boa-dev/boa/blob/${src.rev}/CHANGELOG.md";
53 license = with licenses; [ mit /* or */ unlicense ];
54 maintainers = with maintainers; [ dit7ya ];
55 };
56}