Files
haikuports/dev-lang/quickjs/quickjs-2025.09.13.2.recipe
OscarL f87ae83226 quickjs: new recipe. (#13197)
Motivation to add it: yt-dlp requires a Javascript engine to be able
to download from Youtube now, and all the other supported "js backends"
are either very large (node, deno, bun), or slower (quickjs-ng), in
comparison to this one.
2025-11-13 22:14:09 -03:00

113 lines
3.3 KiB
Bash

SUMMARY="Small and embeddable Javascript engine"
DESCRIPTION="QuickJS is a small and embeddable Javascript engine. It supports the ES2023 \
specification including modules, asynchronous generators, proxies and BigInt.
Main Features:
* Small and easily embeddable: just a few C files, no external dependency, 367 KiB of x86 code \
for a simple hello world program.
* Fast interpreter with very low startup time: runs the 78000 tests of the ECMAScript Test Suite \
in about 2 minutes on a single core of a desktop PC. The complete life cycle of a runtime \
instance completes in less than 300 microseconds.
* Almost complete ES2023 support including modules, asynchronous generators and full Annex B \
support (legacy web compatibility).
* Passes nearly 100% of the ECMAScript Test Suite tests when selecting the ES2023 features (see \
test262.fyi).
* Can compile Javascript sources to executables with no external dependency.
* Garbage collection using reference counting (to reduce memory usage and have deterministic \
behavior) with cycle removal.
* Command line interpreter with contextual colorization implemented in Javascript.
* Small built-in standard library with C library wrappers.
"
HOMEPAGE="https://bellard.org/quickjs/"
COPYRIGHT="2017-2021 Fabrice Bellard
2017-2021 Charlie Gordon"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://bellard.org/quickjs/quickjs-${portVersion//./-}.tar.xz"
CHECKSUM_SHA256="996c6b5018fc955ad4d06426d0e9cb713685a00c825aa5c0418bd53f7df8b0b4"
_version=${portVersion//./-}
SOURCE_DIR="quickjs-${_version%-*}"
PATCHES="quickjs-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
$portName = $portVersion
cmd:qjs = $portVersion
cmd:qjsc = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
${portName}_devel = $portVersion
devel:libquickjs$secondaryArchSuffix = $portVersion
devel:libquickjs.lto$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
$portName == $portVersion base
"
ARCHITECTURES_doc="any"
PROVIDES_doc="
${portBaseName}_doc
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
CONFIG_LTO=y \
make $jobArgs
}
INSTALL()
{
CONFIG_LTO=y \
PREFIX=$prefix \
LIBDIR=$developLibDir \
HEADERSDIR=$developDir \
make install
# devel package
packageEntries devel \
$developDir
# doc package
install -d $documentationDir/packages/$portBaseName
install -t $documentationDir/packages/$portBaseName doc/quickjs.pdf
install -t $documentationDir/packages/$portBaseName doc/quickjs.html
packageEntries doc \
$documentationDir
}
# On hrev59057 x86_32 (VMWare), got:
# Error: assertion failed: got number:|29256|, expected number:|29312| (order of operations / precision in MakeTime)
# at throw_error (tests/test_builtin.js:8:20)
# at assert (tests/test_builtin.js:46:16)
# at test_date (tests/test_builtin.js:694:15)
# at <eval> (tests/test_builtin.js:1174:10)
# make: *** [Makefile:455: test] Error 1
#
# On hrev59110 x86_64 (VMware), got:
# Error: assertion failed: got |false|, expected |true|
# at assert (tests/test_std.js:17:16)
# at test_os (tests/test_std.js:236:11)
# at <anonymous> (tests/test_std.js:330:8)
# make: *** [Makefile:460: test] Error 1
TEST()
{
make test $jobArgs
}