Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openwrt package and GH workflow #149

Merged
merged 2 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
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
63 changes: 63 additions & 0 deletions .github/workflows/main-openwrt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build for armel (static) using the OpenWrt SDK

on:
push:
pull_request:
schedule:
# Weekly build (on saturday)
- cron: '0 0 * * 4'

jobs:
build-armel-owrt:
runs-on: 'ubuntu-24.04'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: install extra deps for nektos/act
if: ${{ env.ACT }}
run: |
sudo apt-get update
sudo apt-get -y install rsync
- name: Get the SDK
run: |
# in December 2024/January 2025, https://downloads.openwrt.org/snapshots/targets/mxs/generic/openwrt-sdk-mxs-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst
# (master snapshot) worked too, but I prefer a more stable target. The resulting binary was 8 kbytes smaller on master at the time.
wget --progress=dot:giga https://downloads.openwrt.org/releases/24.10.0-rc4/targets/mxs/generic/openwrt-sdk-24.10.0-rc4-mxs-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst
tar xf openwrt-sdk-*.tar.zst
rm -f openwrt-sdk-*.tar.zst
mv openwrt-sdk-* ../sdk
- name: Set up package dir
run: |
cd ../sdk
mkdir -p ../package/voorkant
# I used symlinks in an earlier iteration, which failed because the package dir was inside. Might be an interesting optimisation, please test in GH Actions -and- act if you try symlinks here.
cp "${GITHUB_WORKSPACE}"/openwrt-package/voorkant/Makefile ../package/voorkant/ # I guess this could be a recursive copy instead, in case we add files/ at some point
cp -fpR "${GITHUB_WORKSPACE}" ../package/voorkant/src
( echo "src-link voorkant ${GITHUB_WORKSPACE}/../package" ; cat feeds.conf.default ) > feeds.conf
- name: Update packages feed
run: |
cd "../sdk"
scripts/feeds update packages
scripts/feeds update base
scripts/feeds update voorkant
cd feeds/packages && patch -p1 < ${GITHUB_WORKSPACE}/openwrt-package/libcurl-websockets.patch
- name: Build package
run: |
set -x
cd "../sdk"
scripts/feeds install -f voorkant
cat ${GITHUB_WORKSPACE}/openwrt-package/default-dot-config >> .config
make defconfig
make -j$(nproc) V=s package/voorkant/compile
make -j1 V=s package/index
- name: Prepare artifact
run: |
cd ../sdk
find bin/packages/ -ls
tar cf ${GITHUB_WORKSPACE}/packages.tar bin/packages/ .config
# FIXME: put something useful (git hash?) in artifact name. We also want this in other workflows.
- uses: actions/upload-artifact@v4
with:
name: openwrt-armel-build
path: packages.tar
9 changes: 0 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ endif

incdir = include_directories('./src/')

openssl_dep = dependency('openssl')
zlib_dep = dependency('zlib')

if get_option('front-ftxui').enabled()
ftxui_screen_dep = dependency('ftxui-screen')
ftxui_dom_dep = dependency('ftxui-dom')
Expand All @@ -196,8 +193,6 @@ if get_option('front-ftxui').enabled()
ftxui_screen_dep,
ftxui_dom_dep,
ftxui_component_dep,
openssl_dep,
zlib_dep,
libatomic,
],
)
Expand All @@ -221,8 +216,6 @@ executable(
json_dep,
thread_dep,
curl_dep,
openssl_dep,
zlib_dep,
libatomic,
],
)
Expand Down Expand Up @@ -261,8 +254,6 @@ if get_option('front-lvgl').enabled()
curl_dep,
lvgl_dep,
sdl2_dep,
openssl_dep,
zlib_dep,
libatomic,
date_dep,
quickjs_dep,
Expand Down
9 changes: 9 additions & 0 deletions openwrt-package/default-dot-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_SIGNED_PACKAGES=n

CONFIG_LIBCURL_WEBSOCKETS=y

# we can =n a lot more things, and the list might grow over time
CONFIG_LIBCURL_NGHTTP2=n

# remove this once curl is upgraded to 8.11
CONFIG_LIBCURL_VERBOSE=y
43 changes: 43 additions & 0 deletions openwrt-package/libcurl-websockets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
commit 805f0bbc7f3dfb3ca10d598b9ac53e09c9ecfaaf
Author: Peter van Dijk <[email protected]>
Date: Wed Jan 1 20:15:07 2025 +0100

curl: add LIBCURL_WEBSOCKETS flag

Signed-off-by: Peter van Dijk <[email protected]>

diff --git a/net/curl/Config.in b/net/curl/Config.in
index 29865a87a..04f03a5bd 100644
--- a/net/curl/Config.in
+++ b/net/curl/Config.in
@@ -45,6 +45,10 @@ config LIBCURL_HTTP
bool "HTTP / HTTPS protocol"
default y

+config LIBCURL_WEBSOCKETS
+ bool "WebSockets protocol"
+ default n
+
config LIBCURL_COOKIES
bool "Enable Cookies support"
depends on LIBCURL_HTTP
diff --git a/net/curl/Makefile b/net/curl/Makefile
index 5210f8c8d..fe529fa41 100644
--- a/net/curl/Makefile
+++ b/net/curl/Makefile
@@ -44,6 +44,7 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_LIBCURL_FTP \
CONFIG_LIBCURL_GOPHER \
CONFIG_LIBCURL_HTTP \
+ CONFIG_LIBCURL_WEBSOCKETS \
CONFIG_LIBCURL_IMAP \
CONFIG_LIBCURL_LDAP \
CONFIG_LIBCURL_LDAPS \
@@ -153,6 +154,7 @@ CONFIGURE_ARGS += \
$(call autoconf_bool,CONFIG_LIBCURL_SMTP,smtp) \
$(call autoconf_bool,CONFIG_LIBCURL_TELNET,telnet) \
$(call autoconf_bool,CONFIG_LIBCURL_TFTP,tftp) \
+ $(call autoconf_bool,CONFIG_LIBCURL_WEBSOCKETS,websockets) \
\
$(call autoconf_bool,CONFIG_LIBCURL_COOKIES,cookies) \
$(call autoconf_bool,CONFIG_LIBCURL_CRYPTO_AUTH,crypto-auth) \
36 changes: 36 additions & 0 deletions openwrt-package/voorkant/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# FIXME: license text here

include $(TOPDIR)/rules.mk

PKG_NAME:=voorkant
PKG_RELEASE:=0_git

PKG_LICENSE:=MIT

PKG_BUILD_DEPENDS:=curl nlohmannjson

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/meson.mk

define Package/voorkant
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Non-web Home Assistant frontend
endef

define Package/voorkant/description
FIXME
endef

define Package/voorkant/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt-build/voorkant-lvgl $(1)/usr/bin/
endef

MESON_ARGS += \
--prefer-static -Dlvgl-driver=fbdev -Dfront-ftxui=disabled

# FIXME: we should not need most, maybe all, of these
TARGET_LDFLAGS += -latomic -static -lstdc++ -lgcc_eh

$(eval $(call BuildPackage,voorkant))
Loading