From 9d7f532eda969d42e3d01a6689555156c44d1ca4 Mon Sep 17 00:00:00 2001 From: Ville-Pekka Vainio Date: Sat, 22 Sep 2018 22:49:41 +0300 Subject: [PATCH] Initial import (#1357110) --- .gitignore | 1 + foma-harden-build.patch | 29 +++++++++++++ foma.spec | 94 +++++++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 125 insertions(+) create mode 100644 .gitignore create mode 100644 foma-harden-build.patch create mode 100644 foma.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a71281 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/foma-0fa48db.tar.gz diff --git a/foma-harden-build.patch b/foma-harden-build.patch new file mode 100644 index 0000000..9a56354 --- /dev/null +++ b/foma-harden-build.patch @@ -0,0 +1,29 @@ +diff -Naur foma-0fa48dbacfe39509577ae6741054be7c05a19aac.orig/foma/Makefile foma-0fa48dbacfe39509577ae6741054be7c05a19aac/foma/Makefile +--- foma-0fa48dbacfe39509577ae6741054be7c05a19aac.orig/foma/Makefile 2015-06-13 19:50:43.000000000 +0300 ++++ foma-0fa48dbacfe39509577ae6741054be7c05a19aac/foma/Makefile 2018-08-05 13:48:07.836080649 +0300 +@@ -23,13 +23,13 @@ + 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 + +@@ -68,7 +68,7 @@ + $(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 + -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi diff --git a/foma.spec b/foma.spec new file mode 100644 index 0000000..bb9e259 --- /dev/null +++ b/foma.spec @@ -0,0 +1,94 @@ +# Upstream changed its licensing to ASL 2.0 after releasing 0.9.18. +# This package uses the relicensed sources, which are as close to 0.9.18 as +# possible. Debian uses the exact same revision. +%global commit0 0fa48dbacfe39509577ae6741054be7c05a19aac +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%global snapshotdate 20150613 + +%global libname libfoma + +Name: foma +Version: 0.9.18 +Release: 0.1.%{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 +Patch0: foma-harden-build.patch + +BuildRequires: gcc zlib-devel readline-devel flex bison +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} + +%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 + +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 + + +%changelog +* 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..9cb713b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (foma-0fa48db.tar.gz) = 664fbd325e59ee3743c0509f82bbb1c608ceb18fb8d0e417bf0be20f29f68e1acd710120d26d4ecd970dc36d1316b486c09c59969c2b3f408a8f8cf9815f81af