From c2525adf700ad1aaebb672d598a165ea1239f51d Mon Sep 17 00:00:00 2001 From: jca Date: Sun, 12 May 2019 22:00:52 +0000 Subject: [PATCH] Fix gcc version check to unbreak on base-gcc platforms The __builtin_bswap* functions have only been introduced in gcc-4.5, not gcc-4.0. ok jasper@ --- devel/spice-protocol/Makefile | 3 ++- .../patches/patch-spice_macros_h | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/devel/spice-protocol/Makefile b/devel/spice-protocol/Makefile index 284bbe79b8a..29306787ae6 100644 --- a/devel/spice-protocol/Makefile +++ b/devel/spice-protocol/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.22 2018/06/23 14:43:53 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.23 2019/05/12 22:00:52 jca Exp $ COMMENT= SPICE protocol headers DISTNAME= spice-protocol-0.12.14 +REVISION= 0 CATEGORIES= devel net HOMEPAGE= http://www.spice-space.org/ diff --git a/devel/spice-protocol/patches/patch-spice_macros_h b/devel/spice-protocol/patches/patch-spice_macros_h index f0178bb0d20..4da6c478adb 100644 --- a/devel/spice-protocol/patches/patch-spice_macros_h +++ b/devel/spice-protocol/patches/patch-spice_macros_h @@ -1,21 +1,32 @@ -$OpenBSD: patch-spice_macros_h,v 1.8 2018/06/23 14:43:54 ajacoutot Exp $ +$OpenBSD: patch-spice_macros_h,v 1.9 2019/05/12 22:00:52 jca Exp $ + +__builtin_bswap16 only found in gcc-4.5+. https://bugs.freedesktop.org/show_bug.cgi?id=94570 Index: spice/macros.h --- spice/macros.h.orig +++ spice/macros.h -@@ -269,6 +269,13 @@ +@@ -248,7 +248,7 @@ + + /* Arch specific stuff for speed + */ +-#if defined (__GNUC__) && (__GNUC__ >= 4) && defined (__OPTIMIZE__) ++#if (defined(__clang__) || defined (__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 5) && defined (__OPTIMIZE__) + # define SPICE_BYTESWAP16(val) __builtin_bswap16(val) + # define SPICE_BYTESWAP32(val) __builtin_bswap32(val) + # define SPICE_BYTESWAP64(val) __builtin_bswap64(val) +@@ -268,6 +268,13 @@ + #define SPICE_ENDIAN_LITTLE 4321 #define SPICE_ENDIAN_BIG 1234 #define SPICE_ENDIAN_PDP 2143 - ++ +#include +#if BYTE_ORDER == LITTLE_ENDIAN +# define SPICE_ENDIAN SPICE_ENDIAN_LITTLE +#elif BYTE_ORDER == BIG_ENDIAN +# define SPICE_ENDIAN SPICE_ENDIAN_BIG +#endif -+ + /* gcc already defined these, use them */ #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) \ - && defined(__ORDER_BIG_ENDIAN__) && defined(__ORDER_PDP_ENDIAN__)