Skip to content
Closed
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
4 changes: 4 additions & 0 deletions aetherpak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pages_url: https://lemonade-sdk.github.io/flatpak
branding:
index_template: .github/workflows/templates/lemonade.html

defaults:
remotes:
amd-npu: https://abn.github.io/flatpaks-amd-npu/amd-npu.flatpakrepo

apps:
- id: ai.lemonade_server.Lemonade
branch: stable
Expand Down
27 changes: 27 additions & 0 deletions ai.lemonade_server.Lemonade/ai.lemonade_server.Lemonade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ command: lemonade-supervisor
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
- org.freedesktop.Sdk.Extension.node24
- org.freedesktop.Sdk.Extension.xrt

finish-args:
- --share=ipc
Expand All @@ -22,20 +23,44 @@ finish-args:
- --env=WEBKIT_DISABLE_DMABUF_RENDERER=1
- --env=LEMONADE_DISABLE_SYSTEMD_JOURNAL=1

build-options:
no-debuginfo: true

cleanup:
- /include
- /lib/pkgconfig
- /lib/cmake
- /share/man
- /extensions/backends/*/include
- /extensions/backends/*/lib/pkgconfig
- /extensions/backends/*/lib/cmake
- /extensions/backends/*/share/man
- '*.a'
- '*.la'

add-extensions:
ai.lemonad_server.Lemonade.backends:
directory: extensions/backends
subdirectories: true
no-autodownload: true
autodelete: true
ai.lemonad_server.Lemonade.backends.fastflowlm:
directory: extensions/backends/fastflowlm
bundle: true
no-autodownload: true
autodelete: true
download-if: have-kernel-module-amdxdna
enable-if: have-kernel-module-amdxdna

modules:
- modules/nlohmann-json.json
- modules/cli11.json
- modules/cpp-httplib.json
- modules/libwebsockets.json
- modules/mbedtls.json
- modules/backends/fastflowlm/boost.yaml
- modules/backends/fastflowlm/fftw3f.yaml
- modules/backends/fastflowlm/fastflowlm.yaml
- shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json

- name: lemonade-cpp
Expand Down Expand Up @@ -97,6 +122,7 @@ modules:
buildsystem: simple
build-commands:
- install -Dm755 lemonade-supervisor.sh /app/bin/lemonade-supervisor
- ls -all /app/extensions/backends || true
sources:
- type: file
path: lemonade-supervisor.sh
Expand All @@ -114,3 +140,4 @@ modules:
- type: file
path: ai.lemonade_server.Lemonade.appdata.xml
- *lemonade-source

11 changes: 11 additions & 0 deletions ai.lemonade_server.Lemonade/lemonade-supervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ DATA_ROOT="${LEMONADE_DATA_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/lemonade}"
case "$HOST" in 0.0.0.0|::|"") CONNECT=127.0.0.1 ;; *) CONNECT="$HOST" ;; esac
HEALTH="http://$CONNECT:$PORT/api/v1/health"

# Wire any installed backend extension (extensions/backends/<name>) onto the
# environment so the server can discover and launch it.
for d in /app/extensions/backends/*/; do
[ -d "$d" ] || continue
d="${d%/}"
[ -d "$d/bin" ] && export PATH="$d/bin:$PATH"
[ -d "$d/lib" ] && export LD_LIBRARY_PATH="$d/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# a backend bundling the XRT runtime (e.g. FastFlowLM/NPU) ships lib/xrt
[ -e "$d/lib/xrt" ] && export XILINX_XRT="$d"
done

# second launch / deep link: forward to the running app, then exit
LOCK="$XDG_RUNTIME_DIR/app/$FLATPAK_ID/supervisor.lock"
mkdir -p "$(dirname "$LOCK")"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -229,18 +229,6 @@
- if(FFTW3_PKG_FOUND)
- target_include_directories(flm PUBLIC ${FFTW3_PKG_INCLUDE_DIRS})
- target_link_libraries(flm PUBLIC ${FFTW3_PKG_LIBRARIES})
- else()
- target_link_libraries(flm PUBLIC fftw3)
- endif()
if(FFTW3F_PKG_FOUND)
target_include_directories(flm PUBLIC ${FFTW3F_PKG_INCLUDE_DIRS})
target_link_libraries(flm PUBLIC ${FFTW3F_PKG_LIBRARIES})
else()
target_link_libraries(flm PUBLIC fftw3f)
endif()
- if(FFTW3L_PKG_FOUND)
- target_include_directories(flm PUBLIC ${FFTW3L_PKG_INCLUDE_DIRS})
- target_link_libraries(flm PUBLIC ${FFTW3L_PKG_LIBRARIES})
- else()
- target_link_libraries(flm PUBLIC fftw3l)
- endif()
@@ -347,9 +331,0 @@
-if(NOT WIN32 AND NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr" AND NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
- install(CODE "
- message(STATUS \"Creating symlink for flm\")
- file(MAKE_DIRECTORY \"$ENV{DESTDIR}/usr/local/bin\")
- execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink
- \"${CMAKE_INSTALL_PREFIX}/bin/flm\"
- \"$ENV{DESTDIR}/usr/local/bin/flm\")"
- )
-endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: boost
buildsystem: simple
build-commands:
- ./bootstrap.sh --prefix=/app/extensions/backends/fastflowlm --with-libraries=program_options
- ./b2 -j${FLATPAK_BUILDER_N_JOBS:-4} variant=release threading=multi link=shared,static install
sources:
- type: archive
url: https://archives.boost.io/release/1.81.0/source/boost_1_81_0.tar.gz
sha256: 205666dea9f6a7cfed87c7a6dfbeb52a2c1b9de55712c9c1a87735d7181452b6
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: fastflowlm
buildsystem: cmake-ninja
build-options:
append-path: /usr/lib/sdk/rust-stable/bin
env:
CARGO_NET_OFFLINE: 'true'
PKG_CONFIG_PATH: /app/extensions/backends/fastflowlm/lib/pkgconfig:/app/extensions/backends/fastflowlm/share/pkgconfig
LDFLAGS: -L/app/extensions/backends/fastflowlm/lib -L/app/extensions/backends/fastflowlm/lib64 -L/usr/lib/sdk/xrt/lib -L/usr/lib/sdk/xrt/lib64
config-opts:
- -DCMAKE_INSTALL_PREFIX=/app/extensions/backends/fastflowlm
- -DFLM_VERSION=0.9.43
- -DNPU_VERSION=32.0.203.304
- -DCMAKE_PREFIX_PATH=/app/extensions/backends/fastflowlm;/usr/lib/sdk/xrt
- -DXRT_INCLUDE_DIR=/usr/lib/sdk/xrt/include
- -DXRT_LIB_DIR=/usr/lib/sdk/xrt/lib
- -DCMAKE_XCLBIN_PREFIX=/app/extensions/backends/fastflowlm/share/flm
post-install:
- mkdir -p /app/extensions/backends/fastflowlm/lib
- cp -pv /usr/lib/sdk/xrt/lib/*.so* /app/extensions/backends/fastflowlm/lib/ || true
- cp -pv /usr/lib/sdk/xrt/lib64/*.so* /app/extensions/backends/fastflowlm/lib/ || true
- cp -a /usr/lib/sdk/xrt/lib/xrt /app/extensions/backends/fastflowlm/lib/ 2>/dev/null || true
- chmod a+rX /app/extensions/backends/fastflowlm/bin/flm
subdir: src
sources:
- type: git
url: https://github.com/FastFlowLM/FastFlowLM.git
commit: 5324dd73162e7005546d287aa4daeceff56e3b2c
- type: patch
path: 0001-fastflowlm-disable-usr-local-symlink.patch
- type: inline
contents: |
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "/run/build/fastflowlm/cargo/vendor"
dest: third_party/tokenizers-cpp/rust/.cargo
dest-filename: config.toml
- generated-flm-cargo-sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: fftw3f
buildsystem: simple
build-commands:
- ./configure --prefix=/app/extensions/backends/fastflowlm
--libdir=/app/extensions/backends/fastflowlm/lib
--enable-shared --disable-static --enable-threads --enable-float --enable-avx
- make -j${FLATPAK_BUILDER_N_JOBS:-4}
- make install
sources:
- type: archive
url: https://www.fftw.org/fftw-3.3.10.tar.gz
sha256: 56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467
Loading
Loading