Fix ruby build

pull/7759/head
Yuchen Zeng 8 years ago
parent 42a6c267c5
commit b1b2115a26
  1. 29
      Makefile
  2. 2
      src/ruby/ext/grpc/extconf.rb
  3. 29
      templates/Makefile.template

@ -656,7 +656,24 @@ endif
CARES_PKG_CONFIG = false 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) ifeq ($(HAS_PKG_CONFIG),true)
CARES_PKG_CONFIG = true CARES_PKG_CONFIG = true
PC_REQUIRES_GRPC += libcares PC_REQUIRES_GRPC += libcares
@ -671,16 +688,6 @@ else
PC_LIBS_GRPC += -lcares PC_LIBS_GRPC += -lcares
LIBS += libcares LIBS += libcares
endif 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 endif
LIBS_CARES = cares LIBS_CARES = cares

@ -70,6 +70,7 @@ ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/
ENV['EMBED_OPENSSL'] = 'true' ENV['EMBED_OPENSSL'] = 'true'
ENV['EMBED_ZLIB'] = 'true' ENV['EMBED_ZLIB'] = 'true'
ENV['EMBED_CARES'] = 'true'
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG'] ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/ ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
ENV['CFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE' ENV['CFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
@ -86,6 +87,7 @@ end
$CFLAGS << ' -I' + File.join(grpc_root, 'include') $CFLAGS << ' -I' + File.join(grpc_root, 'include')
$LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
$LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libcares.a') unless windows
if grpc_config == 'gcov' if grpc_config == 'gcov'
$CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage' $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage'
$LDFLAGS << ' -fprofile-arcs -ftest-coverage -rdynamic' $LDFLAGS << ' -fprofile-arcs -ftest-coverage -rdynamic'

@ -544,7 +544,24 @@
CARES_PKG_CONFIG = false 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) ifeq ($(HAS_PKG_CONFIG),true)
CARES_PKG_CONFIG = true CARES_PKG_CONFIG = true
PC_REQUIRES_GRPC += libcares PC_REQUIRES_GRPC += libcares
@ -559,16 +576,6 @@
PC_LIBS_GRPC += -lcares PC_LIBS_GRPC += -lcares
LIBS += libcares LIBS += libcares
endif 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 endif
LIBS_CARES = cares LIBS_CARES = cares

Loading…
Cancel
Save