All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fix compile error on macOS Mojave
@ 2019-03-31  8:07 wangqiang1588 at sina.com
  2019-04-03 17:23 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: wangqiang1588 at sina.com @ 2019-03-31  8:07 UTC (permalink / raw)
  To: u-boot

From: 默默 <wangqiang1588@sina.com>

---
 Makefile  | 7 +++++++
 lib/bch.c | 9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c1af9307b3..92e04dd689 100644
--- a/Makefile
+++ b/Makefile
@@ -291,6 +291,9 @@ DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
 os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
 	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
 
+os_x_after = $(shell if [ $(DARWIN_MAJOR_VERSION) -ge $(1) -a \
+	$(DARWIN_MINOR_VERSION) -ge $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)	
+
 # Snow Leopards build environment has no longer restrictions as described above
 HOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
 HOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
@@ -300,6 +303,10 @@ HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
 # in some host tools which is a problem then ... so disable ASLR for these
 # tools
 HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie")
+
+# macOS Mojave (10.14.X) 
+# Undefined symbols for architecture x86_64: "_PyArg_ParseTuple"
+HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "")
 endif
 
 # Decide whether to build built-in, modular, or both.
diff --git a/lib/bch.c b/lib/bch.c
index 20079eb9eb..c4fac77d61 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -62,6 +62,9 @@
 #include <errno.h>
 #if defined(__FreeBSD__)
 #include <sys/endian.h>
+#elif defined(__APPLE__)
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
 #else
 #include <endian.h>
 #endif
@@ -70,7 +73,11 @@
 #include <string.h>
 
 #undef cpu_to_be32
+#if defined(__APPLE__)
+#define cpu_to_be32 OSSwapHostToBigInt32
+#else
 #define cpu_to_be32 htobe32
+#endif
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 #define kmalloc(size, flags)	malloc(size)
 #define kzalloc(size, flags)	calloc(1, size)
@@ -116,7 +123,7 @@ struct gf_poly_deg1 {
 };
 
 #ifdef USE_HOSTCC
-#if !defined(__DragonFly__) && !defined(__FreeBSD__)
+#if !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__APPLE__)
 static int fls(int x)
 {
 	int r = 32;
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] fix compile error on macOS Mojave
  2019-03-31  8:07 [U-Boot] [PATCH] fix compile error on macOS Mojave wangqiang1588 at sina.com
@ 2019-04-03 17:23 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-04-03 17:23 UTC (permalink / raw)
  To: u-boot

On Sun, Mar 31, 2019 at 04:07:03PM +0800, wangqiang1588 at sina.com wrote:

> From: 默默 <wangqiang1588@sina.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190403/8e70381b/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-03 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-31  8:07 [U-Boot] [PATCH] fix compile error on macOS Mojave wangqiang1588 at sina.com
2019-04-03 17:23 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.