diff options
author | Alfred Wingate <parona@protonmail.com> | 2024-05-23 01:35:32 +0300 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2024-05-23 08:53:49 +0300 |
commit | 3b8e04c9b5b518427ad9f0954f601c0cbf46e2df (patch) | |
tree | 658530373a8e68b19e27ee3e202368f400e901c7 /dev-libs/foma | |
parent | dev-util/librnp: build explicitly against botan-3 (diff) | |
download | gentoo-3b8e04c9b5b518427ad9f0954f601c0cbf46e2df.tar.gz gentoo-3b8e04c9b5b518427ad9f0954f601c0cbf46e2df.tar.bz2 gentoo-3b8e04c9b5b518427ad9f0954f601c0cbf46e2df.zip |
dev-libs/foma: fix incompatible function pointer types
* In addition put patches into an array and run tests.
Closes: https://bugs.gentoo.org/930501
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36783
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-libs/foma')
-rw-r--r-- | dev-libs/foma/files/foma-0.10.0_p20220612-fix-incompatible-function-pointer-types.patch | 71 | ||||
-rw-r--r-- | dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild | 43 |
2 files changed, 114 insertions, 0 deletions
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..c6d32f53c35d --- /dev/null +++ b/dev-libs/foma/foma-0.10.0_p20220612-r2.ebuild @@ -0,0 +1,43 @@ +# Copyright 2022-2024 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:= + sys-libs/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 +} |