mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-09 23:34:51 +01:00
quickjs: clean up integration
Pass CFLAGS and LDFLAGS the correct way via environment variables and not as arguments so the upstream Makefile CFLAGS/LDFLAGS do not get overwritten and no ugly workaround is needed. Set PREFIX correctly and do not set CONFIG_SMALL which was implemented in a patch that was dropped. Remove commented out code (libquickjs.lto.a is no longer built by default). Set PKG_SOURCE_DATE correctly as the date of the upstream git repo and not the date of the OpenWrt package. Fix whitespace issues in patch. Do not create empty /usr/lib/quickjs
This commit is contained in:
parent
afde0b98ad
commit
417a127dd9
2 changed files with 18 additions and 23 deletions
|
|
@ -5,7 +5,7 @@ PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://github.com/bellard/quickjs.git
|
PKG_SOURCE_URL:=https://github.com/bellard/quickjs.git
|
||||||
PKG_SOURCE_DATE:=2025-07-22
|
PKG_SOURCE_DATE:=2025-07-09
|
||||||
PKG_SOURCE_VERSION:=1fdc768fdc8571300755cdd3e4654ce99c0255ce
|
PKG_SOURCE_VERSION:=1fdc768fdc8571300755cdd3e4654ce99c0255ce
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
|
|
@ -31,8 +31,7 @@ define Package/quickjs/description
|
||||||
endef
|
endef
|
||||||
|
|
||||||
MAKE_FLAGS = \
|
MAKE_FLAGS = \
|
||||||
prefix=/usr \
|
PREFIX=/usr \
|
||||||
CONFIG_SMALL=y \
|
|
||||||
EXTRA_LIBS="-latomic" \
|
EXTRA_LIBS="-latomic" \
|
||||||
CROSS_PREFIX="$(TARGET_CROSS)"
|
CROSS_PREFIX="$(TARGET_CROSS)"
|
||||||
|
|
||||||
|
|
@ -42,12 +41,10 @@ define Build/Compile
|
||||||
# the host tools ('host-qjsc', 'unicode_gen') with the host compiler
|
# the host tools ('host-qjsc', 'unicode_gen') with the host compiler
|
||||||
# and flags.
|
# and flags.
|
||||||
# We still pass MAKE_FLAGS so the upstream Makefile knows we're cross-compiling.
|
# We still pass MAKE_FLAGS so the upstream Makefile knows we're cross-compiling.
|
||||||
# We have to manually add DEFINES from the upstream Makefile to HOST_CFLAGS
|
CFLAGS="$(HOST_CFLAGS)" \
|
||||||
# because we are overriding CFLAGS.
|
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||||
$(MAKE_FLAGS) \
|
$(MAKE_FLAGS) \
|
||||||
CFLAGS="$(HOST_CFLAGS) -D_GNU_SOURCE -DCONFIG_VERSION='\"$(shell cat $(PKG_BUILD_DIR)/VERSION | tr -d '\n')\"'" \
|
|
||||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
|
||||||
host-qjsc unicode_gen
|
host-qjsc unicode_gen
|
||||||
|
|
||||||
# Then we proceed with the default build process for the target binaries.
|
# Then we proceed with the default build process for the target binaries.
|
||||||
|
|
@ -56,17 +53,16 @@ define Build/Compile
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/quickjs
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/lib/quickjs/libquickjs.a $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/quickjs/libquickjs.a $(1)/usr/lib/
|
||||||
# $(CP) $(PKG_INSTALL_DIR)/usr/local/lib/quickjs/libquickjs.lto.a $(1)/usr/lib/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/include/quickjs/quickjs.h $(1)/usr/include/quickjs/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs.h $(1)/usr/include/quickjs/
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/include/quickjs/quickjs-libc.h $(1)/usr/include/quickjs/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs-libc.h $(1)/usr/include/quickjs/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/quickjs/install
|
define Package/quickjs/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/qjs $(1)/usr/bin/
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qjs $(1)/usr/bin/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,quickjs))
|
$(eval $(call BuildPackage,quickjs))
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
Index: quickjs-2025-07-22-1fdc768f/quickjs-libc.c
|
diff --git a/quickjs-libc.c b/quickjs-libc.c
|
||||||
===================================================================
|
index 54a7a15..a64c4d6 100644
|
||||||
--- quickjs-2025-07-22-1fdc768f.orig/quickjs-libc.c
|
--- a/quickjs-libc.c
|
||||||
+++ quickjs-2025-07-22-1fdc768f/quickjs-libc.c
|
+++ b/quickjs-libc.c
|
||||||
@@ -385,20 +385,94 @@ fail:
|
@@ -385,12 +385,86 @@ fail:
|
||||||
return JS_EXCEPTION;
|
return JS_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
+#define READALL_CHUNK 10*1024
|
+#define READALL_CHUNK (10*1024)
|
||||||
+
|
+
|
||||||
+static int readall(FILE *f, JSContext *ctx, uint8_t **dataptr, size_t *sizeptr)
|
+static int readall(FILE *f, JSContext *ctx, uint8_t **dataptr, size_t *sizeptr)
|
||||||
+{
|
+{
|
||||||
|
|
@ -86,12 +86,11 @@ Index: quickjs-2025-07-22-1fdc768f/quickjs-libc.c
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
size_t buf_len;
|
size_t buf_len;
|
||||||
- long lret;
|
- long lret;
|
||||||
-
|
|
||||||
+ long lret = 0;
|
+ long lret = 0;
|
||||||
+
|
|
||||||
f = fopen(filename, "rb");
|
f = fopen(filename, "rb");
|
||||||
if (!f)
|
if (!f)
|
||||||
return NULL;
|
@@ -398,7 +472,7 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||||
if (fseek(f, 0, SEEK_END) < 0)
|
if (fseek(f, 0, SEEK_END) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
lret = ftell(f);
|
lret = ftell(f);
|
||||||
|
|
@ -100,7 +99,7 @@ Index: quickjs-2025-07-22-1fdc768f/quickjs-libc.c
|
||||||
goto fail;
|
goto fail;
|
||||||
/* XXX: on Linux, ftell() return LONG_MAX for directories */
|
/* XXX: on Linux, ftell() return LONG_MAX for directories */
|
||||||
if (lret == LONG_MAX) {
|
if (lret == LONG_MAX) {
|
||||||
@@ -414,13 +488,19 @@ uint8_t *js_load_file(JSContext *ctx, si
|
@@ -414,13 +488,19 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||||
buf = malloc(buf_len + 1);
|
buf = malloc(buf_len + 1);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue