vendor-boringssl.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. #
  3. # Copyright 2016, gRPC Authors All rights reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # This script creates a vendored copy of BoringSSL that is
  18. # suitable for building with the Swift Package Manager.
  19. #
  20. SRCROOT=third_party/grpc/third_party/boringssl
  21. DSTROOT=Sources/BoringSSL
  22. rm -rf $DSTROOT/crypto
  23. rm -rf $DSTROOT/include
  24. rm -rf $DSTROOT/ssl
  25. rm -rf $DSTROOT/err_data.c
  26. PATTERNS=(
  27. 'include/openssl/*.h'
  28. 'ssl/*.h'
  29. 'ssl/*.c'
  30. 'ssl/**/*.h'
  31. 'ssl/**/*.c'
  32. '*.c'
  33. 'crypto/*.h'
  34. 'crypto/*.c'
  35. 'crypto/**/*.h'
  36. 'crypto/**/*.c'
  37. '*.h'
  38. 'crypto/*.h'
  39. 'crypto/**/*.h')
  40. EXCLUDES=(
  41. '*_test.*'
  42. 'test_*.*'
  43. 'test')
  44. for pattern in "${PATTERNS[@]}"
  45. do
  46. echo "PATTERN $pattern"
  47. for i in $SRCROOT/$pattern; do
  48. path=${i#$SRCROOT}
  49. dest="$DSTROOT/$path"
  50. dest_dir=$(dirname $dest)
  51. mkdir -p $dest_dir
  52. echo $SRCROOT/$path
  53. echo $dest
  54. cp $SRCROOT/$path $dest
  55. done
  56. done
  57. cp ./third_party/grpc/src/boringssl/err_data.c $DSTROOT
  58. for exclude in "${EXCLUDES[@]}"
  59. do
  60. echo "EXCLUDE $exclude"
  61. find $DSTROOT -name "$exclude" -exec rm -rf {} \;
  62. done