diff options
-rw-r--r-- | Makefile | 29 | ||||
-rw-r--r-- | src/ruby/ext/grpc/extconf.rb | 2 | ||||
-rw-r--r-- | templates/Makefile.template | 29 |
3 files changed, 38 insertions, 22 deletions
@@ -656,7 +656,24 @@ endif CARES_PKG_CONFIG = false -ifeq ($(HAS_SYSTEM_CARES),true) +ifeq ($(HAS_SYSTEM_CARES),false) +ifeq ($(HAS_EMBEDDED_CARES), true) +EMBED_CARES ?= true +else +DEP_MISSING += cares +EMBED_CARES ?= broken +endif +else +EMBED_CARES ?= false +endif + +ifeq ($(EMBED_CARES),true) +CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a +CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS) +LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) +CARES_CFLAGS_EXTRA += $(findstring -m32,$(CFLAGS)) +CARES_CFLAGS_EXTRA += -Wno-invalid-source-encoding +else ifeq ($(HAS_PKG_CONFIG),true) CARES_PKG_CONFIG = true PC_REQUIRES_GRPC += libcares @@ -671,16 +688,6 @@ else PC_LIBS_GRPC += -lcares LIBS += libcares endif -else -ifeq ($(HAS_EMBEDDED_CARES),true) -CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a -CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS) -LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) -CARES_CFLAGS_EXTRA += $(findstring -m32,$(CFLAGS)) -CARES_CFLAGS_EXTRA += -Wno-invalid-source-encoding -else -DEP_MISSING += c-ares -endif endif LIBS_CARES = cares diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 6d65db8306..9bc9ee2c2b 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -70,6 +70,7 @@ ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/ ENV['EMBED_OPENSSL'] = 'true' ENV['EMBED_ZLIB'] = 'true' +ENV['EMBED_CARES'] = 'true' ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG'] ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/ ENV['CFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE' @@ -86,6 +87,7 @@ end $CFLAGS << ' -I' + File.join(grpc_root, 'include') $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows +$LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libcares.a') unless windows if grpc_config == 'gcov' $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage' $LDFLAGS << ' -fprofile-arcs -ftest-coverage -rdynamic' diff --git a/templates/Makefile.template b/templates/Makefile.template index 8e4c87b640..324977fef2 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -544,7 +544,24 @@ CARES_PKG_CONFIG = false - ifeq ($(HAS_SYSTEM_CARES),true) + ifeq ($(HAS_SYSTEM_CARES),false) + ifeq ($(HAS_EMBEDDED_CARES), true) + EMBED_CARES ?= true + else + DEP_MISSING += cares + EMBED_CARES ?= broken + endif + else + EMBED_CARES ?= false + endif + + ifeq ($(EMBED_CARES),true) + CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a + CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS) + LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) + CARES_CFLAGS_EXTRA += $(findstring -m32,$(CFLAGS)) + CARES_CFLAGS_EXTRA += -Wno-invalid-source-encoding + else ifeq ($(HAS_PKG_CONFIG),true) CARES_PKG_CONFIG = true PC_REQUIRES_GRPC += libcares @@ -559,16 +576,6 @@ PC_LIBS_GRPC += -lcares LIBS += libcares endif - else - ifeq ($(HAS_EMBEDDED_CARES),true) - CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a - CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS) - LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) - CARES_CFLAGS_EXTRA += $(findstring -m32,$(CFLAGS)) - CARES_CFLAGS_EXTRA += -Wno-invalid-source-encoding - else - DEP_MISSING += c-ares - endif endif LIBS_CARES = cares |