From 6a0125fddc3e6683e71d87a82d30f6489bffbade Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 17 Mar 2021 08:52:34 +0100 Subject: [PATCH] Initial sync from F34. Signed-off-by: Jan Kaluza --- .gitignore | 1 + README.md | 3 + foma-harden-build-fedora.patch | 20 +++++ foma.spec | 138 +++++++++++++++++++++++++++++++++ sources | 1 + 5 files changed, 163 insertions(+) create mode 100644 README.md create mode 100644 foma-harden-build-fedora.patch create mode 100644 foma.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..73efd53 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/foma-b44022c.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..8be6311 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# foma + +The foma package \ No newline at end of file diff --git a/foma-harden-build-fedora.patch b/foma-harden-build-fedora.patch new file mode 100644 index 0000000..f65a915 --- /dev/null +++ b/foma-harden-build-fedora.patch @@ -0,0 +1,20 @@ +diff -Naur foma-b44022c7d9d347dc7392aabbf72c82e558767675.orig/foma/Makefile foma-b44022c7d9d347dc7392aabbf72c82e558767675/foma/Makefile +--- foma-b44022c7d9d347dc7392aabbf72c82e558767675.orig/foma/Makefile 2020-09-28 22:00:09.000000000 +0300 ++++ foma-b44022c7d9d347dc7392aabbf72c82e558767675/foma/Makefile 2020-11-14 20:04:36.797538370 +0200 +@@ -23,13 +23,13 @@ + all: libfoma foma flookup cgflookup + + foma: $(FOMAOBJS) $(LIBOBJS) +- $(CC) $(CFLAGS) $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@ ++ $(CC) $(CFLAGS) -pie $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@ + + flookup: flookup.o libfoma +- $(CC) $(CFLAGS) flookup.o $(FLOOKUPLDFLAGS) -o $@ ++ $(CC) $(CFLAGS) -pie flookup.o $(FLOOKUPLDFLAGS) -o $@ + + cgflookup: cgflookup.o libfoma +- $(CC) $(CFLAGS) cgflookup.o $(FLOOKUPLDFLAGS) -o $@ ++ $(CC) $(CFLAGS) -pie cgflookup.o $(FLOOKUPLDFLAGS) -o $@ + + STATICLIB = libfoma.a + diff --git a/foma.spec b/foma.spec new file mode 100644 index 0000000..5e6fe3b --- /dev/null +++ b/foma.spec @@ -0,0 +1,138 @@ +# Upstream changed its licensing to ASL 2.0 after releasing 0.9.18. +# I have decided to use the newest upstream code from September 2020 because +# in addition to many other fixes it fixes the build on Fedora. +%global commit0 b44022c7d9d347dc7392aabbf72c82e558767675 +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%global snapshotdate 20200928 + +%global libname libfoma + +Name: foma +Version: 0.9.18 +Release: 0.10.%{snapshotdate}git%{shortcommit0}%{?dist} +Summary: Xerox-compatible finite-state compiler + +License: ASL 2.0 +URL: https://github.com/mhulden/foma +Source0: https://github.com/mhulden/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz + +# This patch is made after the OpenSUSE patch at +# https://build.opensuse.org/package/view_file/openSUSE:Factory/foma/foma-harden-build.patch?expand=1 +# +# Foma does not use autotools, which complicates things a bit. +# CFLAGS, LDFLAGS and FLOOKUPLDFLAGS are edited with sed during the build so +# that the Fedora hardening switches are used. We can't, however, just +# add -pie to all of the linking phases with sed, because that would break +# the linker when building the shared library. For discussion on a similar +# issue, see https://lists.debian.org/debian-devel/2016/05/msg00302.html +Patch0: foma-harden-build-fedora.patch + +BuildRequires: gcc zlib-devel readline-devel flex bison +BuildRequires: make +Requires: %{libname}%{?_isa} = %{version}-%{release} + +%description +Foma can be used for constructing finite-state automata and transducers. +It has support for many natural language processing applications such as +producing morphological analyzers. It is sufficiently generic to use for +a large number of purposes in addition to NLP. The foma interface is +similar to the Xerox xfst interface. + +This package includes the foma command line tools. + + +%package -n %{libname} +Summary: The foma C library + +%description -n %{libname} +Foma can be used for constructing finite-state automata and transducers. +It has support for many natural language processing applications such as +producing morphological analyzers. It is sufficiently generic to use for +a large number of purposes in addition to NLP. The foma interface is +similar to the Xerox xfst interface. + +This package includes the foma C library. + + +%package -n %{libname}-devel +Summary: Development files for %{libname} +Requires: %{libname}%{?_isa} = %{version}-%{release} +Requires: pkgconfig + +%description -n %{libname}-devel +The libfoma-devel package contains libraries and header files for +developing applications that use libfoma. + +%prep +%autosetup -n %{name}-%{commit0} -p1 + + +%build +sed -i '/^CFLAGS/c\CFLAGS = %{optflags} -Wl,--as-needed -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC' foma/Makefile +sed -i '/^LDFLAGS/c\LDFLAGS = -lreadline -lz -ltermcap %{build_ldflags}' foma/Makefile +sed -i '/^FLOOKUPLDFLAGS/c\FLOOKUPLDFLAGS = libfoma.a -lz %{build_ldflags}' foma/Makefile +sed -i 's|echo "prefix=${prefix}"|echo "prefix=%{_prefix}"|' foma/Makefile + +cd foma +%make_build + + +%install +sed -i '/^prefix/c\prefix = %{buildroot}%{_prefix}' foma/Makefile +sed -i '/^libdir/c\libdir = %{buildroot}%{_libdir}' foma/Makefile +cd foma +%make_install +# Remove static archive +find %{buildroot} -name '*.a' -exec rm -f {} ';' + + +%files +%{_bindir}/cgflookup +%{_bindir}/flookup +%{_bindir}/foma + +%files -n %{libname} +%license foma/COPYING +%doc foma/README +%{_libdir}/%{libname}.so.0 +%{_libdir}/%{libname}.so.0.9.18 + +%files -n %{libname}-devel +%{_includedir}/*.h +%{_libdir}/%{libname}.so +%{_libdir}/pkgconfig/%{libname}.pc + + +%changelog +* Tue Jan 26 2021 Fedora Release Engineering - 0.9.18-0.10.20200928gitb44022c +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Nov 14 2020 Ville-Pekka Vainio - 0.9.18-0.9.20200928gitb44022c +- Fix typo in spec +- Rewrite patch, name it foma-harden-build-fedora.patch and explain the need for it + +* Sun Oct 04 2020 Ville-Pekka Vainio - 0.9.18-0.8.20200928gitb44022c +- Use latest upstream code with my own Makefile fix merged + +* Mon Sep 28 2020 Ville-Pekka Vainio - 0.9.18-0.7.20200715git0cd2e4a +- Fix dependencies in Makefile to enable parallel build + +* Sun Sep 27 2020 Ville-Pekka Vainio - 0.9.18-0.6.20200715git0cd2e4a +- Use newest code from upstream, fixes build +- Update foma-harden-build.patch +- Package the pkgconfig file + +* Tue Jan 28 2020 Fedora Release Engineering - 0.9.18-0.5.20150613git0fa48db +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.9.18-0.4.20150613git0fa48db +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Feb 17 2019 Igor Gnatenko - 0.9.18-0.3.20150613git0fa48db +- Rebuild for readline 8.0 + +* Thu Jan 31 2019 Fedora Release Engineering - 0.9.18-0.2.20150613git0fa48db +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Sep 16 2018 Ville-Pekka Vainio 0.9.18-0.1.20150613git0fa48db +- Initial package. diff --git a/sources b/sources new file mode 100644 index 0000000..68e6ace --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (foma-b44022c.tar.gz) = da7e6c108843a521a348a2903cf357ac5b08501325f45accc45544edbc21edd2c3feef774fa8a0bd0e8e58ccaac3ad73a9446a7014eb8f44fd3ebe45ffd55b31