Build c-ares without running ./configure

pull/7759/head
Yuchen Zeng 9 years ago
parent d790dd6a5c
commit f64bf28e87
  1. 1
      .gitmodules
  2. 6
      Makefile
  3. 9
      build.yaml
  4. 14
      setup.py
  5. 3
      src/c-ares/gen_build_yaml.py
  6. 5
      templates/Makefile.template
  7. 2
      third_party/c-ares
  8. 2
      tools/buildgen/plugins/expand_bin_attrs.py
  9. 1
      tools/buildgen/plugins/expand_filegroups.py
  10. 4
      tools/distrib/check_copyright.py

1
.gitmodules vendored

@ -20,3 +20,4 @@
[submodule "third_party/c-ares"] [submodule "third_party/c-ares"]
path = third_party/c-ares path = third_party/c-ares
url = https://github.com/c-ares/c-ares.git url = https://github.com/c-ares/c-ares.git
branch = cares-1_11_0

@ -1252,8 +1252,6 @@ $(LIBDIR)/$(CONFIG)/c-ares/libcares.a: third_party/c-ares/configure
$(Q)$(MAKE) -C third_party/c-ares $(Q)$(MAKE) -C third_party/c-ares
$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares
$(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG) $(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG)
# $(Q)[ -f third_party/c-ares/.libs/libcares.2.dylib ] && cp third_party/c-ares/.libs/libcares.2.dylib $(LIBDIR)/$(CONFIG)/c-ares
# $(Q)[ -f third_party/c-ares/.libs/libcares.dylib ] && cp third_party/c-ares/.libs/libcares.dylib $(LIBDIR)/$(CONFIG)/c-ares
$(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure
$(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure
@ -6615,8 +6613,10 @@ PUBLIC_HEADERS_C += \
LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC)))) LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC))))
$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H
$(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion -Wno-invalid-source-encoding
$(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) $(LIBARES_OBJS) $(CARES_DEP) $(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) third_party/c-ares/configure $(LIBARES_OBJS) $(CARES_DEP)
$(E) "[AR] Creating $@" $(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libares.a $(Q) rm -f $(LIBDIR)/$(CONFIG)/libares.a

@ -3375,11 +3375,10 @@ configs:
timeout_multiplier: 1.5 timeout_multiplier: 1.5
defaults: defaults:
ares: ares:
CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas CFLAGS: -Wno-sign-conversion -Wno-invalid-source-encoding
-Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) CPPFLAGS: -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux)
-DHAVE_CONFIG_H -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0
CPPFLAGS: -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -DNOMINMAX -DHAVE_CONFIG_H
-D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX
boringssl: boringssl:
CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas
-Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI)

@ -52,11 +52,12 @@ PYTHON_STEM = os.path.join('src', 'python', 'grpcio')
CORE_INCLUDE = ('include', '.',) CORE_INCLUDE = ('include', '.',)
BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),)
CARES_INCLUDE = (os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) CARES_INCLUDE = (
if "linux" in sys.platform: os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),)
CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) if 'linux' in sys.platform:
if "darwin" in sys.platform: CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),)
CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) if 'darwin' in sys.platform:
CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),)
# Ensure we're in the proper directory whether or not we're being used by pip. # Ensure we're in the proper directory whether or not we're being used by pip.
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
@ -134,7 +135,8 @@ CYTHON_HELPER_C_FILES = ()
CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES) CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES)
EXTENSION_INCLUDE_DIRECTORIES = ( EXTENSION_INCLUDE_DIRECTORIES = (
(PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE) (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE +
CARES_INCLUDE)
EXTENSION_LIBRARIES = () EXTENSION_LIBRARIES = ()
if "linux" in sys.platform: if "linux" in sys.platform:

@ -59,10 +59,9 @@ try:
gen_ares_build(x) gen_ares_build(x)
return 'third_party/c-ares/ares_build.h' return 'third_party/c-ares/ares_build.h'
out['libs'] = [{ out['libs'] = [{
'name': 'ares', 'name': 'ares',
'defaults': 'ares',
'build': 'private', 'build': 'private',
'language': 'c', 'language': 'c',
'secure': 'no', 'secure': 'no',

@ -894,8 +894,6 @@
$(Q)$(MAKE) -C third_party/c-ares $(Q)$(MAKE) -C third_party/c-ares
$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares
$(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG) $(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG)
# $(Q)[ -f third_party/c-ares/.libs/libcares.2.dylib ] && cp third_party/c-ares/.libs/libcares.2.dylib $(LIBDIR)/$(CONFIG)/c-ares
# $(Q)[ -f third_party/c-ares/.libs/libcares.dylib ] && cp third_party/c-ares/.libs/libcares.dylib $(LIBDIR)/$(CONFIG)/c-ares
$(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure
$(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure
@ -1499,6 +1497,9 @@
% if lib.name != 'z': % if lib.name != 'z':
$(ZLIB_DEP) \ $(ZLIB_DEP) \
% endif % endif
% if lib.name == 'ares':
third_party/c-ares/configure \
% endif
% endif % endif
% if lib.language == 'c++': % if lib.language == 'c++':
$(PROTOBUF_DEP)\ $(PROTOBUF_DEP)\

@ -1 +1 @@
Subproject commit 7d3e99fd5c57d61a420f2e1419989740916fbeb2 Subproject commit e7fe2744db383c4489b7adc2b74f8ec3069367e4

@ -52,9 +52,11 @@ def mako_plugin(dictionary):
tgt['ci_platforms'] = sorted(tgt.get('ci_platforms', tgt['platforms'])) tgt['ci_platforms'] = sorted(tgt.get('ci_platforms', tgt['platforms']))
tgt['boringssl'] = tgt.get('boringssl', False) tgt['boringssl'] = tgt.get('boringssl', False)
tgt['zlib'] = tgt.get('zlib', False) tgt['zlib'] = tgt.get('zlib', False)
tgt['ares'] = tgt.get('ares', False)
tgt['gtest'] = tgt.get('gtest', False) tgt['gtest'] = tgt.get('gtest', False)
libs = dictionary.get('libs') libs = dictionary.get('libs')
for lib in libs: for lib in libs:
lib['boringssl'] = lib.get('boringssl', False) lib['boringssl'] = lib.get('boringssl', False)
lib['zlib'] = lib.get('zlib', False) lib['zlib'] = lib.get('zlib', False)
lib['ares'] = lib.get('ares', False)

@ -57,6 +57,7 @@ FILEGROUP_DEFAULTS = {
'language': 'c', 'language': 'c',
'boringssl': False, 'boringssl': False,
'zlib': False, 'zlib': False,
'ares': False,
} }

@ -108,7 +108,9 @@ RE_LICENSE = dict(
if args.precommit: if args.precommit:
FILE_LIST_COMMAND = 'git status -z | grep -Poz \'(?<=^[MARC][MARCD ] )[^\s]+\'' FILE_LIST_COMMAND = 'git status -z | grep -Poz \'(?<=^[MARC][MARCD ] )[^\s]+\''
else: else:
FILE_LIST_COMMAND = 'git ls-tree -r --name-only -r HEAD | grep -v ^third_party/' FILE_LIST_COMMAND = 'git ls-tree -r --name-only -r HEAD | ' \
'grep -v ^third_party/ |' \
'grep -v "\(ares_config.h\|ares_build.h\)"'
def load(name): def load(name):
with open(name) as f: with open(name) as f:

Loading…
Cancel
Save