Sync from SUSE:SLFO:Main foma revision c1ae2aba7a6cb212e2572b66c61d55b0

This commit is contained in:
Adrian Schröter 2024-05-03 12:34:56 +02:00
commit ae03aaca7b
6 changed files with 264 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

14
_service Normal file
View File

@ -0,0 +1,14 @@
<services>
<service mode="disabled" name="tar_scm">
<param name="url">https://github.com/mhulden/foma</param>
<param name="scm">git</param>
<param name="filename">foma</param>
<param name="revision">dfe1ccb1055af99be0232a26520d247b5fe093bc</param>
<param name="versionformat">0.10.0</param>
</service>
<service mode="disabled" name="recompress">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service mode="disabled" name="set_version"/>
</services>

BIN
foma-0.10.0.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

34
foma-harden-build.patch Normal file
View File

@ -0,0 +1,34 @@
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: foma/Makefile
===================================================================
--- a/foma.orig/Makefile
+++ a/foma/Makefile
@@ -23,13 +23,13 @@ LIBOBJS = int_stack.o define.o determini
all: libfoma foma flookup cgflookup
foma: $(FOMAOBJS) $(LIBOBJS)
- $(CC) $(CFLAGS) $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@
+ $(CC) $(CFLAGS) -pie -Wl,-z,now $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@
flookup: flookup.o libfoma
- $(CC) $(CFLAGS) flookup.o $(FLOOKUPLDFLAGS) -o $@
+ $(CC) $(CFLAGS) -pie -Wl,-z,now flookup.o $(FLOOKUPLDFLAGS) -o $@
cgflookup: cgflookup.o libfoma
- $(CC) $(CFLAGS) cgflookup.o $(FLOOKUPLDFLAGS) -o $@
+ $(CC) $(CFLAGS) -pie -Wl,-z,now cgflookup.o $(FLOOKUPLDFLAGS) -o $@
STATICLIB = libfoma.a
@@ -72,7 +72,7 @@ libfoma: $(SHAREDLIBV)
$(SHAREDLIBV): $(LIBOBJS)
$(AR) $(ARFLAGS) $(STATICLIB) $(LIBOBJS)
$(RANLIB) $(STATICLIB)
- $(CC) $(CFLAGS) -shared -Wl,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)
+ $(CC) $(CFLAGS) -shared -Wl,-z,now,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)
install: foma libfoma libfoma.pc
-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi

91
foma.changes Normal file
View File

@ -0,0 +1,91 @@
-------------------------------------------------------------------
Sat Aug 27 07:27:45 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.10.0
* Add runtime options interface.
* Fix numerous memory leaks and segfaults.
* Skip flags elimination if there are no paths in network.
* Fixed syntax error reporting line count in lexc.
* Add Python 3 compatibility and Python 3 port of foma2js.perl.
* Sort alphabet after eliminating flags.
-------------------------------------------------------------------
Sat Jun 26 17:55:35 UTC 2021 - jengelh@inai.de
- Update to version 0.9.18+git20210604.180b6fe:
* Drop xx prefix for standard C functions.
* Add runtime options interface for HFST.
* Fix segfault when Foma sigmas are merged.
* Add test for leaks and segfaults to avoid regression.
* Fix a premature free() call in fsm_isempty.
* add ^> to lexc's regex lexer.
* Fix memory leak in regex parser: destroy FSM via bison destructor.
* Fix memory leaks in "print shortest-string" command processor.
* Drop leftover command "test star-free"
* Avoid memory leaks in test functions: free temporary FSMs after use.
* Avoid memory leak in fsm_isempty function: release minimized FSM.
* Avoid memory leak in fsm_rewrite: free center FSM after usage.
* Skip definition without network when save_defined is executed.
-------------------------------------------------------------------
Wed May 19 15:14:43 UTC 2021 - Fridrich Strba <fstrba@suse.com>
- Define conditionally make_build to fix build on systems that do
not have that macro
-------------------------------------------------------------------
Mon Mar 02 12:07:36 UTC 2020 - tchvatal@suse.com
- Update to version 0.9.18+git20200221.5e5521e bsc#1160265:
* Ignore dylibs
* Removed dependency on six
* Bugfixes for Python
* Added Python 3 port of foma2js.perl
* Better py3 compatibility
* Add test for apply_down().
* Get apply_up() working.
* Add simple Python tests.
* Port FST.encode() to use correct types for Python 3.
* Add Python six 1.11.0 module.
* Added TextWrangler codeless language modules.
* add object files and many temp files to .gitignore
* remove SVN_REV var in Makefile
- Remove upstream merged patch:
* foma-fix-sizeof.patch
-------------------------------------------------------------------
Thu Sep 27 09:00:24 UTC 2018 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add foma-fix-sizeof.patch to fix segfault on 32-bit (boo#1109949)
-------------------------------------------------------------------
Thu Sep 27 07:28:30 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to add some linker hardening:
* foma-harden-build.patch
-------------------------------------------------------------------
Thu Sep 27 06:32:24 UTC 2018 - tchvatal@suse.com
- Update to version 0.9.18+git20180511.bad2f09:
* Various small fixes
-------------------------------------------------------------------
Wed May 17 09:33:31 UTC 2017 - tchvatal@suse.com
- Build in single thread, interim deps are not properly stated in
the Makefile
-------------------------------------------------------------------
Wed May 17 09:13:27 UTC 2017 - tchvatal@suse.com
- Update to version 0.9.18+git20170507.07bb944:
* Switch to git snapshot to ensure license to be correctly set
* Install COPYING
-------------------------------------------------------------------
Wed Apr 26 10:55:31 UTC 2017 - tchvatal@suse.com
- Initial commit required by malaga-suomi
- Taken from Mageia

99
foma.spec Normal file
View File

@ -0,0 +1,99 @@
#
# spec file for package foma
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{!?make_build:%global make_build make %{?_smp_mflags}}
%define libname libfoma0
Name: foma
Version: 0.10.0
Release: 0
Summary: Finite-state compiler and C library
License: Apache-2.0
URL: https://fomafst.github.io/
Source0: foma-%{version}.tar.xz
Patch0: foma-harden-build.patch
BuildRequires: bison
BuildRequires: flex
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: readline-devel
BuildRequires: pkgconfig(zlib)
%description
Foma is a compiler, programming language, and C library for constructing
finite-state automata and transducers for various uses. It has specific
support for many natural language processing applications such as producing
morphological analyzers. Although NLP applications are probably the main
use of foma, it is sufficiently generic to use for a large number of purposes.
%package -n %{libname}
Summary: Finite-state C library
%description -n %{libname}
The library contains efficient implementations of all classical
automata/transducer algorithms: determinization, minimization,
epsilon-removal, composition, boolean operations. Also, more
advanced construction methods are available: context restriction,
quotients, first-order regular logic, transducers from replacement
rules, etc.
%package devel
Summary: Finite-state C library development files and headers
Requires: %{libname} = %{version}
%description devel
Finite-state C library development files and headers for %{name}.
%prep
%autosetup -p2 -n %{name}-%{version}/%{name}
sed -i '/^CFLAGS/c\CFLAGS = %{optflags} -fcommon -Wl,--as-needed -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC' Makefile
sed -i '/^LDFLAGS/c\LDFLAGS = -lreadline -lz -lreadline -fpic' Makefile
sed -i '/^FLOOKUPLDFLAGS/c\FLOOKUPLDFLAGS = libfoma.a -lz -fpic' Makefile
%build
# hand written Makefile that gets to be quite PITA
%make_build -j1
%install
%make_install \
prefix=%{buildroot}%{_prefix} \
libdir=%{buildroot}%{_libdir}
rm -rf %{buildroot}%{_libdir}/*.a
# github.com/mhulden/foma/issues/127
perl -i -pe 's{\Q%{buildroot}\E}{}' "%{buildroot}/%{_libdir}/pkgconfig"/*.pc
cat "%{buildroot}/%{_libdir}/pkgconfig"/*.pc
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%{_bindir}/cgflookup
%{_bindir}/flookup
%{_bindir}/foma
%files devel
%{_includedir}/fomalib.h
%{_includedir}/fomalibconf.h
%{_libdir}/libfoma.so
%{_libdir}/pkgconfig/libfoma.pc
%files -n %{libname}
%license COPYING
%{_libdir}/libfoma.so.*
%changelog