Add conditionals for older versions

This commit is contained in:
Pablo Greco 2020-09-02 19:41:10 -03:00
parent 82e0a8e741
commit 91e3224847
2 changed files with 38 additions and 4 deletions

View File

@ -0,0 +1,29 @@
From f19d68ea3231f1af7a6e3913dc6d3c46f73947b2 Mon Sep 17 00:00:00 2001
From: Robin Linden <dev@robinlinden.eu>
Date: Thu, 28 May 2020 23:09:07 +0200
Subject: [PATCH] Fix make test build failure on gcc 9.3
On Ubuntu 20.04 using gcc 9.3, make test fails due to a deprecated
function (ftime) warning in combination with -Werror in timetest.c.
Since the warning is from a test testing that the deprecated function
can be replaced using LD_PRELOAD, I think it's reasonable to just
silence the warning in that case.
---
test/timetest.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/timetest.c b/test/timetest.c
index e9aa837..c33368c 100644
--- a/test/timetest.c
+++ b/test/timetest.c
@@ -216,7 +216,10 @@ printf("%s", 0 == 1 ? argv[0] : "");
printf("time() : Current date and time: %s", ctime(&now));
printf("time(NULL) : Seconds since Epoch : %u\n", (unsigned int)time(NULL));
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ftime(&tb);
+#pragma GCC diagnostic pop
printf("ftime() : Current date and time: %s", ctime(&tb.time));
printf("(Intentionally sleeping 2 seconds...)\n");

View File

@ -1,12 +1,13 @@
Summary: Manipulate system time per process for testing purposes
Name: libfaketime
Version: 0.9.8
Release: 9%{?dist}
Release: 10%{?dist}
License: GPLv2+
Url: https://github.com/wolfcw/libfaketime
Source: libfaketime-0.9.8.tar.xz
Patch0: libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch
Patch1: libfaketime-symver.patch
Patch2: libfaketime-fixgcc10.patch
Provides: faketime
@ -24,7 +25,10 @@ time system- wide.
%prep
%setup -q
%patch0 -p1
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%patch1 -p1
%endif
%patch2 -p1
%build
cd src
@ -81,9 +85,6 @@ CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mfla
PREFIX="%{_prefix}" LIBDIRNAME="/%{_lib}/faketime" all
%check
%if 0%{?fedora} >= 32
FAKETIME_COMPILE_CFLAGS="-Wno-error=deprecated-declarations" \
%endif
make %{?_smp_mflags} -C test
%install
@ -102,6 +103,10 @@ chmod a+rx %{buildroot}/%{_libdir}/faketime/*.so.*
%{_mandir}/man1/*
%changelog
* Wed Sep 02 2020 Jeff Law <pgreco@centosproject.org> - 0.9.8-10
- Conditionals to build 0.9.8-9 in f31 and epel7-8
- Use upstream's version of the gcc10 fix
* Wed Sep 02 2020 Jeff Law <law@redhat.com> - 0.9.8-9
- Use symver attribute instead of asms for symbol versioning
- Enable LTO