mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-09-22 11:00:49 +00:00
floret: add recipe for floret 0.10.5
Add a new recipe for floret, a fastText fork with Bloom embeddings for compact, full-coverage vectors compatible with spaCy. Builds shared library, static library, and CLI binary via CMake with zlib. Includes a cross-compilation patch (CMake 3.5, <cstdint> for GCC 15.x) and installs the shared library under its real SONAME to keep libfloret.so as a symlink. Signed-off-by: Varun Singhal <varusing@qti.qualcomm.com> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Varun Singhal <varusing@qti.qualcomm.com>
|
||||
Date: Tue, 27 Jan 2026 21:37:55 +0530
|
||||
Subject: [PATCH] floret: Adjust CMake flags for cross-compilation
|
||||
|
||||
- Update cmake_minimum_required from 2.8.9 to 3.5
|
||||
- Add missing #include <cstdint> to args.cc for GCC 15.x
|
||||
|
||||
Upstream-Status: Inappropriate [cross-compilation fix for Yocto/OE]
|
||||
Signed-off-by: Varun Singhal <varusing@qti.qualcomm.com>
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
src/args.cc | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -6,7 +6,7 @@
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
#
|
||||
|
||||
-cmake_minimum_required(VERSION 2.8.9)
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
project(floret)
|
||||
|
||||
# The version number.
|
||||
|
||||
diff --git a/src/args.cc b/src/args.cc
|
||||
--- a/src/args.cc
|
||||
+++ b/src/args.cc
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
+#include <cstdint>
|
||||
|
||||
namespace fasttext {
|
||||
|
||||
Args::Args() {
|
||||
--
|
||||
2.43.0
|
||||
@@ -0,0 +1,96 @@
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
|
||||
SUMMARY = "fastText + Bloom embeddings for compact, full-coverage vectors"
|
||||
DESCRIPTION = "\
|
||||
floret is a fastText fork with Bloom embeddings for compact, \
|
||||
full-coverage vectors compatible with spaCy. It is designed \
|
||||
specifically for use on small, low-powered, embedded devices \
|
||||
where memory efficiency and full vocabulary coverage are required. \
|
||||
"
|
||||
HOMEPAGE = "https://github.com/explosion/floret"
|
||||
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=4ce16d1d2b4c556959d654417007b713"
|
||||
|
||||
DEPENDS = "zlib"
|
||||
|
||||
SRC_URI = "git://github.com/explosion/floret.git;protocol=https;branch=main \
|
||||
file://0001-PATCH-floret-Adjust-CMake-flags-for-cross-compilation.patch"
|
||||
|
||||
SRCREV = "${AUTOREV}"
|
||||
|
||||
inherit cmake
|
||||
|
||||
# Remove -march=native: invalid for cross-compilation
|
||||
CXXFLAGS:remove = "-march=native"
|
||||
CXXFLAGS += "-std=c++17"
|
||||
|
||||
EXTRA_OECMAKE = "\
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libdir}
|
||||
install -d ${D}${includedir}/floret
|
||||
install -d ${D}${bindir}
|
||||
install -d ${D}${libdir}/pkgconfig
|
||||
|
||||
# Install the shared library under its real SONAME, then recreate the
|
||||
# unversioned dev symlink. Installing through the libfloret.so symlink
|
||||
# would leave ${libdir}/libfloret.so as an ELF file rather than a link,
|
||||
# which makes debian.bbclass rename both ${PN} and ${PN}-dev to libfloret0
|
||||
# (two packages with one name), causing do_create_package_spdx to fail.
|
||||
if [ -e ${B}/libfloret.so ]; then
|
||||
soname=$(${OBJDUMP} -p ${B}/libfloret.so | awk '/SONAME/ { print $2 }')
|
||||
install -m 0755 ${B}/libfloret.so ${D}${libdir}/$soname
|
||||
ln -sf $soname ${D}${libdir}/libfloret.so
|
||||
fi
|
||||
|
||||
# Install static library
|
||||
if [ -f ${B}/libfloret.a ]; then
|
||||
install -m 0644 ${B}/libfloret.a ${D}${libdir}/libfloret.a
|
||||
fi
|
||||
|
||||
# Install floret CLI binary
|
||||
if [ -f ${B}/floret ]; then
|
||||
install -m 0755 ${B}/floret ${D}${bindir}/floret
|
||||
fi
|
||||
|
||||
# Install headers
|
||||
if [ -d ${S}/src ]; then
|
||||
cp -r ${S}/src/*.h ${D}${includedir}/floret/
|
||||
fi
|
||||
|
||||
# Generate and install pkg-config file
|
||||
cat > ${D}${libdir}/pkgconfig/floret.pc << EOF
|
||||
prefix=/usr
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${exec_prefix}/lib
|
||||
includedir=\${prefix}/include
|
||||
|
||||
Name: floret
|
||||
Description: fastText + Bloom embeddings for compact, full-coverage vectors
|
||||
Version: ${PV}
|
||||
Libs: -L\${libdir} -lfloret
|
||||
Cflags: -I\${includedir}/floret
|
||||
EOF
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-cli"
|
||||
|
||||
FILES:${PN}-cli = "${bindir}/floret"
|
||||
FILES:${PN}-dev += "${libdir}/libfloret.so ${includedir}/floret ${libdir}/pkgconfig/floret.pc"
|
||||
FILES:${PN}-staticdev = "${libdir}/libfloret.a"
|
||||
FILES:${PN} += "${libdir}/libfloret.so.*"
|
||||
|
||||
INSANE_SKIP:${PN} += "buildpaths"
|
||||
INSANE_SKIP:${PN}-dev += "buildpaths"
|
||||
INSANE_SKIP:${PN}-staticdev += "buildpaths"
|
||||
INSANE_SKIP:${PN}-cli += "buildpaths"
|
||||
|
||||
SUMMARY:${PN} = "floret runtime library"
|
||||
SUMMARY:${PN}-cli = "floret command-line tool for training Bloom embeddings"
|
||||
SUMMARY:${PN}-dev = "floret development headers and shared library"
|
||||
SUMMARY:${PN}-staticdev = "floret static library"
|
||||
Reference in New Issue
Block a user