From 4bae71fff21a36be957b0856bf9f47f6b07a4627 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Thu, 5 Mar 2020 14:33:28 -0500 Subject: [PATCH] Build everything using -fPIC Signed-off-by: David Cantrell --- mandoc-shared-library.patch | 24 ++++++++---------------- mandoc.spec | 7 +++++-- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/mandoc-shared-library.patch b/mandoc-shared-library.patch index 3f697f9..c3ec054 100644 --- a/mandoc-shared-library.patch +++ b/mandoc-shared-library.patch @@ -1,6 +1,6 @@ diff -up mandoc-1.14.5/Makefile.orig mandoc-1.14.5/Makefile --- mandoc-1.14.5/Makefile.orig 2019-03-10 05:56:43.000000000 -0400 -+++ mandoc-1.14.5/Makefile 2020-03-05 12:37:41.995031115 -0500 ++++ mandoc-1.14.5/Makefile 2020-03-05 14:16:20.816988115 -0500 @@ -17,6 +17,10 @@ VERSION = 1.14.5 @@ -21,24 +21,16 @@ diff -up mandoc-1.14.5/Makefile.orig mandoc-1.14.5/Makefile install: base-install $(INSTALL_TARGETS) -@@ -388,11 +392,15 @@ include Makefile.depend - - # === TARGETS CONTAINING SHELL COMMANDS ================================ - -+LIBMANDOC_PIC_OBJS = $(COMPAT_OBJS:.o=.pic.o) $(LIBMANDOC_OBJS:.o=.pic.o) -+%.pic.o: %.c -+ $(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC $< -o $@ -+ - distclean: clean +@@ -392,7 +396,7 @@ distclean: clean rm -f Makefile.local config.h config.h.old config.log config.log.old clean: - rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS) -+ rm -f libmandoc.a libmandoc.so.$(SOVERSION) $(LIBMANDOC_OBJS) $(LIBMANDOC_PIC_OBJS) $(COMPAT_OBJS) ++ rm -f libmandoc.a libmandoc.so.$(SOVERSION) $(LIBMANDOC_OBJS) $(COMPAT_OBJS) rm -f mandoc $(MAIN_OBJS) rm -f man.cgi $(CGI_OBJS) rm -f mandocd catman catman.o $(MANDOCD_OBJS) -@@ -431,11 +439,14 @@ base-install: mandoc demandoc soelim +@@ -431,11 +435,14 @@ base-install: mandoc demandoc soelim $(INSTALL_MAN) makewhatis.8 \ $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8 @@ -54,7 +46,7 @@ diff -up mandoc-1.14.5/Makefile.orig mandoc-1.14.5/Makefile $(INSTALL_LIB) eqn.h man.h mandoc.h mandoc_aux.h mandoc_parse.h \ mdoc.h roff.h tbl.h $(DESTDIR)$(INCLUDEDIR) $(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \ -@@ -485,6 +496,8 @@ uninstall: +@@ -485,6 +492,8 @@ uninstall: rm -f $(DESTDIR)$(MANDIR)/man8/mandocd.8 rm -f $(DESTDIR)$(MANDIR)/man8/$(BINM_CATMAN).8 rm -f $(DESTDIR)$(LIBDIR)/libmandoc.a @@ -63,12 +55,12 @@ diff -up mandoc-1.14.5/Makefile.orig mandoc-1.14.5/Makefile rm -f $(DESTDIR)$(MANDIR)/man3/mandoc.3 rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_escape.3 rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_malloc.3 -@@ -514,6 +527,15 @@ Makefile.local config.h: configure $(TES +@@ -514,6 +523,15 @@ Makefile.local config.h: configure $(TES libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) -+libmandoc.so.$(SOVERSION): $(LIBMANDOC_PIC_OBJS) -+ $(CC) -shared -Wl,-soname=libmandoc.so.$(SOMAJOR) -o $@ $(LIBMANDOC_PIC_OBJS) ++libmandoc.so.$(SOVERSION): $(LIBMANDOC_OBJS) ++ $(CC) -shared -Wl,-soname=libmandoc.so.$(SOMAJOR) -o $@ $(LIBMANDOC_OBJS) + +libmandoc.so.$(SOMAJOR): libmandoc.so.$(SOVERSION) + ln -sf libmandoc.so.$(SOVERSION) libmandoc.so.$(SOMAJOR) diff --git a/mandoc.spec b/mandoc.spec index 23375b8..bffb126 100644 --- a/mandoc.spec +++ b/mandoc.spec @@ -1,6 +1,6 @@ Name: mandoc Version: 1.14.5 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A suite of tools for compiling mdoc and man License: ISC @@ -79,7 +79,7 @@ echo 'INSTALL_DATA="${INSTALL} -m 0644"' >> configure.local echo 'INSTALL_LIBMANDOC=1' >> configure.local -echo 'CFLAGS="%{optflags}"' >> configure.local +echo 'CFLAGS="%{optflags} -fPIC"' >> configure.local ./configure make %{?_smp_mflags} @@ -237,6 +237,9 @@ fi %{_mandir}/man3/tbl.3* %changelog +* Thu Mar 05 2020 David Cantrell - 1.14.5-7 +- Build everything using -fPIC + * Thu Mar 05 2020 David Cantrell - 1.14.5-6 - Include libmandoc.a in libmandoc-devel