libgd: fix INT_MAX not defined (#42104)

Compiling version 2.2.4 fails (on a Debian system with only a minimum set of packages installed) with an error because `INT_MAX` is undeclared:
```
   263    gd_gd2.c: In function '_gd2GetHeader':
>> 264    gd_gd2.c:212:54: error: 'INT_MAX' undeclared (first use in this function)
   265      212 |                 if (*ncx <= 0 || *ncy <= 0 || *ncx > INT_MAX / *ncy) {
   266          |                                                      ^~~~~~~
   267    gd_gd2.c:87:1: note: 'INT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
```
This commit is contained in:
Martin Lang 2024-02-22 11:23:59 +01:00 committed by GitHub
parent e8d981b405
commit 3ebaf33915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,13 @@ class Libgd(AutotoolsPackage):
depends_on("fontconfig") depends_on("fontconfig")
depends_on("libx11") depends_on("libx11")
# add missing '#include <limits.h>' in gd_gd2.c, which uses the constant 'INT_MAX'
patch(
"https://github.com/libgd/libgd/commit/c9b601a658a79e6ea2aad29fbf60ca6e24ccef1e.patch?full_index=1",
sha256="1dc3a72491427acbae2cd0c6d3b08c0814ffa2f9fee91269b8b46429cabb773d",
when="@2.2.4",
)
def patch(self): def patch(self):
p = self.spec["jpeg"].libs.search_flags p = self.spec["jpeg"].libs.search_flags
filter_file( filter_file(