Add -Wno-error=deprecated-declarations to fix build with OpenSSL 3.0

Resolves: rhbz#1958033

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-05-18 15:57:58 +04:00
parent 1fb79945c1
commit fc4f00ddf0
2 changed files with 118 additions and 3 deletions

View File

@ -0,0 +1,110 @@
From c52b0c85d80c912817a45c49262fb919835ab3b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Tue, 18 May 2021 17:18:55 +0400
Subject: [PATCH] build-sys: leave CFLAGS/LDFLAGS for user to be defined
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This allows user to set specific flags during compilation, without
overriding configure-time cflags necessary for compilation.
See also:
https://www.gnu.org/software/automake/manual/html_node/User-Variables.html
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
configure.ac | 9 +++++++--
src/swtpm/Makefile.am | 9 +++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 45f4324..e550e74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -535,6 +535,11 @@ if test "$with_seccomp" != "no"; then
[whether to build in seccomp profile (Linux only)])
fi
+AM_CFLAGS="$CFLAGS"
+AM_LDFLAGS="$LDFLAGS"
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
AC_CONFIG_FILES([Makefile \
debian/swtpm-tools.postinst \
dist/swtpm.spec \
@@ -586,10 +591,10 @@ echo
echo "Version to build : $PACKAGE_VERSION"
echo "Crypto library : $cryptolib"
echo
-echo "CFLAGS=$CFLAGS"
+echo "AM_CFLAGS=$AM_CFLAGS"
echo "HARDENING_CFLAGS=$HARDENING_CFLAGS"
echo "HARDENING_LDFLAGS=$HARDENING_LDFLAGS"
-echo "LDFLAGS=$LDFLAGS"
+echo "AM_LDFLAGS=$AM_LDFLAGS"
echo "LIBSECCOMP_LIBS=$LIBSECCOMP_LIBS"
echo
echo "TSS_USER=$TSS_USER"
diff --git a/src/swtpm/Makefile.am b/src/swtpm/Makefile.am
index a9f3f25..bc0a3d1 100644
--- a/src/swtpm/Makefile.am
+++ b/src/swtpm/Makefile.am
@@ -4,6 +4,9 @@
# For the license, see the COPYING file in the root directory.
#
+AM_CFLAGS = @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+
noinst_HEADERS = \
capabilities.h \
common.h \
@@ -61,11 +64,13 @@ libswtpm_libtpms_la_CFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/swtpm \
+ $(AM_CFLAGS) \
$(HARDENING_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBSECCOMP_CFLAGS)
libswtpm_libtpms_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
$(HARDENING_LDFLAGS)
libswtpm_libtpms_la_LIBADD = \
@@ -95,12 +100,14 @@ swtpm_CFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/swtpm \
+ $(AM_CFLAGS) \
$(HARDENING_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBFUSE_CFLAGS) \
-DHAVE_SWTPM_CUSE_MAIN
swtpm_LDFLAGS = \
+ $(AM_LDFLAGS) \
$(HARDENING_LDFLAGS)
swtpm_LDADD = \
@@ -118,11 +125,13 @@ swtpm_cuse_SOURCES = \
swtpm_cuse_CFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include/swtpm \
+ $(AM_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBFUSE_CFLAGS) \
$(HARDENING_CFLAGS)
swtpm_cuse_LDFLAGS = \
+ $(AM_LDFLAGS) \
$(HARDENING_LDFLAGS)
swtpm_cuse_LDADD = \
--
2.29.0

View File

@ -12,10 +12,11 @@
Summary: TPM Emulator
Name: swtpm
Version: 0.5.2
Release: 4.%{gitdate}git%{gitshortcommit}%{?dist}
Release: 5.%{gitdate}git%{gitshortcommit}%{?dist}
License: BSD
Url: http://github.com/stefanberger/swtpm
Source0: %{url}/archive/%{gitcommit}/%{name}-%{gitshortcommit}.tar.gz
Patch0001: 0001-build-sys-leave-CFLAGS-LDFLAGS-for-user-to-be-define.patch
BuildRequires: make
BuildRequires: git-core
@ -100,10 +101,10 @@ NOCONFIGURE=1 ./autogen.sh
%endif
--without-cuse
%make_build
%make_build CFLAGS="-Wno-error=deprecated-declarations -fPIC"
%check
make %{?_smp_mflags} check VERBOSE=1
make %{?_smp_mflags} check VERBOSE=1 CFLAGS="-Wno-error=deprecated-declarations -fPIC"
%install
@ -185,6 +186,10 @@ fi
%{_datadir}/swtpm/swtpm-create-tpmca
%changelog
* Tue May 18 2021 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.5.2-5.20201226gite59c0c1
- Add -Wno-error=deprecated-declarations to fix build with OpenSSL 3.0.
- Fixes: rhbz#1958033
* Tue Apr 20 2021 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.5.2-4.20201226gite59c0c1
- Remove unnecessary twisted dependency.
- Fixes: rhbz#1935825