Skip to content

Commit 533fdec

Browse files
committed
sci-ml/lemonade: add webui USE flag for the bundled web frontend
lemond serves a React single-page app at the server root (/) when resources/web-app/ is present; the build passed -DBUILD_WEB_APP=OFF, so lemond only served a static "built without a web app" placeholder there. The new webui flag flips BUILD_WEB_APP=ON, which runs npm ci + webpack at build time (net-libs/nodejs provides node+npm) and stages the SPA into share/lemonade-server/resources/web-app/, where lemond auto-detects and serves it. The npm fetch fits the existing network build (PROPERTIES=live plus FetchContent under RESTRICT=network-sandbox). Upstream's USE_SYSTEM_NODEJS_MODULES path avoids the fetch but needs React, webpack and the KaTeX assets resolvable under /usr/share/nodejs, which ::gentoo does not package, so npm-at-build is the only viable route. Off by default; the Tauri desktop wrapper stays unbuilt.
1 parent a2b7de4 commit 533fdec

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

sci-ml/lemonade/lemonade-10.10.0-r2.ebuild renamed to sci-ml/lemonade/lemonade-10.10.0-r3.ebuild

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SRC_URI="https://github.com/lemonade-sdk/${PN}/archive/refs/tags/v${PV}.tar.gz -
1515
LICENSE="Apache-2.0"
1616
SLOT="0"
1717
KEYWORDS="~amd64"
18-
IUSE="fastflowlm openrc system-kokoro system-llamacpp system-sdcpp system-whispercpp systemd"
18+
IUSE="fastflowlm openrc system-kokoro system-llamacpp system-sdcpp system-whispercpp systemd webui"
1919

2020
# Upstream's CMake detects nlohmann_json/curl/zstd/CLI11 via pkg-config or
2121
# find_path, but cpp-httplib detection requires a .pc file (which ::gentoo
@@ -54,6 +54,7 @@ BDEPEND="
5454
system-whispercpp? ( app-misc/jq )
5555
system-sdcpp? ( app-misc/jq )
5656
system-kokoro? ( app-misc/jq )
57+
webui? ( net-libs/nodejs[npm] )
5758
"
5859

5960
src_prepare() {
@@ -74,10 +75,16 @@ src_prepare() {
7475
}
7576

7677
src_configure() {
77-
# BUILD_WEB_APP defaults ON on Linux but pulls Node.js + npm install
78-
# at build time; BUILD_TAURI_APP brings cargo + Rust GUI bundling.
79-
# Both are off here for a server-only build; revisit if a USE flag is
80-
# requested for the desktop GUI.
78+
# BUILD_WEB_APP (USE=webui) builds the bundled React SPA that lemond
79+
# serves at the server root (/); without it lemond serves a static
80+
# "built without a web app" placeholder there. The build runs `npm ci`
81+
# (fetching the JS dependency tree from the npm registry — hence the
82+
# network build, already the case here for FetchContent) then webpack.
83+
# net-libs/nodejs provides node+npm. Upstream's USE_SYSTEM_NODEJS_MODULES
84+
# path (system webpack + distro JS libs under /usr/share/nodejs) would
85+
# avoid the npm fetch, but ::gentoo doesn't package those modules, so the
86+
# npm fetch is the only viable route. BUILD_TAURI_APP (cargo + Rust
87+
# desktop GUI + webkit2gtk) stays off — no USE flag for it yet.
8188
#
8289
# Upstream defaults to /opt as the prefix for Linux, but lemond's
8390
# get_resource_path() searches /usr/share/lemonade-server/ and
@@ -86,7 +93,7 @@ src_configure() {
8693
# .deb/.rpm layout and lets the resources resolve cleanly.
8794
local mycmakeargs=(
8895
-DCMAKE_INSTALL_PREFIX="/usr"
89-
-DBUILD_WEB_APP=OFF
96+
-DBUILD_WEB_APP=$(usex webui ON OFF)
9097
-DBUILD_TAURI_APP=OFF
9198
)
9299
cmake_src_configure
@@ -221,6 +228,12 @@ pkg_postinst() {
221228
elog " lemond # start the server (port 13305 by default)"
222229
elog " lemonade run <model> # CLI client"
223230
elog ""
231+
if use webui; then
232+
elog "Web UI: lemond serves the bundled React app at the server root,"
233+
elog "e.g. http://127.0.0.1:13305/ -- open it in a browser. It shares the"
234+
elog "API's bind, so it is loopback-only unless you widen LEMONADE_HOST."
235+
elog ""
236+
fi
224237
if use openrc; then
225238
elog "OpenRC service (supervise-daemon; auto-restart on crash):"
226239
elog " edit /etc/conf.d/lemonade and set LEMONADE_USER (required)"

sci-ml/lemonade/metadata.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
Lemonade is a local AI server that exposes optimized LLMs through
1010
OpenAI / Anthropic / Ollama compatible APIs, running inference on
1111
AMD NPU and GPU. The C++ server core (lemond, lemonade-server) is
12-
packaged here without the Tauri desktop wrapper or the bundled
13-
web frontend; both are CMake-toggleable and can be added behind
14-
USE flags later if needed.
12+
packaged here without the Tauri desktop wrapper; the bundled web
13+
frontend is available behind USE=webui, and the Tauri wrapper stays
14+
CMake-toggleable and can be added behind a USE flag later if needed.
1515

1616
Pairs with sci-ml/fastflowlm to drive the AMD Ryzen AI XDNA2 NPU
1717
backend.
@@ -24,6 +24,7 @@
2424
<flag name="system-sdcpp">Reuse the system <pkg>sci-misc/stable-diffusion-cpp</pkg> (/usr/bin/sd-server) for the stable-diffusion.cpp backend instead of fetching an upstream prebuilt binary at runtime; build it with your preferred GPU backend (see the post-install notes)</flag>
2525
<flag name="system-whispercpp">Reuse the system <pkg>app-accessibility/whisper-cpp</pkg> (/usr/bin/whisper-server) for the whisper.cpp backend instead of fetching an upstream prebuilt binary at runtime; build it with your preferred GPU backend (see the post-install notes)</flag>
2626
<flag name="systemd">Keep upstream's systemd units (lemond.service, system + user), running as a dedicated <pkg>acct-user/lemonade</pkg></flag>
27+
<flag name="webui">Build the bundled React web frontend (served by lemond at the server root) via <pkg>net-libs/nodejs</pkg>; runs npm/webpack over the network at build time. Without it lemond serves a static placeholder page</flag>
2728
</use>
2829
<upstream>
2930
<remote-id type="github">lemonade-sdk/lemonade</remote-id>

0 commit comments

Comments
 (0)