Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions interpreters/quickjs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

include $(APPDIR)/Make.defs

QUICKJS_VERSION = 2020-11-08
QUICKJS_UNPACK = quickjs
QUICKJS_TARBALL = quickjs-$(QUICKJS_VERSION).tar.xz
QUICKJS_URL_BASE = https://bellard.org/quickjs/
QUICKJS_URL = $(QUICKJS_URL_BASE)/$(QUICKJS_TARBALL)
QUICKJS_VERSION = 2024-02-14
QUICKJS_COMMIT_ID = 6e2e68fd0896957f92eb6c242a2e048c1ef3cae0
QUICKJS_UNPACK = quickjs
QUICKJS_ARCHIVE = $(QUICKJS_COMMIT_ID).zip
QUICKJS_URL = https://github.com/bellard/quickjs/archive/$(QUICKJS_ARCHIVE)

CSRCS = quickjs.c libregexp.c libbf.c libunicode.c cutils.c

Expand Down Expand Up @@ -63,42 +63,38 @@ STACKSIZE = $(CONFIG_INTERPRETERS_QUICKJS_STACKSIZE)
MODULE = $(CONFIG_INTERPRETERS_QUICKJS)
endif

$(QUICKJS_TARBALL):
$(Q) echo "Downloading $(QUICKJS_TARBALL)"
$(Q) curl -O -L $(QUICKJS_URL)
$(QUICKJS_ARCHIVE):
$(Q) echo "Downloading $(QUICKJS_ARCHIVE)"
$(Q) curl -L $(QUICKJS_URL) -o quickjs-$(QUICKJS_ARCHIVE)

$(QUICKJS_UNPACK): $(QUICKJS_TARBALL)
$(Q) echo "Unpacking $(QUICKJS_TARBALL) to $(QUICKJS_UNPACK)"
$(Q) tar -Jxf $(QUICKJS_TARBALL)
$(Q) mv quickjs-$(QUICKJS_VERSION) $(QUICKJS_UNPACK)
$(QUICKJS_UNPACK): $(QUICKJS_ARCHIVE)
$(Q) echo "Unpacking quickjs-$(QUICKJS_ARCHIVE) to $(QUICKJS_UNPACK)"
$(Q) unzip -q -o quickjs-$(QUICKJS_ARCHIVE)
$(Q) mv quickjs-$(QUICKJS_COMMIT_ID) $(QUICKJS_UNPACK)
$(Q) patch -d $(QUICKJS_UNPACK) -p1 < 0001-Disabled-unsupported-feature-on-NuttX.patch

$(QUICKJS_UNPACK)/.patch: $(QUICKJS_UNPACK)
$(Q) touch $(QUICKJS_UNPACK)/.patch

# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(QUICKJS_UNPACK)/.git),)
QUICKJS_DOWNLOAD=$(QUICKJS_UNPACK)/.patch
distclean::
$(call DELDIR, $(QUICKJS_UNPACK))
$(call DELFILE, $(QUICKJS_TARBALL))
endif

ifeq ($(CONFIG_INTERPRETERS_QUICKJS_MINI),y)
MAINSRC = qjsmini.c
endif

ifeq ($(CONFIG_INTERPRETERS_QUICKJS_FULL),y)
CSRCS += quickjs-libc.c repl.c
MAINSRC = qjs.c
context:: $(QUICKJS_DOWNLOAD)
endif

# Download and unpack zipball if no archive found
ifeq ($(wildcard $(QUICKJS_UNPACK)/.*),)
ifeq ($(CONFIG_INTERPRETERS_QUICKJS_FULL),y)
context:: $(QUICKJS_UNPACK)
$(MAKE) -C $(QUICKJS_UNPACK) \
CONFIG_BIGNUM=$(CONFIG_INTERPRETERS_QUICKJS_BIGNUM)
else
context:: $(QUICKJS_DOWNLOAD)
context:: $(QUICKJS_UNPACK)
endif
endif

clean::
$(Q) test ! -d $(QUICKJS_UNPACK) || $(MAKE) -C $(QUICKJS_UNPACK) clean
distclean::
$(call DELDIR, $(QUICKJS_UNPACK))
$(call DELFILE, $(QUICKJS_ARCHIVE))

include $(APPDIR)/Application.mk