From ed7457b30d650f18850b93c7e21571d1c78d93cb39a714b300f6e48e8ba2f88d Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 17 May 2024 11:23:57 +0000 Subject: [PATCH] switch to cmake OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/foma?expand=0&rev=21 --- foma-harden-build.patch | 37 ------------------------------------- foma.changes | 3 ++- foma.spec | 29 ++++++++++++----------------- 3 files changed, 14 insertions(+), 55 deletions(-) delete mode 100644 foma-harden-build.patch diff --git a/foma-harden-build.patch b/foma-harden-build.patch deleted file mode 100644 index caba9ba..0000000 --- a/foma-harden-build.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Tomáš Chvátal -Date: 2018-09-27 07:28:30+0000 - ---- - 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 diff --git a/foma.changes b/foma.changes index 2ca53e5..20bd429 100644 --- a/foma.changes +++ b/foma.changes @@ -3,7 +3,8 @@ Fri May 17 06:34:16 UTC 2024 - Jan Engelhardt - Update to git snapshot 0.10.0+git22 (e0d8122) * Build fixes for various compilers and C++ standard modes -- Drop foma-gcc14.patch (merged) +- Drop foma-gcc14.patch (merged), delete foma-harden-build.patch + (obsolete) ------------------------------------------------------------------- Mon May 13 12:10:56 UTC 2024 - pgajdos@suse.com diff --git a/foma.spec b/foma.spec index 3ba29e1..3113010 100644 --- a/foma.spec +++ b/foma.spec @@ -25,11 +25,11 @@ Summary: Finite-state compiler and C library License: Apache-2.0 URL: https://fomafst.github.io/ Source: foma-%version.tar.xz -Patch1: foma-harden-build.patch BuildRequires: bison +BuildRequires: cmake BuildRequires: flex BuildRequires: ncurses-devel -BuildRequires: pkgconfig +BuildRequires: pkg-config BuildRequires: readline-devel BuildRequires: pkgconfig(zlib) @@ -58,24 +58,19 @@ Requires: %{libname} = %{version} 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 +%autosetup -p1 %build -# hand written Makefile that gets to be quite PITA -%make_build -j1 +pushd foma/ +%cmake +%cmake_build +popd %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 +pushd foma/ +%cmake_install +popd +find "%buildroot" -type f -name "*.a" -print -delete %ldconfig_scriptlets -n %libname @@ -91,7 +86,7 @@ cat "%{buildroot}/%{_libdir}/pkgconfig"/*.pc %{_libdir}/pkgconfig/libfoma.pc %files -n %{libname} -%license COPYING +%license foma/COPYING %{_libdir}/libfoma.so.* %changelog