Skip to content

Commit

Permalink
jpeg2png: fix build with gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Dec 14, 2024
1 parent 7376c12 commit 3930363
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions graphics/jpeg2png/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ depends_lib-append port:libjpeg-turbo \
port:libpng \
port:zlib

# https://github.com/ThioJoe/jpeg2png/pull/3
patchfiles-append patch-static_assert.diff

post-patch {
# remove the implicit variable reset
system -W ${worksrcpath} "sed -i '' '3,8d' Makefile"
Expand Down
26 changes: 26 additions & 0 deletions graphics/jpeg2png/files/patch-static_assert.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 76e2d331f566bcbbeba121648e94607d12ca420b Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Sat, 14 Dec 2024 23:38:44 +0800
Subject: [PATCH] compute.c: fix static_assert for gcc

---
compute.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git compute.c compute.c
index a3d6e47..9ba3ac2 100644
--- compute.c
+++ compute.c
@@ -12,6 +12,12 @@

#include "ooura/dct.h"

+#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \
+ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
+ && __STDC_VERSION__ <= 201710L
+#define static_assert _Static_assert
+#endif
+
static_assert(FLT_EVAL_METHOD == 0, "to preserve identical output please disable excess precision");
#ifdef PRAGMA_FP_CONTRACT
#pragma STDC FP_CONTRACT OFF

0 comments on commit 3930363

Please sign in to comment.