more makefile fixes

This commit is contained in:
David Teigland 2018-03-14 12:10:10 -05:00
parent e6c322124b
commit 4ffe8b8dc9
3 changed files with 48 additions and 6 deletions

View File

@ -0,0 +1,40 @@
From 39b4d87397e5a09adcd100e0f379f34d5dde7e9b Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Mon, 15 Jan 2018 01:21:51 +0200
Subject: [PATCH 1/2] Fix libsanlock build on Unubtu/Debian
LIB_ENTIRE_LDFLAGS included libraries (e.g. -laio -lblkid) instead of
linker flags. The libraries should be in LIB_ENTIRE_LDDADD and come
*after* the sources. Otherwisae, the libraries are not linked, and
loading libsanlock.so fail with undefined symbol error.
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 69fcd1321ee7..73a2b3498475 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -98,15 +98,15 @@ CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE
CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
CMD_LDADD += -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd
-LIB_ENTIRE_LDFLAGS += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
LIB_ENTIRE_LDFLAGS += -Wl,-z,relro -pie
+LIB_ENTIRE_LDADD += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
LIB_CLIENT_LDFLAGS += -Wl,-z,relro -pie
all: $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(CMD_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET)
$(LIBSO_ENTIRE_TARGET): $(LIB_ENTIRE_SOURCE)
- $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^
+ $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ $(LIB_ENTIRE_LDADD)
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so.$(SOMAJOR)
--
2.7.5

View File

@ -1,7 +1,7 @@
From cf1a6ed9116187305b4592b1b2d7c5e246dac301 Mon Sep 17 00:00:00 2001 From fa6d48a7c8991b2251e50469a7e57058be226ab0 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com> From: David Teigland <teigland@redhat.com>
Date: Wed, 14 Mar 2018 11:49:35 -0500 Date: Wed, 14 Mar 2018 11:49:35 -0500
Subject: [PATCH] fix makefile flags Subject: [PATCH 2/2] fix makefile flags
should let the fedora build flags work should let the fedora build flags work
--- ---
@ -24,10 +24,10 @@ index c61348a2b9c3..04a23032614a 100644
all: $(TARGET1) $(TARGET2) all: $(TARGET1) $(TARGET2)
diff --git a/src/Makefile b/src/Makefile diff --git a/src/Makefile b/src/Makefile
index 1ef6852aedf7..1d03784edf1e 100644 index 73a2b3498475..14c0a53e6aeb 100644
--- a/src/Makefile --- a/src/Makefile
+++ b/src/Makefile +++ b/src/Makefile
@@ -99,24 +99,23 @@ VER=$(shell cat ../VERSION) @@ -94,24 +94,23 @@ VER=$(shell cat ../VERSION)
CFLAGS += -DVERSION=\"$(VER)\" CFLAGS += -DVERSION=\"$(VER)\"
CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE

View File

@ -27,14 +27,16 @@ Requires(postun): systemd-units
%endif %endif
Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
Patch0: 0001-fix-makefile-flags.patch Patch0: 0001-Fix-libsanlock-build-on-Unubtu-Debian.patch
Patch1: 0002-fix-makefile-flags.patch
%description %description
The sanlock daemon manages leases for applications on hosts using shared storage. The sanlock daemon manages leases for applications on hosts using shared storage.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .0001-fix-makefile-flags.patch %patch0 -p1 -b .0001-Fix-libsanlock-build-on-Unubtu-Debian.patch
%patch1 -p1 -b .0002-fix-makefile-flags.patch
%build %build
%set_build_flags %set_build_flags