diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/CMakeLists.txt.template | 55 | ||||
-rw-r--r-- | templates/Makefile.template | 3 | ||||
-rw-r--r-- | templates/binding.gyp.template | 36 | ||||
-rw-r--r-- | templates/config.w32.template | 36 | ||||
-rw-r--r-- | templates/package.json.template | 2 | ||||
-rw-r--r-- | templates/src/php/ext/grpc/version.h.template | 2 | ||||
-rw-r--r-- | templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template | 78 |
7 files changed, 178 insertions, 34 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index ef0faccb2e..850404baad 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -73,6 +73,11 @@ set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") project(<%text>${PACKAGE_NAME}</%text> C CXX) + + set(gRPC_INSTALL_BINDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/bin" CACHE PATH "Installation directory for executables") + set(gRPC_INSTALL_LIBDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/lib" CACHE PATH "Installation directory for libraries") + set(gRPC_INSTALL_INCLUDEDIR "<%text>${CMAKE_INSTALL_PREFIX}</%text>/include" CACHE PATH "Installation directory for headers") + set(gRPC_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}</%text>" CACHE PATH "Installation directory for cmake config files") # Options option(gRPC_BUILD_TESTS "Build tests" OFF) @@ -97,6 +102,9 @@ set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") + set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") + set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") + set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library") set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package") @@ -143,6 +151,9 @@ endif() set(ZLIB_INCLUDE_DIR "<%text>${ZLIB_ROOT_DIR}</%text>") if(EXISTS "<%text>${ZLIB_ROOT_DIR}</%text>/CMakeLists.txt") + # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218 + include_directories(<%text>${ZLIB_INCLUDE_DIR}</%text>) + add_subdirectory(<%text>${ZLIB_ROOT_DIR}</%text> third_party/zlib) if(TARGET zlibstatic) set(_gRPC_ZLIB_LIBRARIES zlibstatic) @@ -204,6 +215,11 @@ if(NOT protobuf_BUILD_TESTS) set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests") endif() + # Disable building protobuf with zlib. Building protobuf with zlib breaks + # the build if zlib is not installed on the system. + if(NOT protobuf_WITH_ZLIB) + set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.") + endif() if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/third_party/protobuf) endif() @@ -228,21 +244,27 @@ set(gRPC_INSTALL FALSE) endif() elseif("<%text>${gRPC_PROTOBUF_PROVIDER}</%text>" STREQUAL "package") - find_package(protobuf CONFIG) - if(protobuf_FOUND) + find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE}</%text>) + if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}</%text>) set(_gRPC_PROTOBUF_LIBRARIES protobuf::<%text>${_gRPC_PROTOBUF_LIBRARY_NAME}</%text>) + else() + set(_gRPC_PROTOBUF_LIBRARIES <%text>${PROTOBUF_LIBRARIES}</%text>) endif() if(TARGET protobuf::libprotoc) set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) + else() + set(_gRPC_PROTOBUF_PROTOC_LIBRARIES <%text>${PROTOBUF_PROTOC_LIBRARIES}</%text>) endif() if(TARGET protobuf::protoc) set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) + else() + set(_gRPC_PROTOBUF_PROTOC <%text>${PROTOBUF_PROTOC_EXECUTABLE}</%text>) endif() - set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") - else() - find_package(Protobuf MODULE) - set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") + set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE}</%text>)\nendif()") + endif() + if(PROTOBUF_FOUND) + include_directories(<%text>${PROTOBUF_INCLUDE_DIRS}</%text>) endif() set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() @@ -327,11 +349,6 @@ set(_gRPC_BASELIB_LIBRARIES wsock32 ws2_32) endif() - include(GNUInstallDirs) - if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) - set(CMAKE_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_LIBDIR}</%text>/cmake/gRPC") - endif() - # Create directory for generated .proto files set(_gRPC_PROTO_GENS_DIR <%text>${CMAKE_BINARY_DIR}/gens</%text>) file(MAKE_DIRECTORY <%text>${_gRPC_PROTO_GENS_DIR}</%text>) @@ -492,7 +509,7 @@ ) if (gRPC_INSTALL) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/</%text>${lib.name}.pdb - DESTINATION <%text>${CMAKE_INSTALL_LIBDIR}</%text> OPTIONAL + DESTINATION <%text>${gRPC_INSTALL_LIBDIR}</%text> OPTIONAL ) endif() endif() @@ -506,8 +523,8 @@ % endfor target_include_directories(${lib.name} + PUBLIC <%text>$<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include></%text> PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text> - PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/include PRIVATE <%text>${BORINGSSL_ROOT_DIR}</%text>/include PRIVATE <%text>${PROTOBUF_ROOT_DIR}</%text>/src PRIVATE <%text>${ZLIB_INCLUDE_DIR}</%text> @@ -546,7 +563,7 @@ string(REPLACE "include/" "" _path <%text>${_hdr}</%text>) get_filename_component(_path <%text>${_path}</%text> PATH) install(FILES <%text>${_hdr}</%text> - DESTINATION "<%text>${CMAKE_INSTALL_INCLUDEDIR}/${_path}</%text>" + DESTINATION "<%text>${gRPC_INSTALL_INCLUDEDIR}/${_path}</%text>" ) endforeach() % endif @@ -614,16 +631,16 @@ <%def name="cc_install(tgt)"> if (gRPC_INSTALL) install(TARGETS ${tgt.name} EXPORT gRPCTargets - RUNTIME DESTINATION <%text>${CMAKE_INSTALL_BINDIR}</%text> - LIBRARY DESTINATION <%text>${CMAKE_INSTALL_LIBDIR}</%text> - ARCHIVE DESTINATION <%text>${CMAKE_INSTALL_LIBDIR}</%text> + RUNTIME DESTINATION <%text>${gRPC_INSTALL_BINDIR}</%text> + LIBRARY DESTINATION <%text>${gRPC_INSTALL_LIBDIR}</%text> + ARCHIVE DESTINATION <%text>${gRPC_INSTALL_LIBDIR}</%text> ) endif() </%def> if (gRPC_INSTALL) install(EXPORT gRPCTargets - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR}</%text> + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR}</%text> NAMESPACE gRPC:: ) endif() @@ -632,6 +649,6 @@ configure_file(tools/cmake/<%text>${_config}</%text>.cmake.in <%text>${_config}</%text>.cmake @ONLY) install(FILES <%text>${CMAKE_CURRENT_BINARY_DIR}/${_config}</%text>.cmake - DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR}</%text> + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR}</%text> ) endforeach() diff --git a/templates/Makefile.template b/templates/Makefile.template index 59a0aaa7cf..051a475d47 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -212,6 +212,9 @@ CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} CXXFLAGS += -std=c++11 + ifeq ($(SYSTEM),Darwin) + CXXFLAGS += -stdlib=libc++ + endif % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES']: % if defaults.get('global', []).get(arg, None) is not None: ${arg} += ${defaults.get('global').get(arg)} diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 935943158d..b304011fdc 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -105,6 +105,15 @@ ] }, { '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" ] + }], ['grpc_alpn=="true"', { 'defines': [ 'TSI_OPENSSL_ALPN_SUPPORT=1' @@ -117,17 +126,6 @@ ], '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"', { @@ -167,6 +165,7 @@ % if lib.name in module.transitive_deps and lib.name == 'boringssl': { 'cflags': [ + '-std=c++11', '-std=c99', '-Wall', '-Werror' @@ -183,12 +182,23 @@ % for source in lib.src: '${source}', % endfor - ] + ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CPLUSPLUSFLAGS': [ + '-stdlib=libc++', + '-std=c++11' + ], + } + }], + ], }, % endif % endfor % endfor - ] + ], }], ['OS == "win" and runtime!="electron"', { 'targets': [ diff --git a/templates/config.w32.template b/templates/config.w32.template index c822eae097..4edef963f2 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -28,4 +28,40 @@ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib"); + <% + dirs = {} + for lib in libs: + if lib.name in php_config_m4.get('deps', []) and lib.name != 'ares': + for source in lib.src: + tmp = source + prev = '' + while (True): + idx = tmp.find('/'); + if (idx == -1): + break + dirs[prev + '\\\\' + tmp[:idx]] = 1 + prev += ('\\\\' + tmp[:idx]); + tmp = tmp[idx+1:] + + dirs['\\\\src'] = 1; + dirs['\\\\src\\\\php'] = 1; + dirs['\\\\src\\\\php\\\\ext'] = 1; + dirs['\\\\src\\\\php\\\\ext\\\\grpc'] = 1; + dirs = dirs.keys() + dirs.sort() + %> + base_dir = get_define('BUILD_DIR'); + FSO.CreateFolder(base_dir+"\\ext"); + FSO.CreateFolder(base_dir+"\\ext\\grpc"); + % for dir in dirs: + FSO.CreateFolder(base_dir+"\\ext\\grpc${dir}"); + % endfor + _build_dirs = new Array(); + for (i = 0; i < build_dirs.length; i++) { + if (build_dirs[i].indexOf('grpc') == -1) { + _build_dirs[_build_dirs.length] = build_dirs[i]; + } + } + build_dirs = _build_dirs; + } diff --git a/templates/package.json.template b/templates/package.json.template index f573c43e29..92b2332760 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -35,7 +35,7 @@ "arguejs": "^0.2.3", "lodash": "^4.15.0", "nan": "^2.0.0", - "node-pre-gyp": "^0.6.0", + "node-pre-gyp": "^0.6.35", "protobufjs": "^5.0.0" }, "devDependencies": { diff --git a/templates/src/php/ext/grpc/version.h.template b/templates/src/php/ext/grpc/version.h.template index 8436e02053..0a7cfb341b 100644 --- a/templates/src/php/ext/grpc/version.h.template +++ b/templates/src/php/ext/grpc/version.h.template @@ -22,6 +22,6 @@ #ifndef VERSION_H #define VERSION_H - #define PHP_GRPC_VERSION "${settings.php_version.php_composer()}" + #define PHP_GRPC_VERSION "${settings.php_version.php()}" #endif /* VERSION_H */ diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template new file mode 100644 index 0000000000..3f5b6cf6ce --- /dev/null +++ b/templates/tools/dockerfile/interoptest/grpc_interop_android_java/Dockerfile.template @@ -0,0 +1,78 @@ +%YAML 1.2 +--- | + # Copyright 2017 gRPC authors. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + FROM debian:jessie + + # Install JDK 8 and Git + RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && ${'\\'} + echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && ${'\\'} + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 + RUN apt-get update && apt-get -y install ${'\\'} + git ${'\\'} + libapr1 ${'\\'} + oracle-java8-installer ${'\\'} + && ${'\\'} + apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ + ENV JAVA_HOME /usr/lib/jvm/java-8-oracle + ENV PATH $PATH:$JAVA_HOME/bin + + # Install protobuf + RUN apt-get update && apt-get install -y ${'\\'} + autoconf ${'\\'} + build-essential ${'\\'} + curl ${'\\'} + gcc ${'\\'} + libtool ${'\\'} + unzip ${'\\'} + && ${'\\'} + apt-get clean + WORKDIR / + RUN git clone https://github.com/google/protobuf.git + WORKDIR /protobuf + RUN git checkout v3.3.1 && ${'\\'} + ./autogen.sh && ${'\\'} + ./configure && ${'\\'} + make && ${'\\'} + make check && ${'\\'} + make install + + # Install gcloud command line tools + ENV CLOUD_SDK_REPO "cloud-sdk-jessie" + RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && ${'\\'} + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && ${'\\'} + apt-get update && apt-get install -y google-cloud-sdk && apt-get clean && ${'\\'} + gcloud config set component_manager/disable_update_check true + + # Download and install grpc-java + WORKDIR / + RUN git clone https://github.com/grpc/grpc-java.git + WORKDIR /grpc-java + RUN ./gradlew install + + # Setup the Android SDK licenses + ENV ANDROID_HOME "/grpc-java/android-interop-testing/.android" + RUN mkdir -p "<%text>${ANDROID_HOME}</%text>/licenses" + RUN echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "<%text>${ANDROID_HOME}</%text>/licenses/android-sdk-license" + RUN echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "<%text>${ANDROID_HOME}</%text>/licenses/android-sdk-preview-license" + + # Build the Android interop apks + WORKDIR /grpc-java/android-interop-testing + RUN ../gradlew assembleDebug + RUN ../gradlew assembleDebugAndroidTest + + # Define the default command. + CMD ["bash"] |