Browse Source

build protoc artifacts with cmake

Jan Tattermusch 4 years ago
parent
commit
a35cd4f89d

+ 2 - 5
src/ruby/end2end/package_with_underscore_test.rb

@@ -19,12 +19,9 @@ def main
   root_dir = File.join(File.dirname(__FILE__), '..', '..', '..')
   root_dir = File.join(File.dirname(__FILE__), '..', '..', '..')
   pb_dir = File.join(root_dir, 'src', 'ruby', 'end2end', 'protos')
   pb_dir = File.join(root_dir, 'src', 'ruby', 'end2end', 'protos')
 
 
-  fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
-  bins_sub_dir = ENV['CONFIG']
-  bins_dir = File.join(root_dir, 'bins', bins_sub_dir)
-
+  bins_dir = File.join(root_dir, 'cmake', 'build')
   plugin = File.join(bins_dir, 'grpc_ruby_plugin')
   plugin = File.join(bins_dir, 'grpc_ruby_plugin')
-  protoc = File.join(bins_dir, 'protobuf', 'protoc')
+  protoc = File.join(bins_dir, 'third_party', 'protobuf', 'protoc')
 
 
   got = nil
   got = nil
 
 

+ 2 - 6
src/ruby/spec/pb/codegen/package_option_spec.rb

@@ -71,14 +71,10 @@ describe 'Code Generation Options' do
 end
 end
 
 
 def with_protos(file_paths)
 def with_protos(file_paths)
-  fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
-  bins_sub_dir = ENV['CONFIG']
-
   pb_dir = File.dirname(__FILE__)
   pb_dir = File.dirname(__FILE__)
-  bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir)
-
+  bins_dir = File.join('..', '..', '..', '..', '..', 'cmake', 'build')
   plugin = File.join(bins_dir, 'grpc_ruby_plugin')
   plugin = File.join(bins_dir, 'grpc_ruby_plugin')
-  protoc = File.join(bins_dir, 'protobuf', 'protoc')
+  protoc = File.join(bins_dir, 'third_party', 'protobuf', 'protoc')
 
 
   # Generate the service from the proto
   # Generate the service from the proto
   Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir|
   Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir|

+ 2 - 10
tools/run_tests/artifacts/artifact_targets.py

@@ -304,17 +304,9 @@ class ProtocArtifact:
 
 
     def build_jobspec(self):
     def build_jobspec(self):
         if self.platform != 'windows':
         if self.platform != 'windows':
-            cxxflags = '-DNDEBUG %s' % _ARCH_FLAG_MAP[self.arch]
-            ldflags = '%s' % _ARCH_FLAG_MAP[self.arch]
-            if self.platform != 'macos':
-                ldflags += '  -static-libgcc -static-libstdc++ -s'
-            environ = {
-                'CONFIG': 'opt',
-                'CXXFLAGS': cxxflags,
-                'LDFLAGS': ldflags,
-                'PROTOBUF_LDFLAGS_EXTRA': ldflags
-            }
+            environ = {'CXXFLAGS': '', 'LDFLAGS': ''}
             if self.platform == 'linux':
             if self.platform == 'linux':
+                environ['LDFLAGS'] += ' -static-libgcc -static-libstdc++ -s'
                 return create_docker_jobspec(
                 return create_docker_jobspec(
                     self.name,
                     self.name,
                     'tools/dockerfile/grpc_artifact_centos6_{}'.format(
                     'tools/dockerfile/grpc_artifact_centos6_{}'.format(

+ 8 - 2
tools/run_tests/artifacts/build_artifact_protoc.sh

@@ -17,7 +17,13 @@ set -ex
 
 
 cd "$(dirname "$0")/../../.."
 cd "$(dirname "$0")/../../.."
 
 
-EMBED_ZLIB=true PROTOBUF_CONFIG_OPTS=--with-zlib=no make plugins
+mkdir -p cmake/build
+pushd cmake/build
+
+cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../..
+make protoc plugins -j2
+
+popd
 
 
 mkdir -p "${ARTIFACTS_OUT}"
 mkdir -p "${ARTIFACTS_OUT}"
-cp bins/opt/protobuf/protoc bins/opt/*_plugin "${ARTIFACTS_OUT}"/
+cp cmake/build/third_party/protobuf/protoc cmake/build/*_plugin "${ARTIFACTS_OUT}"/

+ 10 - 1
tools/run_tests/helper_scripts/build_ruby.sh

@@ -25,4 +25,13 @@ rm -rf ./tmp
 rake compile
 rake compile
 
 
 # build grpc_ruby_plugin
 # build grpc_ruby_plugin
-make grpc_ruby_plugin -j8
+# TODO: fix this
+#make grpc_ruby_plugin -j8
+mkdir -p cmake/build
+pushd cmake/build
+cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../..
+make protoc grpc_ruby_plugin -j2
+popd
+
+# unbreak subsequent make builds by restoring zconf.h (previously renamed by cmake build)
+(cd third_party/zlib; git checkout zconf.h)