mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-26 12:03:44 +08:00
Compare commits
3 Commits
quickjs-ng
...
dynbhaul-h
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
878111e0a5 | ||
|
|
84b5e3bb4d | ||
|
|
63051a0f05 |
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.17.0
|
||||
PKG_VERSION:=1.16.7
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=a4f61081381a35fc98fa1cec58e964c3e6db2c55
|
||||
PKG_SOURCE_VERSION:=b6fdc87df88b0a625480301d52fbfc2bdfb0aa58
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -17,12 +17,6 @@ for port_bridge_sec in $port_bridge_sec_list; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Exit if the PORT Bridge Name is empty
|
||||
[ -z "$port_bridge_name" ] && exit 0
|
||||
|
||||
# Exit if the PORT is not member of the AL Bridge
|
||||
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
|
||||
|
||||
# Exit if the device is not operating in extender/repeater mode
|
||||
al_brnet="${al_bridge:3}"
|
||||
[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0
|
||||
@@ -36,9 +30,16 @@ fi
|
||||
################ Dedicated ETH WAN Port ################
|
||||
wanport="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
|
||||
if [ -n "$wanport" ]; then
|
||||
# Don't require wanport to be part of port bridge
|
||||
[ "$wanport" = "$PORT" ] || exit 0
|
||||
########################################################
|
||||
else
|
||||
# Exit if the PORT Bridge Name is empty
|
||||
[ -z "$port_bridge_name" ] && exit 0
|
||||
|
||||
# Exit if the PORT is not member of the AL Bridge
|
||||
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
|
||||
|
||||
#################### DHCP Discovery ####################
|
||||
if [ "$LINK" = "up" ]; then
|
||||
brctl delif $al_bridge $PORT
|
||||
@@ -95,8 +96,12 @@ if [ "$LINK" = "up" ]; then
|
||||
config_foreach remove_from_bridge bsta
|
||||
config_foreach update_bstas bsta down
|
||||
|
||||
brctl addif $al_bridge $PORT
|
||||
logger -t "dynamic-backhaul" "brctl addif $al_bridge $PORT"
|
||||
/lib/wifi/multiap set_uplink "eth" "$PORT"
|
||||
else
|
||||
brctl delif $al_bridge $PORT
|
||||
logger -t "dynamic-backhaul" "brctl delif $al_bridge $PORT"
|
||||
/lib/wifi/multiap unset_uplink "eth"
|
||||
#rm -f "$map_bh_file"
|
||||
config_load "mapagent"
|
||||
|
||||
@@ -259,6 +259,5 @@ map_genconf () {
|
||||
}
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
ubus send bbfdm.wifidmd.reload
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmode
|
||||
PKG_VERSION:=1.1.6
|
||||
PKG_VERSION:=1.1.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"name": "mode"
|
||||
}
|
||||
},
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.*.Name"
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.[Name==@key]."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -80,7 +80,11 @@ l2_network_config() {
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
[ -n "$device" ] && {
|
||||
# dedicated wan port - create uplink device
|
||||
uci -q set network.l2wan=interface
|
||||
uci -q set network.l2wan.device="$device"
|
||||
}
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=10.0.4.2
|
||||
PKG_VERSION:=10.0.4.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=65dabfdb8fbb2f3c2590f3bfb2fabedef8dcd76e
|
||||
PKG_SOURCE_VERSION:=6b888812299de0d836a8dcf33bc899ec8ff16030
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickjs-ng
|
||||
PKG_VERSION:=2024-07-22
|
||||
PKG_RELEASE:=1
|
||||
|
||||
# Fetch the source from the official git repository
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/quickjs-ng/quickjs.git
|
||||
PKG_SOURCE_VERSION:=HEAD
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_MAINTAINER:=QuickJS-NG Maintainers <maintainers@quickjs-ng.org>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -fPIC
|
||||
|
||||
# Configure arguments – QuickJS uses a simple Makefile, no autotools.
|
||||
# We only need to make sure the correct toolchain variables are used.
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CC="$(TARGET_CC)" \
|
||||
AR="$(TARGET_AR)" \
|
||||
LD="$(TARGET_LD)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
PREFIX="/usr" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)"
|
||||
|
||||
# Package definition
|
||||
|
||||
define Package/quickjs-ng
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=QuickJS-NG – Lightweight JavaScript engine
|
||||
URL:=https://github.com/quickjs-ng/quickjs
|
||||
DEPENDS:=+libatomic
|
||||
endef
|
||||
|
||||
define Package/quickjs-ng/description
|
||||
QuickJS-NG is a modern fork of Fabrice Bellard's QuickJS JavaScript engine.
|
||||
It aims to keep up with the latest ECMAScript features while remaining small
|
||||
and embeddable. This package provides the `qjs` interpreter, the `qjsc`
|
||||
compiler and the shared library that can be linked by third-party software.
|
||||
endef
|
||||
|
||||
# Overwrite the default compile and install steps – QuickJS ships its own Makefile.
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) all install
|
||||
endef
|
||||
|
||||
# Install development files into the staging directory so other packages can
|
||||
# link against QuickJS-NG at build-time.
|
||||
|
||||
define Build/InstallDev
|
||||
# Headers
|
||||
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/include/*.h $(1)/usr/include/quickjs/
|
||||
# Ensure quickjs-libc.h is present (some install targets may omit it)
|
||||
$(CP) $(PKG_BUILD_DIR)/quickjs-libc.h $(1)/usr/include/quickjs/
|
||||
|
||||
# Library
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/lib/libqjs.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
# Main runtime package install
|
||||
|
||||
define Package/quickjs-ng/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/qjs $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/qjsc $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/lib/libqjs.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickjs-ng))
|
||||
@@ -38,7 +38,7 @@ define Package/quickjs-websocket
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=WebSocket API for QuickJS
|
||||
MAINTAINER:=Erik Karlsson <erik.karlsson@genexis.eu>
|
||||
DEPENDS:=+quickjs-ng +libwebsockets-openssl
|
||||
DEPENDS:=+quickjs +libwebsockets-openssl
|
||||
endef
|
||||
|
||||
define Package/quickjs-websocket/description
|
||||
|
||||
@@ -930,7 +930,7 @@ static int js_lws_init(JSContext *ctx, JSModuleDef *m)
|
||||
{
|
||||
JSValue proto;
|
||||
|
||||
JS_NewClassID(JS_GetRuntime(ctx), &js_lws_context_class_id);
|
||||
JS_NewClassID(&js_lws_context_class_id);
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_lws_context_class_id,
|
||||
&js_lws_context_class);
|
||||
proto = JS_NewObject(ctx);
|
||||
@@ -938,7 +938,7 @@ static int js_lws_init(JSContext *ctx, JSModuleDef *m)
|
||||
countof(js_lws_context_proto_funcs));
|
||||
JS_SetClassProto(ctx, js_lws_context_class_id, proto);
|
||||
|
||||
JS_NewClassID(JS_GetRuntime(ctx), &js_lws_wsi_class_id);
|
||||
JS_NewClassID(&js_lws_wsi_class_id);
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_lws_wsi_class_id, &js_lws_wsi_class);
|
||||
proto = JS_NewObject(ctx);
|
||||
JS_SetPropertyFunctionList(ctx, proto, js_lws_wsi_proto_funcs,
|
||||
|
||||
53
quickjs/Makefile
Normal file
53
quickjs/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickjs
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/bellard/quickjs.git
|
||||
PKG_SOURCE_DATE:=2022-03-06
|
||||
PKG_SOURCE_VERSION:=2788d71e823b522b178db3b3660ce93689534e6d
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/quickjs
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=QuickJS Javascript engine
|
||||
URL:=https://bellard.org/quickjs/
|
||||
MAINTAINER:=Erik Karlsson <erik.karlsson@genexis.eu>
|
||||
DEPENDS:=+libatomic
|
||||
endef
|
||||
|
||||
define Package/quickjs/description
|
||||
QuickJS is a small and embeddable Javascript engine. It supports
|
||||
the ES2020 specification including modules, asynchronous
|
||||
generators, proxies and BigInt.
|
||||
endef
|
||||
|
||||
MAKE_FLAGS = \
|
||||
prefix=/usr \
|
||||
CONFIG_SMALL=y \
|
||||
EXTRA_LIBS="-latomic" \
|
||||
CROSS_PREFIX="$(TARGET_CROSS)"
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/quickjs/libquickjs.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/quickjs/libquickjs.lto.a $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs.h $(1)/usr/include/quickjs/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs-libc.h $(1)/usr/include/quickjs/
|
||||
endef
|
||||
|
||||
define Package/quickjs/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qjs $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickjs))
|
||||
87
quickjs/patches/000-build-options.patch
Normal file
87
quickjs/patches/000-build-options.patch
Normal file
@@ -0,0 +1,87 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 49b1f6f..2c96eae 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -33,6 +33,8 @@ CONFIG_LTO=y
|
||||
#CONFIG_WERROR=y
|
||||
# force 32 bit build for some utilities
|
||||
#CONFIG_M32=y
|
||||
+# build with -Os instead of -O2
|
||||
+#CONFIG_SMALL=y
|
||||
|
||||
ifdef CONFIG_DARWIN
|
||||
# use clang instead of gcc
|
||||
@@ -52,6 +54,13 @@ CONFIG_BIGNUM=y
|
||||
|
||||
OBJDIR=.obj
|
||||
|
||||
+CFLAGS_ENV:=$(CFLAGS)
|
||||
+LDFLAGS_ENV:=$(LDFLAGS)
|
||||
+
|
||||
+HOST_BUILD=
|
||||
+CFLAGS=$(if $(HOST_BUILD),,$(CFLAGS_ENV))
|
||||
+LDFLAGS=$(if $(HOST_BUILD),,$(LDFLAGS_ENV))
|
||||
+
|
||||
ifdef CONFIG_WIN32
|
||||
ifdef CONFIG_M32
|
||||
CROSS_PREFIX=i686-w64-mingw32-
|
||||
@@ -66,7 +75,7 @@ endif
|
||||
ifdef CONFIG_CLANG
|
||||
HOST_CC=clang
|
||||
CC=$(CROSS_PREFIX)clang
|
||||
- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
+ CFLAGS += -g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -Wno-sign-compare
|
||||
CFLAGS += -Wno-missing-field-initializers
|
||||
@@ -87,7 +96,7 @@ ifdef CONFIG_CLANG
|
||||
else
|
||||
HOST_CC=gcc
|
||||
CC=$(CROSS_PREFIX)gcc
|
||||
- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
+ CFLAGS += -g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
||||
ifdef CONFIG_LTO
|
||||
AR=$(CROSS_PREFIX)gcc-ar
|
||||
@@ -110,9 +119,13 @@ endif
|
||||
CFLAGS+=$(DEFINES)
|
||||
CFLAGS_DEBUG=$(CFLAGS) -O0
|
||||
CFLAGS_SMALL=$(CFLAGS) -Os
|
||||
+ifdef CONFIG_SMALL
|
||||
+CFLAGS_OPT=$(CFLAGS) -Os
|
||||
+else
|
||||
CFLAGS_OPT=$(CFLAGS) -O2
|
||||
+endif
|
||||
CFLAGS_NOLTO:=$(CFLAGS_OPT)
|
||||
-LDFLAGS=-g
|
||||
+LDFLAGS+=-g
|
||||
ifdef CONFIG_LTO
|
||||
CFLAGS_SMALL+=-flto
|
||||
CFLAGS_OPT+=-flto
|
||||
@@ -195,6 +208,8 @@ qjsc$(EXE): $(OBJDIR)/qjsc.o $(QJS_LIB_OBJS)
|
||||
|
||||
ifneq ($(CROSS_PREFIX),)
|
||||
|
||||
+$(QJSC): HOST_BUILD=1
|
||||
+
|
||||
$(QJSC): $(OBJDIR)/qjsc.host.o \
|
||||
$(patsubst %.o, %.host.o, $(QJS_LIB_OBJS))
|
||||
$(HOST_CC) $(LDFLAGS) -o $@ $^ $(HOST_LIBS)
|
||||
@@ -262,6 +277,8 @@ run-test262-32: $(patsubst %.o, %.m32.o, $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS)
|
||||
$(OBJDIR)/%.o: %.c | $(OBJDIR)
|
||||
$(CC) $(CFLAGS_OPT) -c -o $@ $<
|
||||
|
||||
+$(OBJDIR)/%.host.o: HOST_BUILD=1
|
||||
+
|
||||
$(OBJDIR)/%.host.o: %.c | $(OBJDIR)
|
||||
$(HOST_CC) $(CFLAGS_OPT) -c -o $@ $<
|
||||
|
||||
@@ -286,6 +303,8 @@ $(OBJDIR)/%.check.o: %.c | $(OBJDIR)
|
||||
regexp_test: libregexp.c libunicode.c cutils.c
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -DTEST -o $@ libregexp.c libunicode.c cutils.c $(LIBS)
|
||||
|
||||
+unicode_gen: HOST_BUILD=1
|
||||
+
|
||||
unicode_gen: $(OBJDIR)/unicode_gen.host.o $(OBJDIR)/cutils.host.o libunicode.c unicode_gen_def.h
|
||||
$(HOST_CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJDIR)/unicode_gen.host.o $(OBJDIR)/cutils.host.o
|
||||
|
||||
106
quickjs/patches/001-no-fenv-dtoa-libbf.patch
Normal file
106
quickjs/patches/001-no-fenv-dtoa-libbf.patch
Normal file
@@ -0,0 +1,106 @@
|
||||
diff --git a/quickjs.c b/quickjs.c
|
||||
index 7916013..3936eec 100644
|
||||
--- a/quickjs.c
|
||||
+++ b/quickjs.c
|
||||
@@ -67,6 +67,16 @@
|
||||
#define CONFIG_PRINTF_RNDN
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_PRINTF_RNDN
|
||||
+#if !defined(FE_DOWNWARD) || !defined(FE_UPWARD)
|
||||
+#ifdef CONFIG_BIGNUM
|
||||
+#define CONFIG_DTOA_LIBBF
|
||||
+#else
|
||||
+#error "CONFIG_BIGNUM required if printf is RNDN and there is no fenv support"
|
||||
+#endif
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
/* define to include Atomics.* operations which depend on the OS
|
||||
threads */
|
||||
#if !defined(EMSCRIPTEN)
|
||||
@@ -11299,6 +11309,11 @@ static char *i64toa(char *buf_end, int64_t n, unsigned int base)
|
||||
return q;
|
||||
}
|
||||
|
||||
+/* maximum buffer size for js_dtoa */
|
||||
+#define JS_DTOA_BUF_SIZE 128
|
||||
+
|
||||
+#ifndef CONFIG_DTOA_LIBBF
|
||||
+
|
||||
/* buf1 contains the printf result */
|
||||
static void js_ecvt1(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
int rounding_mode, char *buf1, int buf1_size)
|
||||
@@ -11318,9 +11333,6 @@ static void js_ecvt1(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
*decpt = atoi(buf1 + n_digits + 2 + (n_digits > 1)) + 1;
|
||||
}
|
||||
|
||||
-/* maximum buffer size for js_dtoa */
|
||||
-#define JS_DTOA_BUF_SIZE 128
|
||||
-
|
||||
/* needed because ecvt usually limits the number of digits to
|
||||
17. Return the number of digits. */
|
||||
static int js_ecvt(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
@@ -11429,6 +11441,8 @@ static void js_fcvt(char *buf, int buf_size, double d, int n_digits)
|
||||
js_fcvt1(buf, buf_size, d, n_digits, rounding_mode);
|
||||
}
|
||||
|
||||
+#endif /* CONFIG_DTOA_LIBBF */
|
||||
+
|
||||
/* radix != 10 is only supported with flags = JS_DTOA_VAR_FORMAT */
|
||||
/* use as many digits as necessary */
|
||||
#define JS_DTOA_VAR_FORMAT (0 << 0)
|
||||
@@ -11442,8 +11456,10 @@ static void js_fcvt(char *buf, int buf_size, double d, int n_digits)
|
||||
/* XXX: slow and maybe not fully correct. Use libbf when it is fast enough.
|
||||
XXX: radix != 10 is only supported for small integers
|
||||
*/
|
||||
-static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
+static JSValue js_dtoa(JSContext *ctx,
|
||||
+ double d, int radix, int n_digits, int flags)
|
||||
{
|
||||
+ char buf[JS_DTOA_BUF_SIZE];
|
||||
char *q;
|
||||
|
||||
if (!isfinite(d)) {
|
||||
@@ -11465,6 +11481,25 @@ static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
ptr = i64toa(buf1 + sizeof(buf1), i64, radix);
|
||||
strcpy(buf, ptr);
|
||||
} else {
|
||||
+#ifdef CONFIG_DTOA_LIBBF
|
||||
+ bf_flags_t bf_flags;
|
||||
+ generic_conv:
|
||||
+ bf_flags = BF_RNDNA;
|
||||
+ switch (flags & 3) {
|
||||
+ case JS_DTOA_VAR_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FREE_MIN;
|
||||
+ break;
|
||||
+ case JS_DTOA_FIXED_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FIXED;
|
||||
+ break;
|
||||
+ case JS_DTOA_FRAC_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FRAC;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (flags & JS_DTOA_FORCE_EXP)
|
||||
+ bf_flags |= BF_FTOA_FORCE_EXP;
|
||||
+ return js_ftoa(ctx, JS_NewFloat64(ctx, d), radix, n_digits, bf_flags);
|
||||
+#else /* CONFIG_DTOA_LIBBF */
|
||||
if (d == 0.0)
|
||||
d = 0.0; /* convert -0 to 0 */
|
||||
if (flags == JS_DTOA_FRAC_FORMAT) {
|
||||
@@ -11528,14 +11563,8 @@ static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
sprintf(q, "%d", p);
|
||||
}
|
||||
}
|
||||
+#endif /* CONFIG_DTOA_LIBBF */
|
||||
}
|
||||
-}
|
||||
-
|
||||
-static JSValue js_dtoa(JSContext *ctx,
|
||||
- double d, int radix, int n_digits, int flags)
|
||||
-{
|
||||
- char buf[JS_DTOA_BUF_SIZE];
|
||||
- js_dtoa1(buf, d, radix, n_digits, flags);
|
||||
return JS_NewString(ctx, buf);
|
||||
}
|
||||
|
||||
126
quickjs/patches/002-fix_std_loadFile.patch
Normal file
126
quickjs/patches/002-fix_std_loadFile.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
diff --git a/quickjs-libc.c b/quickjs-libc.c
|
||||
index e180dd0..76182d2 100644
|
||||
--- a/quickjs-libc.c
|
||||
+++ b/quickjs-libc.c
|
||||
@@ -358,12 +358,89 @@ fail:
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
+// For reading files that are not seekable, per second answer from stackoverflow:
|
||||
+// https://stackoverflow.com/questions/14002954/c-programming-how-to-read-the-whole-file-contents-into-a-buffer
|
||||
+
|
||||
+#define READALL_CHUNK 10*1024
|
||||
+
|
||||
+static int readall(FILE *f, JSContext *ctx, uint8_t **dataptr, size_t *sizeptr)
|
||||
+{
|
||||
+ uint8_t *data = NULL, *temp;
|
||||
+ size_t size = 0;
|
||||
+ size_t used = 0;
|
||||
+ size_t n;
|
||||
+
|
||||
+ while (1) {
|
||||
+ if (used + READALL_CHUNK + 1 > size) {
|
||||
+ size = used + READALL_CHUNK + 1;
|
||||
+
|
||||
+ /* Overflow check. Some ANSI C compilers
|
||||
+ may optimize this away, though. */
|
||||
+ if (size <= used) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx)
|
||||
+ temp = js_realloc(ctx, data, size);
|
||||
+ else
|
||||
+ temp = realloc(data, size);
|
||||
+
|
||||
+ if (temp == NULL) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ data = temp;
|
||||
+ }
|
||||
+
|
||||
+ n = fread(data + used, 1, READALL_CHUNK, f);
|
||||
+ if (n == 0)
|
||||
+ break;
|
||||
+
|
||||
+ used += n;
|
||||
+ }
|
||||
+
|
||||
+ if (ferror(f)) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx)
|
||||
+ temp = js_realloc(ctx, data, used + 1);
|
||||
+ else
|
||||
+ temp = realloc(data, used + 1);
|
||||
+
|
||||
+ if (temp == NULL) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ data = temp;
|
||||
+ data[used] = '\0';
|
||||
+
|
||||
+ *dataptr = data;
|
||||
+ *sizeptr = used;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
uint8_t *buf;
|
||||
size_t buf_len;
|
||||
- long lret;
|
||||
+ long lret = 0;
|
||||
|
||||
f = fopen(filename, "rb");
|
||||
if (!f)
|
||||
@@ -371,7 +448,7 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
if (fseek(f, 0, SEEK_END) < 0)
|
||||
goto fail;
|
||||
lret = ftell(f);
|
||||
- if (lret < 0)
|
||||
+ if (lret <= 0)
|
||||
goto fail;
|
||||
/* XXX: on Linux, ftell() return LONG_MAX for directories */
|
||||
if (lret == LONG_MAX) {
|
||||
@@ -387,13 +464,19 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
buf = malloc(buf_len + 1);
|
||||
if (!buf)
|
||||
goto fail;
|
||||
- if (fread(buf, 1, buf_len, f) != buf_len) {
|
||||
- errno = EIO;
|
||||
+ buf_len = fread(buf, 1, buf_len, f);
|
||||
+ if (ferror(f)) {
|
||||
if (ctx)
|
||||
js_free(ctx, buf);
|
||||
else
|
||||
free(buf);
|
||||
fail:
|
||||
+ // Files in proc and sysfs may not be seekable or may falsely
|
||||
+ // appear to be of zero size. Try to read them in another way.
|
||||
+ if (lret == 0 && readall(f, ctx, &buf, pbuf_len) == 0) {
|
||||
+ fclose(f);
|
||||
+ return buf;
|
||||
+ }
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
@@ -31,7 +31,6 @@ define Package/usermngr
|
||||
DEPENDS:=+shadow-utils +libopenssl +libuci +libubox +ubus
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +bbfdmd
|
||||
DEPENDS+=+@BUSYBOX_CONFIG_ADDUSER +@BUSYBOX_CONFIG_DELUSER +@BUSYBOX_CONFIG_ADDGROUP +@BUSYBOX_CONFIG_DELGROUP +shadow-usermod
|
||||
DEPENDS+=+@SHADOW_UTILS_USE_PAM
|
||||
DEPENDS+=+linux-pam
|
||||
DEPENDS+=+passwdqc
|
||||
TITLE:=Package to add Device.Users. datamodel support
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifidmd
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_VERSION:=1.1.38
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/wifidmd.git
|
||||
PKG_SOURCE_VERSION:=5b88457dfb4558f42c8690d201d74f67073dd77d
|
||||
PKG_SOURCE_VERSION:=84fe14515d09380a45d75acf22329a13b9fed312
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -20,8 +20,15 @@ start_service()
|
||||
|
||||
reload_service()
|
||||
{
|
||||
stop
|
||||
start
|
||||
ret=$(ubus call service list '{"name":"wifidmd"}' | jsonfilter -qe '@.wifidmd.instances.wifidmd.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
stop
|
||||
start
|
||||
else
|
||||
ubus send wifidmd.reload
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
Reference in New Issue
Block a user