Skip to content

Commit

Permalink
Merge branch 'master' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
korolartemnexus authored Feb 5, 2025
2 parents b5a6867 + 92953c1 commit 140df03
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 12 deletions.
35 changes: 31 additions & 4 deletions lang/lua-cjson/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=lua-cjson
PKG_VERSION:=2.1.0
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_MAINTAINER:=Dirk Chang <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
Expand All @@ -18,31 +18,52 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://kyne.au/~mark/software/download/
PKG_HASH:=51bc69cd55931e0cba2ceae39e9efa2483f4292da3a88a1ed470eda829f6c778

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

HOST_BUILD_DEPENDS:=lua/host

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/lua-cjson
define Package/lua-cjson/default
SUBMENU:=Lua
SECTION:=lang
CATEGORY:=Languages
TITLE:=Lua CJSON parser
URL:=https://github.com/mpx/lua-cjson
DEPENDS:= +lua
endef

define Package/lua-cjson/description
define Package/lua-cjson
$(Package/lua-cjson/default)
DEPENDS+=+liblua
VARIANT:=lua-51
endef

define Package/lua-cjson-lua5.3
$(Package/lua-cjson/default)
DEPENDS+=+liblua5.3
VARIANT:=lua-53
endef

define Package/lua-cjson/default/description
Lua CJSON is a fast JSON encoding/parsing module for Lua.
endef

define Package/lua-cjson-5.3/description
Lua5.3 CJSON is a fast JSON encoding/parsing module for Lua.
endef

CMAKE_OPTIONS += \
-DUSE_LUA=ON

CMAKE_HOST_OPTIONS += \
-DLUA_MATH_LIBRARY=m

ifeq ($(BUILD_VARIANT),lua-53)
CMAKE_OPTIONS += -DUSE_LUA53=ON
endif

define Package/lua-cjson/install
$(INSTALL_DIR) $(1)/usr/lib/lua
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cjson.so $(1)/usr/lib/lua/
Expand All @@ -51,5 +72,11 @@ define Package/lua-cjson/install
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lua/cjson/util.lua $(1)/usr/lib/lua/cjson
endef

define Package/lua-cjson-lua5.3/install
$(INSTALL_DIR) $(1)/usr/local/lib/lua/5.3
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cjson.so $(1)/usr/local/lib/lua/5.3
endef

$(eval $(call HostBuild))
$(eval $(call BuildPackage,lua-cjson))
$(eval $(call BuildPackage,lua-cjson-lua5.3))
65 changes: 65 additions & 0 deletions lang/lua-cjson/patches/001-add-support-lua5-3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -1227,7 +1227,10 @@ static void json_process_value(lua_State
lua_pushlstring(l, token->value.string, token->string_len);
break;;
case T_NUMBER:
- lua_pushnumber(l, token->value.number);
+ if ((lua_Integer)token->value.number == token->value.number)
+ lua_pushinteger(l, (lua_Integer)token->value.number);
+ else
+ lua_pushnumber(l, token->value.number);
break;;
case T_BOOLEAN:
lua_pushboolean(l, token->value.boolean);
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,19 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

-find_package(Lua51 REQUIRED)
-include_directories(${LUA_INCLUDE_DIR})
+if(USE_LUA53)
+ find_path(LUA53_INCLUDE_DIRS lua.h PATH_SUFFIXES lua5.3)
+ find_library(LUA53_LIBRARIES lua5.3)
+
+ if (NOT LUA53_INCLUDE_DIRS OR NOT LUA53_LIBRARIES)
+ message(FATAL_ERROR "Liblua 5.3 is required.")
+ endif()
+
+ include_directories(${LUA53_INCLUDE_DIRS})
+else()
+ find_package(Lua51 REQUIRED)
+ include_directories(${LUA_INCLUDE_DIR})
+endif()

if(NOT USE_INTERNAL_FPCONV)
# Use libc number conversion routines (strtod(), sprintf())
@@ -51,7 +62,12 @@ if(NOT HAVE_ISINF)
endif()

set(_MODULE_LINK "${CMAKE_THREAD_LIBS_INIT}")
-get_filename_component(_lua_lib_dir ${LUA_LIBRARY} PATH)
+
+if(USE_LUA53)
+ get_filename_component(_lua_lib_dir ${LUA53_LIBRARIES} PATH)
+else()
+ get_filename_component(_lua_lib_dir ${LUA_LIBRARY} PATH)
+endif()

if(APPLE)
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
@@ -65,7 +81,11 @@ if(WIN32)
# Windows sprintf()/strtod() handle NaN/inf differently. Not supported.
add_definitions(-DDISABLE_INVALID_NUMBERS)
else()
- set(_lua_module_dir "${_lua_lib_dir}/lua/5.1")
+ if(USE_LUA53)
+ set(_lua_module_dir "${_lua_lib_dir}/lua/5.3")
+ else()
+ set(_lua_module_dir "${_lua_lib_dir}/lua/5.1")
+ endif()
endif()

add_library(cjson MODULE lua_cjson.c strbuf.c ${FPCONV_SOURCES})
2 changes: 1 addition & 1 deletion net/ddns-scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.2
PKG_RELEASE:=59
PKG_RELEASE:=60

PKG_LICENSE:=GPL-2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
json_init
json_add_string name "$username"
json_add_string data "$__IP"
[ $use_ipv6 -ne 0 ] && json_add_string type "AAAA" || json_add_string type "A"

__STATUS=$(curl -Ss -X PUT "https://api.digitalocean.com/v2/domains/${domain}/records/${param_opt}" \
-H "Authorization: Bearer ${password}" \
Expand Down
22 changes: 21 additions & 1 deletion net/keepalived/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,17 @@ endif
$(INSTALL_DIR) $(1)/etc/hotplug.d/keepalived
$(INSTALL_DATA) ./files/hotplug-user \
$(1)/etc/hotplug.d/keepalived/01-user
$(INSTALL_DATA) ./files/etc/hotplug.d/keepalived/01-ubus \
$(1)/etc/hotplug.d/keepalived/01-ubus

$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./files/usr/libexec/rpcd/keepalived \
$(1)/usr/libexec/rpcd/keepalived

$(INSTALL_DIR) $(1)/usr/libexec/keepalived/rpc
$(INSTALL_DATA) ./files/usr/libexec/keepalived/rpc/status.sh \
$(1)/usr/libexec/keepalived/rpc/status.sh

ifneq ($(CONFIG_KEEPALIVED_SNMP_VRRP)$(CONFIG_KEEPALIVED_SNMP_CHECKER)$(CONFIG_KEEPALIVED_SNMP_RFC2)$(CONFIG_KEEPALIVED_SNMP_RFC3),)
$(INSTALL_DIR) $(1)/usr/share/snmp/mibs
endif
Expand Down Expand Up @@ -318,7 +324,21 @@ define Package/keepalived-sync/install
$(1)/usr/libexec/keepalived/rpc/sync.sh

$(INSTALL_DIR) $(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/* \
$(CP) ./files/etc/hotplug.d/keepalived/501-rpcd \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/505-system \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/511-firewall \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/551-dnsmasq \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/555-dropbear \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/600-uhttpd \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/700-luci \
$(1)/etc/hotplug.d/keepalived
$(CP) ./files/etc/hotplug.d/keepalived/810-files \
$(1)/etc/hotplug.d/keepalived
endef

Expand Down
46 changes: 46 additions & 0 deletions net/keepalived/files/etc/hotplug.d/keepalived/01-ubus
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

. /lib/functions.sh

KEEPALIVED_STATUS_DIR="/var/run/keepalived"

# Add a TAG for configured INSTANCE/GROUP
tag_config() {
local cfg="$1"
local type="$2"
local name

config_get name "$cfg" name
mkdir -p "${KEEPALIVED_STATUS_DIR}/${name}_${type}"
touch "${KEEPALIVED_STATUS_DIR}/${name}_${type}/TAG"
}

main() {
# Remove TAG flag
for dir in ${KEEPALIVED_STATUS_DIR}/*; do
rm -rf "$dir/TAG"
done

config_load keepalived
config_foreach tag_config vrrp_instance INSTANCE
config_foreach tag_config vrrp_sync_group GROUP

# Delete run time directories which are not configured anymore
for dir in ${KEEPALIVED_STATUS_DIR}/*; do
if [ ! -e "$dir/TAG" ]; then
rm -rf "$dir"
fi
done

# Do not update 'GROUP' status if action is 'NOTIFY'
[ "$ACTION" = "NOTIFY" ] && [ "$TYPE" = "GROUP" ] && return

if [ -n "${NAME}" ] && [ -n "${TYPE}" ]; then
mkdir -p "${KEEPALIVED_STATUS_DIR}/${NAME}_${TYPE}"
[ -n "$ACTION" ] || ACTION="NOTIFY_UNKNOWN"
echo "$ACTION" > "${KEEPALIVED_STATUS_DIR}/${NAME}_${TYPE}/STATUS"
date +'%s' > "${KEEPALIVED_STATUS_DIR}/${NAME}_${TYPE}/TIME"
fi
}

main
34 changes: 34 additions & 0 deletions net/keepalived/files/usr/libexec/keepalived/rpc/status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

. /usr/share/libubox/jshn.sh

KEEPALIVED_STATUS_DIR="/var/run/keepalived"

dump() {
local type="${1}"
local value name time status

json_add_array "$(echo "$type" | tr A-Z a-z)"
for dir in ${KEEPALIVED_STATUS_DIR}/*; do
value="${dir##*_}"
name="${dir%_*}"
name="${name##*/}"
[ -f "${dir}/TIME" ] && time=$(cat "${dir}/TIME")
[ -f "${dir}/STATUS" ] && status=$(cat "${dir}/STATUS")
if [ "${value}" = "${type}" ]; then
json_add_object
json_add_string "name" "${name}"
json_add_int "event" "${time}"
json_add_string "status" "${status}"
json_close_object
fi
done
json_close_array
}

status() {
json_init
dump "INSTANCE"
dump "GROUP"
json_dump
}
6 changes: 3 additions & 3 deletions net/rclone/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=rclone
PKG_VERSION:=1.68.2
PKG_RELEASE:=2
PKG_VERSION:=1.69.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/rclone/rclone/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6c4c1a1702633c7a8f8755a9cfb951c3ae0b7bcc2e210b92e191250b6aae2e9f
PKG_HASH:=9b360793108d0b9a3208dacece76e72f5d9253c6710da1c08a1eb8a91eeb9854

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
Expand Down
4 changes: 2 additions & 2 deletions net/sing-box/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=sing-box
PKG_VERSION:=1.10.7
PKG_VERSION:=1.11.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=402b618148b58f5ff6c1bee4f4fdcf7cdcb88a2df6a8bd682ea742a89b5be9ec
PKG_HASH:=d4a48b2fe450041fea2d25955ddc092a62afc8da7bb442b49cb12575123b2edb

PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
Expand Down
2 changes: 1 addition & 1 deletion net/strongswan/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=strongswan
PKG_VERSION:=5.9.14
PKG_RELEASE:=5
PKG_RELEASE:=6

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://download.strongswan.org/ https://download2.strongswan.org/
Expand Down
19 changes: 19 additions & 0 deletions net/strongswan/patches/0905-wolfssl-parse_error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 60336ceecbd1cda73aa26dd44cfdaf2e31a046e1 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <[email protected]>
Date: Fri, 4 Oct 2024 11:23:28 +0200
Subject: [PATCH] wolfssl: Don't undef PARSE_ERROR as headers included later
might refer to it

---
src/libstrongswan/plugins/wolfssl/wolfssl_common.h | 2 --
1 file changed, 2 deletions(-)

--- a/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
+++ b/src/libstrongswan/plugins/wolfssl/wolfssl_common.h
@@ -78,6 +78,4 @@ typedef union {
} wolfssl_ed_key;
#endif /* HAVE_ED25519 || HAVE_ED448 */

-#undef PARSE_ERROR
-
#endif /* WOLFSSL_PLUGIN_COMMON_H_ */

0 comments on commit 140df03

Please sign in to comment.