diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/Makefile.template | 37 | ||||
-rw-r--r-- | templates/config.m4.template | 14 | ||||
-rw-r--r-- | templates/package.xml.template | 4 | ||||
-rw-r--r-- | templates/tools/dockerfile/test/cxx_squeeze_x64/Dockerfile.template | 17 | ||||
-rw-r--r-- | templates/tools/dockerfile/test/cxx_squeeze_x64/post-git-setup.sh.template | 37 | ||||
-rw-r--r-- | templates/tools/openssl/use_openssl.sh.template | 63 | ||||
-rw-r--r-- | templates/tools/run_tests/sources_and_headers.json.template | 39 | ||||
-rw-r--r-- | templates/tools/run_tests/tests.json.template | 3 |
8 files changed, 181 insertions, 33 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template index 7aa6ad71e2..c54c146620 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -187,6 +187,12 @@ CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) + CHECK_SHADOW_WORKS_CMD = $(CC) -std=c99 -Werror -Wshadow -o $(TMPOUT) -c test/build/shadow.c + HAS_WORKING_SHADOW = $(shell $(CHECK_SHADOW_WORKS_CMD) 2> /dev/null && echo true || echo false) + ifeq ($(HAS_WORKING_SHADOW),true) + W_SHADOW=-Wshadow + endif + CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true) @@ -207,7 +213,7 @@ DEFINES += $(EXTRA_DEFINES) endif - CFLAGS += -std=c99 -Wsign-conversion -Wconversion -Wshadow + CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 else @@ -352,6 +358,7 @@ OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) + BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) ${defaults.boringssl.CPPFLAGS} $(CFLAGS) ${defaults.boringssl.CFLAGS} -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -436,10 +443,13 @@ # Note that for testing purposes, one can do: # make HAS_EMBEDDED_OPENSSL_ALPN=false # to emulate the fact we do not have OpenSSL in the third_party folder. - ifeq ($(wildcard third_party/boringssl/include/openssl/ssl.h),) + ifneq ($(wildcard third_party/${openssl_fallback.extraction_dir}/libssl.a),) + HAS_EMBEDDED_OPENSSL_ALPN = third_party/${openssl_fallback.extraction_dir} + else ifeq ($(wildcard third_party/boringssl/include/openssl/ssl.h),) HAS_EMBEDDED_OPENSSL_ALPN = false else - HAS_EMBEDDED_OPENSSL_ALPN = true + CAN_COMPILE_EMBEDDED_OPENSSL ?= $(shell $(BORINGSSL_COMPILE_CHECK_CMD) 2> /dev/null && echo true || echo false) + HAS_EMBEDDED_OPENSSL_ALPN = $(CAN_COMPILE_EMBEDDED_OPENSSL) endif ifeq ($(wildcard third_party/zlib/zlib.h),) @@ -498,8 +508,8 @@ EMBED_OPENSSL ?= false NO_SECURE ?= false else # HAS_SYSTEM_OPENSSL_ALPN=false - ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) - EMBED_OPENSSL ?= true + ifneq ($(HAS_EMBEDDED_OPENSSL_ALPN),false) + EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) NO_SECURE ?= false else # HAS_EMBEDDED_OPENSSL_ALPN=false ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) @@ -520,6 +530,12 @@ OPENSSL_MERGE_OBJS += $(LIBBORINGSSL_OBJS) # need to prefix these to ensure overriding system libraries CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) + else ifneq ($(EMBED_OPENSSL),false) + OPENSSL_DEP += $(EMBED_OPENSSL)/libssl.a $(EMBED_OPENSSL)/libcrypto.a + OPENSSL_MERGE_LIBS += $(EMBED_OPENSSL)/libssl.a $(EMBED_OPENSSL)/libcrypto.a + OPENSSL_MERGE_OBJS += $(wildcard $(EMBED_OPENSSL)/grpc_obj/*.o) + # need to prefix these to ensure overriding system libraries + CPPFLAGS := -I$(EMBED_OPENSSL)/include $(CPPFLAGS) else # EMBED_OPENSSL=false ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_PKG_CONFIG = true @@ -706,8 +722,9 @@ @echo @echo "DEPENDENCY ERROR" @echo - @echo "The target you are trying to run requires OpenSSL." - @echo "Your system doesn't have it, and neither does the third_party directory." + @echo "The target you are trying to run requires an OpenSSL implementation." + @echo "Your system doesn't have one, and either the third_party directory" + @echo "doesn't have it, or your compiler can't build BoringSSL." @echo @echo "Please consult INSTALL to get more information." @echo @@ -1846,3 +1863,9 @@ strip_cxx strip-shared_cxx strip-static_cxx \ dep_c dep_cxx bins_dep_c bins_dep_cxx \ clean + + .PHONY: printvars + printvars: + @$(foreach V,$(sort $(.VARIABLES)), \ + $(if $(filter-out environment% default automatic, \ + $(origin $V)),$(warning $V=$($V) ($(value $V))))) diff --git a/templates/config.m4.template b/templates/config.m4.template index dbc12188dc..5e73901efa 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -41,4 +41,18 @@ , $ext_shared, , -Wall -Werror -std=c11 ${"\\"} -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"} -D_HAS_EXCEPTIONS=0 -DNOMINMAX) + + PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) + <% + dirs = {} + for lib in libs: + if lib.name in php_config_m4.get('deps', []): + for source in lib.src: + dirs[source[:source.rfind('/')]] = 1 + dirs = dirs.keys() + dirs.sort() + %> + % for dir in dirs: + PHP_ADD_BUILD_DIR($ext_builddir/${dir}) + % endfor fi diff --git a/templates/package.xml.template b/templates/package.xml.template index 455b002e64..067c8839d5 100644 --- a/templates/package.xml.template +++ b/templates/package.xml.template @@ -12,7 +12,7 @@ <email>grpc-packages@google.com</email> <active>yes</active> </lead> - <%! from time import strftime %><date>${"%Y-%m-%d" | strftime}</date> + <date>2016-02-24</date> <time>16:06:07</time> <version> <release>0.8.0</release> @@ -149,7 +149,7 @@ <release>beta</release> <api>beta</api> </stability> - <date>${"%Y-%m-%d" | strftime}</date> + <date>2016-02-24</date> <license>BSD</license> <notes> - Simplify gRPC PHP installation #4517 diff --git a/templates/tools/dockerfile/test/cxx_squeeze_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_squeeze_x64/Dockerfile.template index 294ae00b4c..49371aaa3b 100644 --- a/templates/tools/dockerfile/test/cxx_squeeze_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/cxx_squeeze_x64/Dockerfile.template @@ -1,6 +1,6 @@ %YAML 1.2 --- | - # Copyright 2015-2016, Google Inc. + # Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,18 +28,21 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + FROM debian:squeeze - + <%include file="../../apt_get_basic.include" args="skip_golang=True"/> - + # libgflags-dev is not available on squeezy RUN apt-get update && apt-get -y install libgtest-dev libc++-dev clang && apt-get clean - + RUN apt-get update && apt-get -y install python-pip && apt-get clean RUN pip install argparse - + + RUN wget ${openssl_fallback.base_uri + openssl_fallback.tarball} + + ENV POST_GIT_STEP tools/dockerfile/test/cxx_squeeze_x64/post-git-setup.sh + <%include file="../../run_tests_addons.include" args="skip_zookeeper=True"/> # Define the default command. CMD ["bash"] -
\ No newline at end of file diff --git a/templates/tools/dockerfile/test/cxx_squeeze_x64/post-git-setup.sh.template b/templates/tools/dockerfile/test/cxx_squeeze_x64/post-git-setup.sh.template new file mode 100644 index 0000000000..b885101748 --- /dev/null +++ b/templates/tools/dockerfile/test/cxx_squeeze_x64/post-git-setup.sh.template @@ -0,0 +1,37 @@ +%YAML 1.2 +--- | + #!/bin/bash + # Copyright 2016, Google Inc. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + set -ex + + cd /var/local/git/grpc + cp /${openssl_fallback.tarball} third_party + ./tools/openssl/use_openssl.sh diff --git a/templates/tools/openssl/use_openssl.sh.template b/templates/tools/openssl/use_openssl.sh.template new file mode 100644 index 0000000000..5fb377154a --- /dev/null +++ b/templates/tools/openssl/use_openssl.sh.template @@ -0,0 +1,63 @@ +%YAML 1.2 +--- | + #!/bin/bash + + # Copyright 2015-2016, Google Inc. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + set -ex + + cd $(dirname $0)/../.. + set root=`pwd` + CC=${"${CC:-cc}"} + + # allow openssl to be pre-downloaded + if [ ! -e third_party/${openssl_fallback.tarball} ] + then + echo "Downloading ${openssl_fallback.base_uri + openssl_fallback.tarball} to third_party/${openssl_fallback.tarball}" + wget ${openssl_fallback.base_uri + openssl_fallback.tarball} -O third_party/${openssl_fallback.tarball} + fi + + # clean openssl directory + rm -rf third_party/${openssl_fallback.extraction_dir} + + # extract archive + cd third_party + tar xfz ${openssl_fallback.tarball} + + # build openssl + cd ${openssl_fallback.extraction_dir} + CC="$CC -fPIC -fvisibility=hidden" ./config no-asm + make + + # generate the 'grpc_obj' directory needed by the makefile + mkdir grpc_obj + cd grpc_obj + ar x ../libcrypto.a + ar x ../libssl.a diff --git a/templates/tools/run_tests/sources_and_headers.json.template b/templates/tools/run_tests/sources_and_headers.json.template index 78363ff1fa..18b9bc2654 100644 --- a/templates/tools/run_tests/sources_and_headers.json.template +++ b/templates/tools/run_tests/sources_and_headers.json.template @@ -3,21 +3,27 @@ <%! import json import os - + def proto_headers(src): - out = [] - for f in src: - name, ext = os.path.splitext(f) - if ext == '.proto': - out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h']) - return out - + out = [] + for f in src: + name, ext = os.path.splitext(f) + if ext == '.proto': + out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h']) + return out + + def all_targets(targets, libs): + for tgt in targets: + yield ('target', tgt) + for tgt in libs: + yield ('lib', tgt) + def no_protos_filter(src): return os.path.splitext(src)[1] != '.proto' def no_third_party_filter(src): return not src.startswith('third_party/') - + def filter_srcs(srcs, filters): out = [] for s in srcs: @@ -26,18 +32,19 @@ out.append(s) return out %> - + ${json.dumps([{"name": tgt.name, + "type": typ, "language": tgt.language, + "third_party": tgt.boringssl or tgt.zlib, "src": sorted( - filter_srcs(tgt.src, (no_protos_filter, no_third_party_filter)) + - filter_srcs(tgt.get('public_headers', []), (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.src, (no_protos_filter, no_third_party_filter)) + + filter_srcs(tgt.get('public_headers', []), (no_protos_filter, no_third_party_filter)) + filter_srcs(tgt.get('headers', []), (no_third_party_filter,))), "headers": sorted( - tgt.get('public_headers', []) + - tgt.get('headers', []) + + tgt.get('public_headers', []) + + tgt.get('headers', []) + proto_headers(tgt.src)), "deps": sorted(tgt.get('deps', []))} - for tgt in (targets + libs) - if not tgt.boringssl and not tgt.zlib], + for typ, tgt in all_targets(targets, libs)], sort_keys=True, indent=2)} diff --git a/templates/tools/run_tests/tests.json.template b/templates/tools/run_tests/tests.json.template index 9a84783467..5690874415 100644 --- a/templates/tools/run_tests/tests.json.template +++ b/templates/tools/run_tests/tests.json.template @@ -3,11 +3,12 @@ <%! import json %> - + ${json.dumps([{"name": tgt.name, "language": tgt.language, "platforms": tgt.platforms, "ci_platforms": tgt.ci_platforms, + "gtest": tgt.gtest, "exclude_configs": tgt.get("exclude_configs", []), "args": [], "flaky": tgt.flaky, |