Files
haikuports/dev-lang/quickjs/patches/quickjs-2025.09.13.2.patchset
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

91 lines
2.4 KiB
Plaintext

From e3cdc02c01716190bbb8d0bf73b736e135b5225d Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Tue, 11 Nov 2025 06:24:05 -0300
Subject: Haiku build fixes.
diff --git a/Makefile b/Makefile
index 3b1c745..633ef68 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+ifeq ($(shell uname -s),Haiku)
+CONFIG_HAIKU=y
+endif
ifeq ($(shell uname -s),Darwin)
CONFIG_DARWIN=y
endif
@@ -246,8 +249,10 @@ QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS)
HOST_LIBS=-lm -ldl -lpthread
LIBS=-lm -lpthread
ifndef CONFIG_WIN32
+ifndef CONFIG_HAIKU
LIBS+=-ldl
endif
+endif
LIBS+=$(EXTRA_LIBS)
$(OBJDIR):
diff --git a/qjsc.c b/qjsc.c
index e55ca61..56f3687 100644
--- a/qjsc.c
+++ b/qjsc.c
@@ -502,7 +502,9 @@ static int output_executable(const char *out_filename, const char *cfilename,
lib_dir, bn_suffix, lto_suffix);
*arg++ = libjsname;
*arg++ = "-lm";
+#ifndef __HAIKU__
*arg++ = "-ldl";
+#endif
*arg++ = "-lpthread";
*arg = NULL;
--
2.50.1
From 3aa7dbe07431a5e5330dfe750ec29e6adbef74c2 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Tue, 11 Nov 2025 06:44:53 -0300
Subject: Fix install locations.
diff --git a/Makefile b/Makefile
index 633ef68..dc28717 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ endif
# installation directory
PREFIX?=/usr/local
+LIBDIR?=$(PREFIX)/lib/quickjs
+HEADERSDIR?=$(PREFIX)/include
# use the gprof profiler
#CONFIG_PROFILE=y
@@ -373,13 +375,13 @@ install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
$(STRIP) qjs$(EXE) qjsc$(EXE)
install -m755 qjs$(EXE) qjsc$(EXE) "$(DESTDIR)$(PREFIX)/bin"
- mkdir -p "$(DESTDIR)$(PREFIX)/lib/quickjs"
- install -m644 libquickjs.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
+ mkdir -p "$(DESTDIR)$(LIBDIR)"
+ install -m644 libquickjs.a "$(DESTDIR)$(LIBDIR)"
ifdef CONFIG_LTO
- install -m644 libquickjs.lto.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
+ install -m644 libquickjs.lto.a "$(DESTDIR)$(LIBDIR)"
endif
- mkdir -p "$(DESTDIR)$(PREFIX)/include/quickjs"
- install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(PREFIX)/include/quickjs"
+ mkdir -p "$(DESTDIR)$(HEADERSDIR)/quickjs"
+ install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(HEADERSDIR)/quickjs"
###############################################################################
# examples
--
2.50.1