0002-gd_bmp-fix-build-with-uClibc.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From ea2a03e983acf34a1320b460dcad43b7e0b0b14f Mon Sep 17 00:00:00 2001
  2. Message-Id: <ea2a03e983acf34a1320b460dcad43b7e0b0b14f.1397134306.git.baruch@tkos.co.il>
  3. From: Baruch Siach <baruch@tkos.co.il>
  4. Date: Thu, 10 Apr 2014 15:49:13 +0300
  5. Subject: [PATCH] gd_bmp: fix build with uClibc
  6. Some architectures (like ARM) don't have the long double variants of math
  7. functions under uClibc. Add a local ceill definition in this case.
  8. Patch status: reported upstream,
  9. https://bitbucket.org/libgd/gd-libgd/issue/123/build-failure-agains-uclibc-arm
  10. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  11. ---
  12. src/gd_bmp.c | 12 ++++++++++++
  13. 1 file changed, 12 insertions(+)
  14. diff --git a/src/gd_bmp.c b/src/gd_bmp.c
  15. index 0fc021909f1b..11b3ec1baa01 100644
  16. --- a/src/gd_bmp.c
  17. +++ b/src/gd_bmp.c
  18. @@ -25,6 +25,11 @@
  19. #include "gdhelpers.h"
  20. #include "bmp.h"
  21. +#include <features.h>
  22. +#if defined (__UCLIBC__) && !defined(__UCLIBC_HAS_LONG_DOUBLE_MATH__)
  23. +#define NO_LONG_DOUBLE
  24. +#endif
  25. +
  26. static int compress_row(unsigned char *uncompressed_row, int length);
  27. static int build_rle_packet(unsigned char *row, int packet_type, int length, unsigned char *data);
  28. @@ -42,6 +47,13 @@ static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info);
  29. #define BMP_DEBUG(s)
  30. +#ifdef NO_LONG_DOUBLE
  31. +long double ceill(long double x)
  32. +{
  33. + return (long double) ceil((double) x);
  34. +}
  35. +#endif
  36. +
  37. static int gdBMPPutWord(gdIOCtx *out, int w)
  38. {
  39. /* Byte order is little-endian */
  40. --
  41. 1.9.1