From 40eda9cf0b163499de0f53267397eac410c0c365 Mon Sep 17 00:00:00 2001 From: Ville-Pekka Vainio Date: Nov 22 2020 18:33:10 +0000 Subject: Import SRPM after re-review See https://bugzilla.redhat.com/show_bug.cgi?id=1885048 --- diff --git a/.gitignore b/.gitignore index 5a71281..c39c713 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /foma-0fa48db.tar.gz +/foma-b44022c.tar.gz 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-harden-build.patch b/foma-harden-build.patch deleted file mode 100644 index 9a56354..0000000 --- a/foma-harden-build.patch +++ /dev/null @@ -1,29 +0,0 @@ -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 index f6e04e3..be13de3 100644 --- a/foma.spec +++ b/foma.spec @@ -1,21 +1,31 @@ # 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 +# 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 20150613 +%global snapshotdate 20200928 %global libname libfoma Name: foma Version: 0.9.18 -Release: 0.5.%{snapshotdate}git%{shortcommit0}%{?dist} +Release: 0.9.%{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 + +# 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 Requires: %{libname}%{?_isa} = %{version}-%{release} @@ -46,6 +56,7 @@ 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 @@ -59,6 +70,7 @@ developing applications that use libfoma. 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 @@ -87,9 +99,25 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';' %files -n %{libname}-devel %{_includedir}/*.h %{_libdir}/%{libname}.so +%{_libdir}/pkgconfig/%{libname}.pc %changelog +* 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 diff --git a/sources b/sources index 9cb713b..68e6ace 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (foma-0fa48db.tar.gz) = 664fbd325e59ee3743c0509f82bbb1c608ceb18fb8d0e417bf0be20f29f68e1acd710120d26d4ecd970dc36d1316b486c09c59969c2b3f408a8f8cf9815f81af +SHA512 (foma-b44022c.tar.gz) = da7e6c108843a521a348a2903cf357ac5b08501325f45accc45544edbc21edd2c3feef774fa8a0bd0e8e58ccaac3ad73a9446a7014eb8f44fd3ebe45ffd55b31