osxcross/patches/cctools-ld64-cygwin-buildfix.patch
2016-09-22 20:22:43 +02:00

63 lines
2.1 KiB
Diff

diff --git cctools/configure.ac cctools/configure.ac
index 56e8f24..5219e3d 100644
--- cctools/configure.ac
+++ cctools/configure.ac
@@ -49,7 +49,8 @@ case $host_os in
;;
cygwin* )
iscygwin=yes
- EXTRAFLAGS="-D__LARGE64_FILES -fno-PIC"
+ # https://github.com/tpoechtrager/osxcross/issues/87
+ EXTRAFLAGS="-D__LARGE64_FILES -D_GNU_SOURCE -fno-PIC"
WARNINGS="-Wno-attributes"
XCC="gcc"
XCXX="g++"
diff --git cctools/include/foreign/machine/endian.h cctools/include/foreign/machine/endian.h
index 6cf3901..0920fd6 100644
--- cctools/include/foreign/machine/endian.h
+++ cctools/include/foreign/machine/endian.h
@@ -28,7 +28,8 @@
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
+ defined(__DragonFly__) || defined(__CYGWIN__)
#include_next <machine/endian.h>
#else
#ifndef _BSD_MACHINE_ENDIAN_H_
@@ -45,4 +46,5 @@
#endif
#endif /* _BSD_MACHINE_ENDIAN_H_ */
-#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ ||
+ __DragonFly__ || __CYGWIN__ */
diff --git usage_examples/ios_toolchain/wrapper.c usage_examples/ios_toolchain/wrapper.c
index c102d79..b88d35a 100644
--- usage_examples/ios_toolchain/wrapper.c
+++ usage_examples/ios_toolchain/wrapper.c
@@ -85,7 +85,8 @@ char *get_executable_path(char *epath, size_t buflen)
if (!ok) return NULL;
l = strlen(epath);
#else
- ssize_t l = readlink("/proc/self/exe", epath, buflen);
+ ssize_t l = readlink("/proc/self/exe", epath, buflen - 1);
+ if (l > 0) epath[l] = '\0';
#endif
if (l <= 0) return NULL;
epath[buflen - 1] = '\0';
--- cctools/configure
+++ cctools/configure
@@ -2627,7 +2627,8 @@
;;
cygwin* )
iscygwin=yes
- EXTRAFLAGS="-D__LARGE64_FILES -fno-PIC"
+ # https://github.com/tpoechtrager/osxcross/issues/87
+ EXTRAFLAGS="-D__LARGE64_FILES -D_GNU_SOURCE -fno-PIC"
WARNINGS="-Wno-attributes"
XCC="gcc"
XCXX="g++"