summaryrefslogtreecommitdiff
path: root/dev-libs/foma
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-04 16:47:34 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-04 16:47:34 -0500
commitdda948891d3731927b821ce31f9d9a2d03ba20c5 (patch)
tree99cd40be4cbb0606260da212cd81b8ab2db9da9b /dev-libs/foma
parenta3ceca1b4c0d9bdb550dc23f06ffbb5a8e033bc7 (diff)
downloadbaldeagleos-repo-dda948891d3731927b821ce31f9d9a2d03ba20c5.tar.gz
baldeagleos-repo-dda948891d3731927b821ce31f9d9a2d03ba20c5.tar.xz
baldeagleos-repo-dda948891d3731927b821ce31f9d9a2d03ba20c5.zip
Adding metadata
Diffstat (limited to 'dev-libs/foma')
-rw-r--r--dev-libs/foma/Manifest1
-rw-r--r--dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch41
-rw-r--r--dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch149
-rw-r--r--dev-libs/foma/files/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch71
-rw-r--r--dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild43
-rw-r--r--dev-libs/foma/metadata.xml9
6 files changed, 314 insertions, 0 deletions
diff --git a/dev-libs/foma/Manifest b/dev-libs/foma/Manifest
new file mode 100644
index 000000000000..3ead4d9f91d4
--- /dev/null
+++ b/dev-libs/foma/Manifest
@@ -0,0 +1 @@
+DIST foma-0.10.0_p20220612.tar.gz 179778 BLAKE2B f96bf46404ead44725b609953a01a3966506af98d82e925e981cef65b3f0dc7ae3414ad96df911e380f1f565f9c11ea3f85e93fa5962cc52db5e451d2f39d37c SHA512 4539c937bd20f74dee5274126cc3a950873a87364d0fcbf02e674eca5ef049badb1b2774c2975ec7969f7f24ccffb7dd17842840e3a818b1503957374ceff048
diff --git a/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch b/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch
new file mode 100644
index 000000000000..0aeb26ea9ef3
--- /dev/null
+++ b/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch
@@ -0,0 +1,41 @@
+From 9a99d2d41809422080606bb49531b38ce1e2111a Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Thu, 4 Jan 2024 17:15:27 +0100
+Subject: [PATCH] Fix BOM_codes initializer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Future compilers will reject the current initializer:
+
+io.c:1002:7: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast
+ 1002 | { NULL, 0, NULL },
+ | ^~~~
+io.c:1002:16: error: initialization of ‘char’ from ‘void *’ makes integer from pointer without a cast
+ 1002 | { NULL, 0, NULL },
+ | ^~~~
+io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
+ 996 | static BOM BOM_codes[] = {
+ | ^
+io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
+
+
+The reason is that NULL is usually a pointer constant, which is not
+a valid expression for a character.
+---
+ foma/io.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/foma/io.c b/foma/io.c
+index b7bf69b..da1c57a 100644
+--- a/foma/io.c
++++ b/foma/io.c
+@@ -999,7 +999,7 @@ static BOM BOM_codes[] = {
+ { { 0x00, 0x00, 0xFE, 0xFF }, 4, "UTF-32BE" },
+ { { 0xFF, 0xFE }, 2, "UTF16-LE" },
+ { { 0xFE, 0xFF }, 2, "UTF16-BE" },
+- { NULL, 0, NULL },
++ { { 0, } , 0, NULL },
+ };
+
+ BOM *check_BOM(char *buffer) {
diff --git a/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch b/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch
new file mode 100644
index 000000000000..32a33cdc6af4
--- /dev/null
+++ b/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch
@@ -0,0 +1,149 @@
+From 24fa34e5f3731e2e6995fba25e31a2dbb9df8bb4 Mon Sep 17 00:00:00 2001
+From: Tino Didriksen <mail@tinodidriksen.com>
+Date: Thu, 15 Jun 2023 08:44:54 +0000
+Subject: [PATCH] Fixes for GCC 13 (see https://bugs.debian.org/1037663) and
+ Visual Studio
+
+---
+ foma/cgflookup.c | 2 +-
+ foma/constructions.c | 2 +-
+ foma/flookup.c | 2 +-
+ foma/foma.h | 2 +-
+ foma/fomalib.h | 2 +-
+ foma/iface.c | 4 ++--
+ foma/regex.l | 2 +-
+ foma/regex.y | 7 +++++--
+ foma/spelling.c | 2 +-
+ 9 files changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/foma/cgflookup.c b/foma/cgflookup.c
+index 1cc11be..1bdfddb 100644
+--- a/foma/cgflookup.c
++++ b/foma/cgflookup.c
+@@ -71,7 +71,7 @@ static FILE *INFILE;
+ static struct lookup_chain *chain_head, *chain_tail, *chain_new, *chain_pos;
+ static fsm_read_binary_handle fsrh;
+
+-static char *(*applyer)() = &apply_up; /* Default apply direction = up */
++static char *(*applyer)(struct apply_handle *h, char *word) = &apply_up; /* Default apply direction = up */
+ static void handle_line(char *s);
+ static void app_print(char *result);
+ static char *get_next_line();
+diff --git a/foma/constructions.c b/foma/constructions.c
+index dec4087..ca66db4 100644
+--- a/foma/constructions.c
++++ b/foma/constructions.c
+@@ -41,7 +41,7 @@ int sort_cmp(const void *a, const void *b) {
+ return (((const struct fsm_state *)a)->state_no - ((const struct fsm_state *)b)->state_no);
+ }
+
+-INLINE int add_fsm_arc(struct fsm_state *fsm, int offset, int state_no, int in, int out, int target, int final_state, int start_state);
++int add_fsm_arc(struct fsm_state *fsm, int offset, int state_no, int in, int out, int target, int final_state, int start_state);
+
+ struct fsm *fsm_kleene_closure(struct fsm *net, int optionality);
+
+diff --git a/foma/flookup.c b/foma/flookup.c
+index 971549d..ecd3db3 100644
+--- a/foma/flookup.c
++++ b/foma/flookup.c
+@@ -77,7 +77,7 @@ static FILE *INFILE;
+ static struct lookup_chain *chain_head, *chain_tail, *chain_new, *chain_pos;
+ static fsm_read_binary_handle fsrh;
+
+-static char *(*applyer)() = &apply_up; /* Default apply direction = up */
++static char *(*applyer)(struct apply_handle *h, char *word) = &apply_up; /* Default apply direction = up */
+ static void handle_line(char *s);
+ static void app_print(char *result);
+ static char *get_next_line();
+diff --git a/foma/foma.h b/foma/foma.h
+index 06cb9f7..f5a5bfb 100644
+--- a/foma/foma.h
++++ b/foma/foma.h
+@@ -113,7 +113,7 @@ void iface_print_shortest_string();
+ void iface_print_shortest_string_size();
+ void iface_print_name(void);
+ void iface_quit(void);
+-void iface_apply_random(char *(*applyer)(), int limit);
++void iface_apply_random(char *(*applyer)(struct apply_handle *h), int limit);
+ void iface_random_lower(int limit);
+ void iface_random_upper(int limit);
+ void iface_random_words(int limit);
+diff --git a/foma/fomalib.h b/foma/fomalib.h
+index 6f0218a..d937d15 100644
+--- a/foma/fomalib.h
++++ b/foma/fomalib.h
+@@ -307,7 +307,7 @@ FEXPORT struct fsm *flag_eliminate(struct fsm *net, char *name);
+ FEXPORT struct fsm *flag_twosided(struct fsm *net);
+
+ /* Compile a rewrite rule */
+-FEXPORT struct fsm *fsm_rewrite();
++FEXPORT struct fsm *fsm_rewrite(struct rewrite_set *all_rules);
+
+ /* Boolean tests */
+ FEXPORT int fsm_isempty(struct fsm *net);
+diff --git a/foma/iface.c b/foma/iface.c
+index f41e3ce..7ebd569 100644
+--- a/foma/iface.c
++++ b/foma/iface.c
+@@ -790,7 +790,7 @@ void iface_random_words(int limit) {
+ iface_apply_random(&apply_random_words, limit);
+ }
+
+-void iface_apply_random(char *(*applyer)(), int limit) {
++void iface_apply_random(char *(*applyer)(struct apply_handle *h), int limit) {
+ char *result;
+ struct apply_handle *ah;
+ int i;
+@@ -1230,7 +1230,7 @@ void iface_words_file(char *filename, int type) {
+ /* type 0 (words), 1 (upper-words), 2 (lower-words) */
+ FILE *outfile;
+ char *result;
+- static char *(*applyer)() = &apply_words;
++ static char *(*applyer)(struct apply_handle *h) = &apply_words;
+ struct apply_handle *ah;
+
+ if (type == 1) {
+diff --git a/foma/regex.l b/foma/regex.l
+index c303a40..8e3f1e5 100644
+--- a/foma/regex.l
++++ b/foma/regex.l
+@@ -49,7 +49,7 @@ struct parser_vars {
+ struct parser_vars parservarstack[MAX_PARSE_DEPTH];
+ int g_parse_depth = 0;
+
+-extern int yyparse();
++extern int yyparse(void *scanner, struct defined_networks *defined_nets, struct defined_functions *defined_funcs);
+ extern int get_iface_lineno(void);
+ extern int rewrite, rule_direction, substituting;
+ extern struct fsmcontexts *contexts;
+diff --git a/foma/regex.y b/foma/regex.y
+index eb00e5e..60ab2a4 100644
+--- a/foma/regex.y
++++ b/foma/regex.y
+@@ -21,8 +21,11 @@
+ #include <string.h>
+ #include "foma.h"
+ #define MAX_F_RECURSION 100
+-extern int yyerror();
+-extern int yylex();
++typedef void* yyscan_t;
++typedef struct YYLTYPE YYLTYPE;
++typedef union YYSTYPE YYSTYPE;
++extern int yyerror(YYLTYPE* yylloc, yyscan_t scanner, struct defined_networks *defined_nets, struct defined_functions *defined_funcs, char *msg);
++extern int yylex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
+ extern int my_yyparse(char *my_string, int lineno, struct defined_networks *defined_nets, struct defined_functions *defined_funcs);
+ struct fsm *current_parse;
+ int rewrite, rule_direction;
+diff --git a/foma/spelling.c b/foma/spelling.c
+index ab11e98..ac92bd0 100644
+--- a/foma/spelling.c
++++ b/foma/spelling.c
+@@ -37,7 +37,7 @@
+ #define min_(X, Y) ((X) < (Y) ? (X) : (Y))
+
+ static int calculate_h(struct apply_med_handle *medh, int *intword, int currpos, int state);
+-static struct astarnode *node_delete_min();
++static struct astarnode *node_delete_min(struct apply_med_handle *medh);
+ int node_insert(struct apply_med_handle *medh, int wordpos, int fsmstate, int g, int h, int in, int out, int parent);
+
+ char *print_sym(int sym, struct sigma *sigma) {
diff --git a/dev-libs/foma/files/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch b/dev-libs/foma/files/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch
new file mode 100644
index 000000000000..ca6e3c3a8f76
--- /dev/null
+++ b/dev-libs/foma/files/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch
@@ -0,0 +1,71 @@
+https://bugs.gentoo.org/930501
+
+--- a/foma/sigma.c
++++ b/foma/sigma.c
+@@ -338,8 +338,8 @@ struct ssort {
+ int number;
+ };
+
+-int ssortcmp(struct ssort *a, struct ssort *b) {
+- return(strcmp(a->symbol, b->symbol));
++int ssortcmp(const void *a, const void *b) {
++ return(strcmp(((struct ssort*) a)->symbol, ((struct ssort*)b)->symbol));
+ }
+
+ struct sigma *sigma_copy(struct sigma *sigma) {
+@@ -369,7 +369,6 @@ struct sigma *sigma_copy(struct sigma *sigma) {
+ /* and sorts the sigma based on the symbol string contents */
+
+ int sigma_sort(struct fsm *net) {
+- int(*comp)() = ssortcmp;
+ int size, i, max, *replacearray;
+ struct ssort *ssort;
+ struct sigma *sigma;
+@@ -387,7 +386,7 @@ int sigma_sort(struct fsm *net) {
+ }
+ }
+ max = i;
+- qsort(ssort, max, sizeof(struct ssort), comp);
++ qsort(ssort, max, sizeof(struct ssort), ssortcmp);
+ replacearray = malloc(sizeof(int)*(size+3));
+ for (i=0; i<max; i++)
+ replacearray[(ssort+i)->number] = i+3;
+--- a/foma/structures.c
++++ b/foma/structures.c
+@@ -46,20 +46,18 @@ void *fsm_get_option(unsigned long long option) {
+ return NULL;
+ }
+
+-int linesortcompin(struct fsm_state *a, struct fsm_state *b) {
+- return (a->in - b->in);
++int linesortcompin(const void *a, const void *b) {
++ return (((struct fsm_state*)a)->in - ((struct fsm_state*)b)->in);
+ }
+
+-int linesortcompout(struct fsm_state *a, struct fsm_state *b) {
+- return (a->out - b->out);
++int linesortcompout(const void *a, const void *b) {
++ return (((struct fsm_state*)a)->out - ((struct fsm_state*)b)->out);
+ }
+
+ void fsm_sort_arcs(struct fsm *net, int direction) {
+ /* direction 1 = in, direction = 2, out */
+ struct fsm_state *fsm;
+ int i, lasthead, numlines;
+- int(*scin)() = linesortcompin;
+- int(*scout)() = linesortcompout;
+ fsm = net->states;
+ for (i=0, numlines = 0, lasthead = 0 ; (fsm+i)->state_no != -1; i++) {
+ if ((fsm+i)->state_no != (fsm+i+1)->state_no || (fsm+i)->target == -1) {
+@@ -70,9 +68,9 @@ void fsm_sort_arcs(struct fsm *net, int direction) {
+ if (numlines > 1) {
+ /* Sort, set numlines = 0 */
+ if (direction == 1)
+- qsort(fsm+lasthead, numlines, sizeof(struct fsm_state), scin);
++ qsort(fsm+lasthead, numlines, sizeof(struct fsm_state), linesortcompin);
+ else
+- qsort(fsm+lasthead, numlines, sizeof(struct fsm_state), scout);
++ qsort(fsm+lasthead, numlines, sizeof(struct fsm_state), linesortcompout);
+ }
+ numlines = 0;
+ lasthead = i + 1;
diff --git a/dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild b/dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild
new file mode 100644
index 000000000000..64f60978dbdb
--- /dev/null
+++ b/dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild
@@ -0,0 +1,43 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+MY_COMMIT="9e8c3df573015a26c84e113ba710ef3d57c8e777"
+
+DESCRIPTION="Multi-purpose finite-state toolkit"
+HOMEPAGE="https://fomafst.github.io/ https://github.com/mhulden/foma"
+SRC_URI="https://github.com/mhulden/foma/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/foma-${MY_COMMIT}"
+
+LICENSE="Apache-2.0"
+SLOT="0/0.10"
+KEYWORDS="amd64 x86"
+
+BDEPEND="app-alternatives/yacc
+ app-alternatives/lex"
+DEPEND="sys-libs/readline:=
+ virtual/zlib:="
+RDEPEND="${DEPEND}"
+
+CMAKE_USE_DIR="${WORKDIR}/foma-${MY_COMMIT}/foma"
+
+PATCHES=(
+ "${FILESDIR}"/foma-0.10.0-gcc-13-fixes.patch
+ "${FILESDIR}"/foma-0.10-0-fix-BOM_codes-initializer.patch
+ "${FILESDIR}"/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch
+)
+
+src_test() {
+ local -x PATH="${BUILD_DIR}:${PATH}"
+ pushd foma/tests >/dev/null || die
+ ./run.sh || die
+ popd >/dev/null || die
+}
+
+src_install() {
+ cmake_src_install
+ find "${D}" -name '*.a' -delete || die
+}
diff --git a/dev-libs/foma/metadata.xml b/dev-libs/foma/metadata.xml
new file mode 100644
index 000000000000..0de9307a7e2a
--- /dev/null
+++ b/dev-libs/foma/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>juippis@gentoo.org</email>
+ <name>Joonas Niilola</name>
+ </maintainer>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>