diff --git a/159.patch b/159.patch new file mode 100644 index 0000000..00e0434 --- /dev/null +++ b/159.patch @@ -0,0 +1,28 @@ +From df2857fff3c492692ca09f31699972970042bc07 Mon Sep 17 00:00:00 2001 +From: Michael Karcher +Date: Wed, 12 Jun 2024 22:42:45 +0200 +Subject: [PATCH] Define _POSIX_C_SOURCE for crfsuite source files + +gcc-14 has "-Werror=implicit-function-declaration" enabled by default. +crfsuite uses posix_memalign which only gets defined when _POSIX_C_SOURCE is +defined, so make sure the flag is set when compiling crfsuite. + +On the other hand, openSUSE Tumbleweed has _POSIX_C_SOURCE defined +in pyconfig.h, so you must not add "-D_POSIX_C_SOURCE" when compiling +the python binding source code. So add it only for the subdir crfsuite. +--- + setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/setup.py b/setup.py +index 8036363..f0dc370 100755 +--- a/setup.py ++++ b/setup.py +@@ -30,6 +30,7 @@ def build_extensions(self): + _compile = c._compile + + def c_compile(obj, src, ext, cc_args, extra_postargs, pp_opts): ++ cc_args = cc_args + ['-D_POSIX_C_SOURCE=200112L'] if src.startswith('crfsuite/') else cc_args + cc_args = cc_args + ['-std=c99'] if src.endswith('.c') else cc_args + return _compile(obj, src, ext, cc_args, extra_postargs, pp_opts) + diff --git a/python-python-crfsuite.changes b/python-python-crfsuite.changes index 5006408..b854cba 100644 --- a/python-python-crfsuite.changes +++ b/python-python-crfsuite.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 12 21:37:57 UTC 2024 - John Paul Adrian Glaubitz + +- Cherry-pick upstream patch to fix build with GCC 14 + * https://github.com/scrapinghub/python-crfsuite/pull/159.patch + ------------------------------------------------------------------- Tue Dec 26 20:26:15 UTC 2023 - Dirk Müller diff --git a/python-python-crfsuite.spec b/python-python-crfsuite.spec index 807452d..77ddc90 100644 --- a/python-python-crfsuite.spec +++ b/python-python-crfsuite.spec @@ -1,7 +1,7 @@ # # spec file for package python-python-crfsuite # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,8 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/scrapinghub/python-crfsuite Source: https://files.pythonhosted.org/packages/source/p/python-crfsuite/python-crfsuite-%{version}.tar.gz +# PATCH-FIX-UPSTREAM - Define _POSIX_C_SOURCE for crfsuite source files +Patch: https://github.com/scrapinghub/python-crfsuite/pull/159.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools}