fix mingw build

This commit is contained in:
Jan Macku 2023-10-11 14:06:50 +02:00
parent a22faef1aa
commit d231372138
2 changed files with 43 additions and 5 deletions

View File

@ -0,0 +1,34 @@
From bf8f419ca9f2d8bce48591710aa25f08e3fc67f8 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Wed, 11 Oct 2023 17:19:05 +0900
Subject: [PATCH] Fix build error when both clock_gettime and GetTickCount64
are available
---
lib/nghttp2_time.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/nghttp2_time.c b/lib/nghttp2_time.c
index 2a5f1a6ff5..dd5a65591f 100644
--- a/lib/nghttp2_time.c
+++ b/lib/nghttp2_time.c
@@ -44,7 +44,9 @@ static uint64_t time_now_sec(void) {
}
#endif /* HAVE_GETTICKCOUNT64 */
-#ifdef HAVE_CLOCK_GETTIME
+#ifdef HAVE_GETTICKCOUNT64
+uint64_t nghttp2_time_now_sec(void) { return GetTickCount64() / 1000; }
+#elif defined(HAVE_CLOCK_GETTIME)
uint64_t nghttp2_time_now_sec(void) {
struct timespec tp;
int rv = clock_gettime(CLOCK_MONOTONIC, &tp);
@@ -55,8 +57,6 @@ uint64_t nghttp2_time_now_sec(void) {
return (uint64_t)tp.tv_sec;
}
-#elif defined(HAVE_GETTICKCOUNT64)
-uint64_t nghttp2_time_now_sec(void) { return GetTickCount64() / 1000; }
#else /* !HAVE_CLOCK_GETTIME && !HAVE_GETTICKCOUNT64 */
uint64_t nghttp2_time_now_sec(void) { return time_now_sec(); }
#endif /* !HAVE_CLOCK_GETTIME && !HAVE_GETTICKCOUNT64 */

View File

@ -1,15 +1,13 @@
%global with_mingw 0
# Temporary disabling mingw builds. They are failing on rawhide with the new version - 1.57.0
# %if 0%{?fedora}
%if 0
%if 0%{?fedora}
%global with_mingw 1
%endif
Summary: Experimental HTTP/2 client, server and proxy
Name: nghttp2
Version: 1.57.0
Release: 1%{?dist}
Release: 2%{?dist}
# Parts of ruby bindings are additionally under GPL-2.0-or-later, MIT and
# Kevlin Henney (this one is not recognized by Fedora!) but they are NOT shipped.
@ -20,6 +18,9 @@ Source0: https://github.com/tatsuhiro-t/nghttp2/releases/download/v%{version}/ng
Source1: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz.asc
Source2: tatsuhiro-t.pgp
# Upstream patches
Patch1: 0001-nghttp2-1.57.0-clock-gettime.patch
BuildRequires: CUnit-devel
BuildRequires: c-ares-devel
BuildRequires: gcc-c++
@ -102,7 +103,7 @@ This is the MinGW cross-compiled Windows library.
%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%setup -q
%autosetup -p1
# make fetch-ocsp-response use Python 3
sed -e '1 s|^#!/.*python|&3|' -i script/fetch-ocsp-response
@ -217,6 +218,9 @@ popd
%changelog
* Wed Oct 11 2023 Jan Macku <jamacku@redhat.com> 1.57.0-2
- fix mingw build
* Wed Oct 11 2023 Jan Macku <jamacku@redhat.com> 1.57.0-1
- update to the latest upstream release
- fixes CVE-2023-44487 - HTTP/2 Rapid Reset