build_ruby.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. # Copyright 2015 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -ex
  16. export GRPC_CONFIG=${CONFIG:-opt}
  17. if [ "${GRPC_CONFIG}" == "dbg" ]
  18. then
  19. CMAKE_CONFIG=Debug
  20. else
  21. CMAKE_CONFIG=Release
  22. fi
  23. # change to grpc's ruby directory
  24. cd "$(dirname "$0")/../../.."
  25. rm -rf ./tmp
  26. bundle exec rake compile
  27. # build grpc_ruby_plugin
  28. mkdir -p cmake/build
  29. pushd cmake/build
  30. cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_CONFIG} ../..
  31. make protoc grpc_ruby_plugin -j2
  32. popd
  33. # unbreak subsequent make builds by restoring zconf.h (previously renamed by cmake build)
  34. # see https://github.com/madler/zlib/issues/133
  35. (cd third_party/zlib; git checkout zconf.h)