diff --git a/racket/src/native-libs/build.rkt b/racket/src/native-libs/build.rkt index 97bea13d77..2bc02d471a 100644 --- a/racket/src/native-libs/build.rkt +++ b/racket/src/native-libs/build.rkt @@ -153,6 +153,9 @@ ;; 64-bit MinGW doesn't like this use of `__always_inline__`: (define-runtime-path noforceinline-patch "patches/noforceinline.patch") +;; `vector` syntax with old gcc +(define-runtime-path pixman-altivec-patch "patches/pixman-altivec.patch") + ;; Disable libtool's management of standard libs so that ;; MinGW's -static-libstdc++ works: (define-runtime-path libtool-link-patch "patches/libtool-link.patch") @@ -162,6 +165,12 @@ (define-runtime-path fcdirs-patch "patches/fcdirs.patch") (define-runtime-path fonts-conf "patches/fonts.conf") +;; Avoid problems compiling with an old version of g++ +(define-runtime-path harfbuzz-oldcompiler-patch "patches/harfbuzz-oldcompiler.patch") + +;; Adapt inline-function handling for an old gcc +(define-runtime-path gmp-inline-patch "patches/gmp-inline.patch") + ;; -------------------------------------------------- ;; General environment and flag configuration: @@ -439,9 +448,10 @@ "--without-libintl-prefix") '())) #:patches (list fcdirs-patch))] - [("pixman") (config #:patches (if (and win? (not m32?)) - (list noforceinline-patch) - null))] + [("pixman") (config #:patches (cond + [(and win? (not m32?)) (list noforceinline-patch)] + [ppc? (list pixman-altivec-patch)] + [else null]))] [("cairo") (when mac? (define zlib.pc (build-path dest "lib" "pkgconfig" "zlib.pc")) @@ -466,7 +476,10 @@ courier-new-patch))] [("harfbuzz") (config #:depends '("fontconfig" "freetype" "cairo") #:configure '("--without-icu") - #:env cxx-env)] + #:env cxx-env + #:patches (if ppc? + (list harfbuzz-oldcompiler-patch) + null))] [("fribidi") (config #:configure '("--disable-docs"))] [("pango") (config #:depends '("cairo" "harfbuzz" "fribidi") #:env (if win? path-flags null) @@ -493,12 +506,15 @@ [("gmp") (config #:patches (if gcc-4.0? (list gmp-weak-patch) null) #:configure (append '("--enable-shared" "--disable-static") - (if mac? + (if (and mac? (not ppc?)) '("--build=corei-apple-darwin") null) (if (and m32? mac?) (list "ABI=32") - null)))] + null)) + #:post-patches (if (and mac? ppc?) + (list gmp-inline-patch) + null))] [("mpfr") (config #:configure (append (if win? '("--enable-thread-safe") null) '("--enable-shared" "--disable-static")) #:depends '("gmp") diff --git a/racket/src/native-libs/patches/gmp-inline.patch b/racket/src/native-libs/patches/gmp-inline.patch new file mode 100644 index 0000000000..62e6c7b157 --- /dev/null +++ b/racket/src/native-libs/patches/gmp-inline.patch @@ -0,0 +1,34 @@ +diff -r -u orig/gmp/gmp.h next/gmp/gmp.h +--- orig/gmp/gmp.h 2018-04-15 10:52:05.000000000 -0600 ++++ next/gmp/gmp.h 2018-04-15 10:50:19.000000000 -0600 +@@ -129,7 +129,6 @@ + #define __GMP_DECLSPEC + #endif + +- + #ifdef __GMP_SHORT_LIMB + typedef unsigned int mp_limb_t; + typedef int mp_limb_signed_t; +@@ -361,7 +360,7 @@ + || (defined __GNUC_GNU_INLINE__ && defined __cplusplus) + #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) + #else +-#define __GMP_EXTERN_INLINE extern __inline__ ++#define __GMP_EXTERN_INLINE static inline + #endif + #define __GMP_INLINE_PROTOTYPES 1 + #endif +@@ -616,9 +615,12 @@ + #define mpz_realloc __gmpz_realloc + __GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t); + ++#undef __GMP_INLINE_PROTOTYPES ++#define __GMP_INLINE_PROTOTYPES 0 ++ + #define mpz_abs __gmpz_abs + #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs) +-__GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr); ++ __GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr); + #endif + + #define mpz_add __gmpz_add diff --git a/racket/src/native-libs/patches/harfbuzz-oldcompiler.patch b/racket/src/native-libs/patches/harfbuzz-oldcompiler.patch new file mode 100644 index 0000000000..68fe92e42a --- /dev/null +++ b/racket/src/native-libs/patches/harfbuzz-oldcompiler.patch @@ -0,0 +1,88 @@ +diff -u -r orig/harfbuzz-1.7.6/src/hb-ot-color-cbdt-table.hh next/harfbuzz-1.7.6/src/hb-ot-color-cbdt-table.hh +--- orig/harfbuzz-1.7.6/src/hb-ot-color-cbdt-table.hh 2018-03-07 01:25:16.000000000 -0700 ++++ next/harfbuzz-1.7.6/src/hb-ot-color-cbdt-table.hh 2018-04-15 08:12:47.000000000 -0600 +@@ -327,7 +327,7 @@ + sizeTables.sanitize (c, this)); + } + +- protected: ++ public: + const IndexSubtableRecord *find_table (hb_codepoint_t glyph, + unsigned int *x_ppem, unsigned int *y_ppem) const + { +diff -u -r orig/harfbuzz-1.7.6/src/hb-ot-font.cc next/harfbuzz-1.7.6/src/hb-ot-font.cc +--- orig/harfbuzz-1.7.6/src/hb-ot-font.cc 2018-03-07 01:25:16.000000000 -0700 ++++ next/harfbuzz-1.7.6/src/hb-ot-font.cc 2018-04-15 08:12:45.000000000 -0600 +@@ -38,6 +38,8 @@ + + #include "hb-ot-color-cbdt-table.hh" + ++const unsigned int OT::KernOT::SubTableWrapper::min_size; ++const unsigned int OT::KernAAT::SubTableWrapper::min_size; + + struct hb_ot_font_t + { +diff -u -r orig/harfbuzz-1.7.6/src/hb-ot-glyf-table.hh next/harfbuzz-1.7.6/src/hb-ot-glyf-table.hh +--- orig/harfbuzz-1.7.6/src/hb-ot-glyf-table.hh 2018-03-07 01:25:16.000000000 -0700 ++++ next/harfbuzz-1.7.6/src/hb-ot-glyf-table.hh 2018-04-15 08:12:47.000000000 -0600 +@@ -55,7 +55,7 @@ + return_trace (true); + } + +- protected: ++ public: + HBUINT8 dataX[VAR]; /* Location data. */ + DEFINE_SIZE_ARRAY (0, dataX); + }; +diff -u -r orig/harfbuzz-1.7.6/src/hb-private.hh next/harfbuzz-1.7.6/src/hb-private.hh +--- orig/harfbuzz-1.7.6/src/hb-private.hh 2018-02-18 12:36:12.000000000 -0700 ++++ next/harfbuzz-1.7.6/src/hb-private.hh 2018-04-15 08:12:47.000000000 -0600 +@@ -327,7 +327,7 @@ + static inline HB_CONST_FUNC unsigned int + _hb_popcount (T v) + { +-#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && defined(__OPTIMIZE__) ++#if 0 && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && defined(__OPTIMIZE__) + if (sizeof (T) <= sizeof (unsigned int)) + return __builtin_popcount (v); + +@@ -414,7 +414,7 @@ + if (sizeof (T) <= 8) + { + /* "bithacks" */ +- const uint64_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000}; ++ const uint64_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000ULL}; + const unsigned int S[] = {1, 2, 4, 8, 16, 32}; + unsigned int r = 0; + for (int i = 5; i >= 0; i--) +@@ -489,12 +489,12 @@ + unsigned int c = 64; + v &= - (int64_t) (v); + if (v) c--; +- if (v & 0x00000000FFFFFFFF) c -= 32; +- if (v & 0x0000FFFF0000FFFF) c -= 16; +- if (v & 0x00FF00FF00FF00FF) c -= 8; +- if (v & 0x0F0F0F0F0F0F0F0F) c -= 4; +- if (v & 0x3333333333333333) c -= 2; +- if (v & 0x5555555555555555) c -= 1; ++ if (v & 0x00000000FFFFFFFFULL) c -= 32; ++ if (v & 0x0000FFFF0000FFFFULL) c -= 16; ++ if (v & 0x00FF00FF00FF00FFULL) c -= 8; ++ if (v & 0x0F0F0F0F0F0F0F0FULL) c -= 4; ++ if (v & 0x3333333333333333ULL) c -= 2; ++ if (v & 0x5555555555555555ULL) c -= 1; + return c; + } + if (sizeof (T) == 16) +diff -u -r orig/harfbuzz-1.7.6/src/hb-subset.cc next/harfbuzz-1.7.6/src/hb-subset.cc +--- orig/harfbuzz-1.7.6/src/hb-subset.cc 2018-02-27 11:50:36.000000000 -0700 ++++ next/harfbuzz-1.7.6/src/hb-subset.cc 2018-04-15 08:12:45.000000000 -0600 +@@ -42,6 +42,8 @@ + #include "hb-ot-maxp-table.hh" + #include "hb-ot-os2-table.hh" + ++const hb_tag_t OT::OpenTypeFontFile::CFFTag; ++const hb_tag_t OT::OpenTypeFontFile::TrueTypeTag; + + #ifndef HB_NO_VISIBILITY + const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; diff --git a/racket/src/native-libs/patches/pixman-altivec.patch b/racket/src/native-libs/patches/pixman-altivec.patch new file mode 100644 index 0000000000..cd95bf63f6 --- /dev/null +++ b/racket/src/native-libs/patches/pixman-altivec.patch @@ -0,0 +1,18 @@ +diff -r -u orig/pixman-0.34.0/pixman/pixman-vmx.c next/pixman-0.34.0/pixman/pixman-vmx.c +--- orig/pixman-0.34.0/pixman/pixman-vmx.c 2016-01-04 02:13:54.000000000 -0700 ++++ next/pixman-0.34.0/pixman/pixman-vmx.c 2018-04-15 06:43:36.000000000 -0600 +@@ -2933,10 +2933,10 @@ + while (vx >= 0) + vx -= src_width_fixed; + +- tmp[0] = tmp1; +- tmp[1] = tmp2; +- tmp[2] = tmp3; +- tmp[3] = tmp4; ++ ((unsigned int *)&tmp)[0] = tmp1; ++ ((unsigned int *)&tmp)[1] = tmp2; ++ ((unsigned int *)&tmp)[2] = tmp3; ++ ((unsigned int *)&tmp)[3] = tmp4; + + vsrc = combine4 ((const uint32_t *) &tmp, pm); +