summaryrefslogtreecommitdiff
blob: 6c4767759b4d1951d36de0bec0ce511ef4d977d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From b9e631dad111f725c1a4e8b69ff1960397a5cc22 Mon Sep 17 00:00:00 2001
From: Chirantan Ekbote <chirantan@google.com>
Date: Mon, 10 Jul 2017 13:19:35 -0700
Subject: [PATCH 2/5] grpc-1.3.0: Fix cross-compiling

Cross-compiling was severely broken in the Makefile.  Fix it.

Sent upstream as https://github.com/grpc/grpc/pull/11476.
---
 Makefile | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 95de4f6530..4f0680e1d2 100644
--- a/Makefile
+++ b/Makefile
@@ -329,6 +329,7 @@ HOST_CC ?= $(CC)
 HOST_CXX ?= $(CXX)
 HOST_LD ?= $(LD)
 HOST_LDXX ?= $(LDXX)
+HOST_AR ?= $(AR)
 
 CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI)
 ifeq ($(HAS_CXX11),true)
@@ -438,11 +439,12 @@ LDFLAGS += $(EXTRA_LDFLAGS)
 DEFINES += $(EXTRA_DEFINES)
 LDLIBS += $(EXTRA_LDLIBS)
 
-HOST_CPPFLAGS = $(CPPFLAGS)
-HOST_CFLAGS = $(CFLAGS)
-HOST_CXXFLAGS = $(CXXFLAGS)
-HOST_LDFLAGS = $(LDFLAGS)
-HOST_LDLIBS = $(LDLIBS)
+HOST_CPPFLAGS = $(CPPFLAGS_NO_ARCH) -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -fPIC
+HOST_CFLAGS = -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI)
+HOST_CXXFLAGS = -std=c++11
+HOST_LDFLAGS = -g -fPIC -Llibs/$(CONFIG)
+HOST_LDLIBS = -lprotoc
+HOST_AROPTS = $(AROPTS)
 
 # These are automatically computed variables.
 # There shouldn't be any need to change anything from now on.
@@ -6838,10 +6840,10 @@ $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: protobuf_dep_error
 else
 
 $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP)  $(PROTOBUF_DEP) $(LIBGRPC_PLUGIN_SUPPORT_OBJS) 
-	$(E) "[AR]      Creating $@"
+	$(E) "[HOSTAR]  Creating $@"
 	$(Q) mkdir -p `dirname $@`
 	$(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
-	$(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(LIBGRPC_PLUGIN_SUPPORT_OBJS) 
+	$(Q) $(HOST_AR) $(HOST_AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(LIBGRPC_PLUGIN_SUPPORT_OBJS)
 ifeq ($(SYSTEM),Darwin)
 	$(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
 endif
-- 
2.14.0.rc0.284.gd933b75aa4-goog