collect_arrow_dep.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/usr/bin/env bash
  2. # Licensed to the LF AI & Data foundation under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # assume we are in milvus directory
  18. CUSTOM_THIRDPARTY_PATH=
  19. while getopts "f:h" arg; do
  20. case $arg in
  21. f)
  22. CUSTOM_THIRDPARTY_PATH=$OPTARG
  23. ;;
  24. h) # help
  25. echo "
  26. parameter:
  27. -f: custom paths of thirdparty downloaded files(default: NULL)
  28. -h: help
  29. usage:
  30. ./collect_arrow_dep.sh -f\${CUSTOM_THIRDPARTY_PATH} [-h]
  31. "
  32. exit 0
  33. ;;
  34. ?)
  35. echo "ERROR! unknown argument"
  36. exit 1
  37. ;;
  38. esac
  39. done
  40. if [ -z "$CUSTOM_THIRDPARTY_PATH" ]
  41. then
  42. echo "
  43. parameter:
  44. -f: custom paths of thirdparty downloaded files(default: NULL)
  45. -h: help
  46. usage:
  47. ./core_build.sh -f\${CUSTOM_THIRDPARTY_PATH} [-h]
  48. "
  49. exit 0
  50. fi
  51. if [ ! -d "$CUSTOM_THIRDPARTY_PATH" ]
  52. then
  53. echo "${CUSTOM_THIRDPARTY_PATH} is not a directory"
  54. exit 0
  55. fi
  56. SOURCE="${BASH_SOURCE[0]}"
  57. while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  58. DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  59. SOURCE="$(readlink "$SOURCE")"
  60. [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  61. done
  62. SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  63. BUILD_OUTPUT_DIR="${SCRIPTS_DIR}/../cmake_build"
  64. ARROW_DIR=${BUILD_OUTPUT_DIR}/thirdparty/arrow
  65. ARROWBIN_DIR=${BUILD_OUTPUT_DIR}/thirdparty/arrow/arrow-bin
  66. echo ${ARROWBIN_DIR}
  67. pushd ${ARROWBIN_DIR}
  68. targetNames=(
  69. "jemalloc-5.2.1.tar.bz2"
  70. "thrift-0.13.0.tar.gz"
  71. "utf8proc-v2.7.0.tar.gz"
  72. "xsimd-7d1778c3b38d63db7cec7145d939f40bc5d859d1.tar.gz"
  73. "zstd-v1.5.1.tar.gz"
  74. )
  75. srcNames=(
  76. "jemalloc_ep-prefix/src/jemalloc-5.2.1.tar.bz2"
  77. "thrift_ep-prefix/src/thrift-0.13.0.tar.gz"
  78. "utf8proc_ep-prefix/src/v2.7.0.tar.gz"
  79. "src/7d1778c3b38d63db7cec7145d939f40bc5d859d1.tar.gz"
  80. "zstd_ep-prefix/src/v1.5.1.tar.gz"
  81. )
  82. for i in "${!srcNames[@]}"; do
  83. if test -f "${srcNames[i]}"; then
  84. echo "${srcNames[i]} exists. start to copy to ${CUSTOM_THIRDPARTY_PATH}/${targetNames[i]}"
  85. echo cp -f "${srcNames[i]}" "${CUSTOM_THIRDPARTY_PATH}/${targetNames[i]}"
  86. cp -f "${srcNames[i]}" "${CUSTOM_THIRDPARTY_PATH}/${targetNames[i]}"
  87. fi
  88. done
  89. popd