diff --git a/0001-build-sys-leave-CFLAGS-LDFLAGS-for-user-to-be-define.patch b/0001-build-sys-leave-CFLAGS-LDFLAGS-for-user-to-be-define.patch new file mode 100644 index 0000000..055c014 --- /dev/null +++ b/0001-build-sys-leave-CFLAGS-LDFLAGS-for-user-to-be-define.patch @@ -0,0 +1,106 @@ +From 16cd8fba849d1d95b247025aea7314165ffd8acf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Tue, 18 May 2021 17:10:52 +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 +--- + configure.ac | 13 ++++++++----- + src/Makefile.am | 16 +++++++++------- + 2 files changed, 17 insertions(+), 12 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8559b66..95deab5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -305,9 +305,12 @@ if test "x$enable_hardening" != "xno"; then + AC_SUBST([HARDENING_LDFLAGS]) + fi + +-CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign" +-CFLAGS="$CFLAGS -Wmissing-prototypes" +-LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" ++AM_CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign" ++AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes" ++AM_LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" ++ ++AC_SUBST([AM_CFLAGS]) ++AC_SUBST([AM_LDFLAGS]) + + AC_CONFIG_FILES(Makefile \ + dist/libtpms.spec \ +@@ -330,10 +333,10 @@ if test -z "$with_tpm2"; then + fi + + 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 + echo "Version to build : $PACKAGE_VERSION" + echo "Crypto library : $cryptolib" +diff --git a/src/Makefile.am b/src/Makefile.am +index 6594ddf..65910d8 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -4,18 +4,20 @@ + # For the license, see the LICENSE file in the root directory. + # + ++AM_CFLAGS = @AM_CFLAGS@ ++AM_LDFLAGS = @AM_LDFLAGS@ $(HARDENING_LDFLAGS) $(SANITIZERS) $(FUZZER) ++ + lib_LTLIBRARIES=libtpms.la + + common_CFLAGS = -include tpm_library_conf.h \ + -I$(top_srcdir)/include/libtpms \ + -I$(top_builddir)/include/libtpms \ ++ $(AM_CFLAGS) \ + $(HARDENING_CFLAGS) \ + $(SANITIZERS) \ + $(FUZZER) + + +-LDFLAGS += $(HARDENING_LDFLAGS) $(SANITIZERS) $(FUZZER) +- + # + # TPM1.2 + # +@@ -574,16 +576,16 @@ libtpms_la_SOURCES = \ + libtpms_la_CFLAGS = $(common_CFLAGS) + + libtpms_la_LDFLAGS = -version-info $(LIBTPMS_VERSION_INFO) \ +- -no-undefined ++ -no-undefined $(AM_LDFLAGS) + + if HAVE_VERSION_SCRIPT + libtpms_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtpms.syms + endif + +-LDFLAGS_ARCH = $(findstring -m32, $(CFLAGS)) +-LDFLAGS_ARCH += $(findstring -m64, $(CFLAGS)) +-LDFLAGS_ARCH += $(findstring -m32, $(LDFLAGS)) +-LDFLAGS_ARCH += $(findstring -m64, $(LDFLAGS)) ++LDFLAGS_ARCH = $(findstring -m32, $(AM_CFLAGS)) ++LDFLAGS_ARCH += $(findstring -m64, $(AM_CFLAGS)) ++LDFLAGS_ARCH += $(findstring -m32, $(AM_LDFLAGS)) ++LDFLAGS_ARCH += $(findstring -m64, $(AM_LDFLAGS)) + + check-local: SHELL?="/usr/bin/env bash" + check-local: +-- +2.29.0 + diff --git a/libtpms.spec b/libtpms.spec index 33b4e95..27a8e32 100644 --- a/libtpms.spec +++ b/libtpms.spec @@ -3,12 +3,13 @@ Name: libtpms Version: 0.8.2 -Release: 0.%{gitdate}git%{gitversion}%{?dist}.2 +Release: 0.%{gitdate}git%{gitversion}%{?dist}.3 Summary: Library providing Trusted Platform Module (TPM) functionality License: BSD Url: http://github.com/stefanberger/libtpms Source0: libtpms-%{gitdate}.tar.xz +Patch0001: 0001-build-sys-leave-CFLAGS-LDFLAGS-for-user-to-be-define.patch BuildRequires: openssl-devel BuildRequires: pkgconfig gawk sed @@ -27,11 +28,11 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Libtpms header files and documentation. %prep -%setup -q -n %{name}-%{gitdate} +%autosetup -p1 -n %{name}-%{gitdate} %build NOCONFIGURE=1 sh autogen.sh %configure --disable-static --with-tpm2 --with-openssl -make %{?_smp_mflags} +make %{?_smp_mflags} CFLAGS=-Wno-error=deprecated-declarations %check make check @@ -55,6 +56,10 @@ find %{buildroot} -type f -name '*.la' | xargs rm -f -- || : %{_mandir}/man3/* %changelog +* Tue May 18 2021 Marc-André Lureau - 0.8.2-0.20210301git729fc6a4ca.3 +- Add -Wno-error=deprecated-declarations, to ignore OpenSSL 3.0 deprecation warnings. + Fixes: rhbz#1958054 + * Fri Apr 16 2021 Mohan Boddu - 0.8.2-0.20210301git729fc6a4ca.2 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937