build_artifact_csharp.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # Copyright 2016 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. cd "$(dirname "$0")/../../.."
  17. mkdir -p cmake/build
  18. cd cmake/build
  19. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  20. -DgRPC_BACKWARDS_COMPATIBILITY_MODE=ON \
  21. -DgRPC_BUILD_TESTS=OFF \
  22. -DgRPC_XDS_USER_AGENT_IS_CSHARP=ON \
  23. ../..
  24. # Use externally provided env to determine build parallelism, otherwise use default.
  25. GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS=${GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS:-2}
  26. make grpc_csharp_ext "-j${GRPC_CSHARP_BUILD_EXT_COMPILER_JOBS}"
  27. if [ -f "libgrpc_csharp_ext.so" ]
  28. then
  29. # in case we are in a crosscompilation environment
  30. STRIP=${STRIP:-strip}
  31. OBJCOPY=${OBJCOPY:-objcopy}
  32. # The .so file with all debug symbols is too large to
  33. # package in the default nuget package.
  34. # But we still want to keep the version with symbols
  35. # to include it in a special "debug" package.
  36. cp libgrpc_csharp_ext.so libgrpc_csharp_ext.dbginfo.so
  37. ${STRIP} --strip-unneeded libgrpc_csharp_ext.so
  38. ${OBJCOPY} --add-gnu-debuglink=libgrpc_csharp_ext.dbginfo.so libgrpc_csharp_ext.so
  39. fi
  40. cd ../..
  41. mkdir -p "${ARTIFACTS_OUT}"
  42. cp cmake/build/libgrpc_csharp_ext.so cmake/build/libgrpc_csharp_ext.dbginfo.so "${ARTIFACTS_OUT}" || cp cmake/build/libgrpc_csharp_ext.dylib "${ARTIFACTS_OUT}"