diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/CMakeLists.txt.template | 17 | ||||
-rw-r--r-- | templates/Makefile.template | 32 | ||||
-rw-r--r-- | templates/binding.gyp.template | 125 | ||||
-rw-r--r-- | templates/config.m4.template | 6 | ||||
-rw-r--r-- | templates/package.json.template | 4 | ||||
-rw-r--r-- | templates/package.xml.template | 46 | ||||
-rw-r--r-- | templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template | 15 | ||||
-rw-r--r-- | templates/vsprojects/grpc.sln.template | 2 |
8 files changed, 187 insertions, 60 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index c3c636c6af..028c1b8c32 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -84,7 +84,13 @@ set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library") if (MSVC) - add_definitions( -D_WIN32_WINNT=0x600 ) + add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) + # needed to compile boringssl + add_definitions(/wd4464 /wd4623 /wd4668 /wd4701 /wd4702 /wd4777 /wd5027) + # needed to compile protobuf + add_definitions(/wd4065 /wd4506) + # TODO(jtattermusch): revisit C4267 occurrences throughout the code + add_definitions(/wd4267) endif() if (gRPC_USE_PROTO_LITE) @@ -188,14 +194,19 @@ endif() % for lib in libs: - % if lib.build in ["all", "protoc", "tool"]: + % if lib.build in ["all", "protoc", "tool"] and lib.language in ['c', 'c++']: + ## TODO(jtattermusch): grpc++_reflection includes .proto files + ## which is not yet supported and thus fails the entire build. + ## Re-enable once fixed. + % if lib.name != 'grpc++_reflection': ${cc_library(lib)} ${cc_install(lib)} % endif + % endif % endfor % for tgt in targets: - % if tgt.build in ["all", "protoc", "tool"]: + % if tgt.build in ["all", "protoc", "tool"] and tgt.language in ['c', 'c++']: ${cc_binary(tgt)} ${cc_install(tgt)} % endif diff --git a/templates/Makefile.template b/templates/Makefile.template index 109de33c31..6f4db26f2b 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -182,12 +182,19 @@ endif STRIP ?= strip -x else + ifeq ($(SYSTEM),MINGW32) + ifeq ($(origin AR), default) + AR = ar rcs + endif + STRIP ?= strip --strip-unneeded + else ifeq ($(origin AR), default) AR = ar rcs endif STRIP ?= strip endif endif + endif INSTALL ?= install RM ?= rm -f PKG_CONFIG ?= pkg-config @@ -392,6 +399,7 @@ Libs.private: $(PC_LIBS_PRIVATE) ifeq ($(SYSTEM),MINGW32) + EXECUTABLE_SUFFIX = .exe SHARED_EXT_CORE = dll SHARED_EXT_CPP = dll SHARED_EXT_CSHARP = dll @@ -400,6 +408,7 @@ SHARED_VERSION_CPP = -${settings.cpp_version.major} SHARED_VERSION_CSHARP = -${settings.csharp_version.major} else ifeq ($(SYSTEM),Darwin) + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib SHARED_EXT_CPP = dylib SHARED_EXT_CSHARP = dylib @@ -408,6 +417,7 @@ SHARED_VERSION_CPP = SHARED_VERSION_CSHARP = else + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) @@ -1196,7 +1206,7 @@ $(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) ${' '.join('$(GENDIR)/%s.pb.cc $(GENDIR)/%s.grpc.pb.cc' % (q,q) for q in proto_deps.get(p, []))} $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin $< + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif % endfor @@ -1293,9 +1303,9 @@ % if not lib.get('external_deps', None): $(E) "[INSTALL] Installing $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]})" $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT_${lang_to_var[lib.language]}) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]})-dll.a $(prefix)/lib/lib${lib.name}.a else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major} $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so @@ -1322,9 +1332,6 @@ ${install_shared("csharp")} install-plugins: $(PROTOC_PLUGINS) - ifeq ($(SYSTEM),MINGW32) - $(Q) false - else $(E) "[INSTALL] Installing grpc protoc plugins" % for tgt in targets: % if tgt.build == 'protoc': @@ -1332,7 +1339,6 @@ $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} % endif % endfor - endif install-pkg-config_c: pc_c pc_c_unsecure $(E) "[INSTALL] Installing C pkg-config files" @@ -1513,8 +1519,8 @@ assert dep_lib, 'lib %s not found (in %s)' % (dep, lib.name) link_libs = link_libs + ' -l' + dep lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT_' + lang_to_var[dep_lib.language] + ')' - mingw_libs = mingw_libs + ' -l' + dep + '-imp' - mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT_' + lang_to_var[dep_lib.language] + ')' + mingw_libs = mingw_libs + ' -l' + dep + '$(SHARED_VERSION_' + lang_to_var[dep_lib.language] + ')-dll' + mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '$(SHARED_VERSION_' + lang_to_var[dep_lib.language] + ').$(SHARED_EXT_' + lang_to_var[dep_lib.language] + ')' security = lib.get('secure', 'check') if security == True: @@ -1546,17 +1552,17 @@ ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps} $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared ${lib.name}.def -Wl,--output-def=${out_mingbase}.def -Wl,--out-implib=${out_libbase}-dll.a -o ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${mingw_libs} + $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_mingbase}.def -Wl,--out-implib=${out_libbase}-dll.a -o ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${mingw_libs} else ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${lib_deps} $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} + $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} else $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.core_version.major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so + $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} + $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so endif endif % endif diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index e6592acebb..851effc4f3 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -39,18 +39,68 @@ # Some of this file is built with the help of # https://n8.io/converting-a-c-library-to-gyp/ { + 'variables': { + 'runtime%': 'node' + }, 'target_defaults': { 'include_dirs': [ '.', 'include' ], 'defines': [ - 'GRPC_UV' + 'GPR_BACKWARDS_COMPATIBILITY_MODE' ], 'conditions': [ + ['runtime=="node"', { + 'defines': [ + 'GRPC_UV' + ] + }], + ['OS!="win" and runtime=="electron"', { + "defines": [ + 'OPENSSL_NO_THREADS' + ] + }], + # This is the condition for using boringssl + ['OS=="win" or runtime=="electron"', { + "include_dirs": [ + "third_party/boringssl/include" + ], + "defines": [ + 'OPENSSL_NO_ASM' + ] + }, { + # Based on logic above, we know that this must be a non-Windows system + 'variables': { + # The output of "node --version" is "v[version]". We use cut to + # remove the first character. + 'target%': '<!(node --version | cut -c2-)' + }, + # Empirically, Node only exports ALPN symbols if its major version is >0. + # io.js always reports versions >0 and always exports ALPN symbols. + # Therefore, Node's major version will be truthy if and only if it + # supports ALPN. The target is "[major].[minor].[patch]". We split by + # periods and take the first field to get the major version. + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)' + ], + 'include_dirs': [ + '<(node_root_dir)/deps/openssl/openssl/include', + ], + 'conditions': [ + ["target_arch=='ia32'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] + }], + ["target_arch=='x64'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] + }], + ["target_arch=='arm'", { + "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] + }] + ] + }], ['OS == "win"', { "include_dirs": [ - "third_party/boringssl/include", "third_party/zlib" ], "defines": [ @@ -60,8 +110,6 @@ 'UNICODE', '_UNICODE', 'NOMINMAX', - 'OPENSSL_NO_ASM', - 'GPR_BACKWARDS_COMPATIBILITY_MODE' ], "msvs_settings": { 'VCCLCompilerTool': { @@ -74,21 +122,8 @@ }, { # OS != "win" 'variables': { 'config': '<!(echo $CONFIG)', - # The output of "node --version" is "v[version]". We use cut to - # remove the first character. - 'target%': '<!(node --version | cut -c2-)' }, - # Empirically, Node only exports ALPN symbols if its major version is >0. - # io.js always reports versions >0 and always exports ALPN symbols. - # Therefore, Node's major version will be truthy if and only if it - # supports ALPN. The target is "[major].[minor].[patch]". We split by - # periods and take the first field to get the major version. - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)', - 'GPR_BACKWARDS_COMPATIBILITY_MODE' - ], 'include_dirs': [ - '<(node_root_dir)/deps/openssl/openssl/include', '<(node_root_dir)/deps/zlib' ], 'conditions': [ @@ -103,21 +138,42 @@ '-fprofile-arcs' ] } - ], - ["target_arch=='ia32'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] - }], - ["target_arch=='x64'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] - }], - ["target_arch=='arm'", { - "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] - }] + ] ] }] ] }, 'conditions': [ + ['OS=="win" or runtime=="electron"', { + 'targets': [ + % for module in node_modules: + % for lib in libs: + % if lib.name in module.transitive_deps and lib.name == 'boringssl': + { + 'cflags': [ + '-std=c99', + '-Wall', + '-Werror' + ], + 'target_name': '${lib.name}', + 'product_prefix': 'lib', + 'type': 'static_library', + 'dependencies': [ + % for dep in getattr(lib, 'deps', []): + '${dep}', + % endfor + ], + 'sources': [ + % for source in lib.src: + '${source}', + % endfor + ] + }, + % endif + % endfor + % endfor + ] + }], ['OS == "win"', { 'targets': [ { @@ -143,10 +199,10 @@ } ] }, - # Only want to compile BoringSSL and zlib under Windows + # Only want to compile zlib under Windows % for module in node_modules: % for lib in libs: - % if lib.name in module.transitive_deps and lib.name in ('boringssl', 'z'): + % if lib.name in module.transitive_deps and lib.name == 'z': { 'cflags': [ '-std=c99', @@ -223,6 +279,15 @@ '-g' ], "conditions": [ + ['OS=="win" or runtime=="electron"', { + 'dependencies': [ + % for dep in getattr(module, 'deps', []): + % if dep == 'boringssl': + "${dep}", + % endif + % endfor + ] + }], ['OS=="mac"', { 'xcode_settings': { 'MACOSX_DEPLOYMENT_TARGET': '10.9', @@ -235,7 +300,7 @@ ['OS=="win"', { 'dependencies': [ % for dep in getattr(module, 'deps', []): - % if dep in ('boringssl', 'z'): + % if dep == 'z': "${dep}", % endif % endfor diff --git a/templates/config.m4.template b/templates/config.m4.template index 5847d456f5..f5f1d23088 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -7,9 +7,9 @@ dnl Write more examples of tests here... dnl # --with-grpc -> add include path - PHP_ADD_INCLUDE(../../grpc/include) - PHP_ADD_INCLUDE(../../grpc/src/php/ext/grpc) - PHP_ADD_INCLUDE(../../grpc/third_party/boringssl/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) LIBS="-lpthread $LIBS" diff --git a/templates/package.json.template b/templates/package.json.template index 81f39d27f5..316c28e478 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -23,6 +23,7 @@ "scripts": { "lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore", "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint", + "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", "gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" @@ -40,6 +41,7 @@ "devDependencies": { "async": "^2.0.1", "body-parser": "^1.15.2", + "electron-mocha": "^3.1.1", "express": "^4.14.0", "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", @@ -52,7 +54,7 @@ "poisson-process": "^0.2.1" }, "engines": { - "node": ">=0.12.0" + "node": ">=1.1.0" }, "binary": { "module_name": "grpc_node", diff --git a/templates/package.xml.template b/templates/package.xml.template index 32ed3b633e..80f1a1fe97 100644 --- a/templates/package.xml.template +++ b/templates/package.xml.template @@ -12,19 +12,20 @@ <email>grpc-packages@google.com</email> <active>yes</active> </lead> - <date>2016-08-22</date> + <date>2017-01-13</date> <time>16:06:07</time> <version> <release>${settings.php_version.php()}</release> <api>${settings.php_version.php()}</api> </version> <stability> - <release>stable</release> - <api>stable</api> + <release>beta</release> + <api>beta</api> </stability> <license>BSD</license> <notes> - - Reject metadata keys which are not legal #7881 + - PHP Proto3 adoption #8179 + - Various bug fixes </notes> <contents> <dir baseinstalldir="/" name="/"> @@ -281,18 +282,49 @@ </release> <release> <version> - <release>${settings.php_version.php()}</release> - <api>${settings.php_version.php()}</api> + <release>1.0.1RC1</release> + <api>1.0.1RC1</api> + </version> + <stability> + <release>beta</release> + <api>beta</api> + </stability> + <date>2016-10-06</date> + <license>BSD</license> + <notes> + - Reject metadata keys which are not legal #7881 + </notes> + </release> + <release> + <version> + <release>1.0.1</release> + <api>1.0.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <date>2016-08-22</date> + <date>2016-10-27</date> <license>BSD</license> <notes> - Reject metadata keys which are not legal #7881 </notes> </release> + <release> + <version> + <release>1.1.0dev</release> + <api>1.1.0dev</api> + </version> + <stability> + <release>beta</release> + <api>beta</api> + </stability> + <date>2017-01-13</date> + <license>BSD</license> + <notes> + - PHP Proto3 adoption #8179 + - Various bug fixes + </notes> + </release> </changelog> </package> diff --git a/templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template b/templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template index 72b098f0c2..ceaa9aa5ab 100644 --- a/templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template @@ -28,10 +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:jessie - + <%include file="../../apt_get_basic.include"/> + + # Install Electron apt dependencies + RUN apt-get update && apt-get install -y ${'\\'} + libasound2 ${'\\'} + libgconf-2-4 ${'\\'} + libgtk2.0-0 ${'\\'} + libnss3 ${'\\'} + libxss1 ${'\\'} + libxtst6 ${'\\'} + xvfb + <%include file="../../python_deps.include"/> <%include file="../../node_deps.include"/> <%include file="../../run_tests_addons.include"/> diff --git a/templates/vsprojects/grpc.sln.template b/templates/vsprojects/grpc.sln.template index ded98383da..0b28e936be 100644 --- a/templates/vsprojects/grpc.sln.template +++ b/templates/vsprojects/grpc.sln.template @@ -2,6 +2,6 @@ --- | <%namespace file="sln_defs.include" import="gen_solution"/>\ <% - solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test', 'fuzzer'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')] + solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test', 'fuzzer'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++') and not p.name in ['z', 'boringssl', 'grpc++_reflection']] %>\ ${gen_solution(solution_projects, use_dlls='yes')} |