You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

init_image.sh 3.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash -e
  2. GET_PIP_URL='https://bootstrap.pypa.io/get-pip.py'
  3. GET_PIP_URL_36='https://bootstrap.pypa.io/pip/3.6/get-pip.py'
  4. SWIG_URL='https://codeload.github.com/swig/swig/tar.gz/refs/tags/rel-3.0.12'
  5. LLVM_URL='https://github.com/llvm-mirror/llvm/archive/release_60.tar.gz'
  6. CLANG_URL='https://github.com/llvm-mirror/clang/archive/release_60.tar.gz'
  7. NINJA_URL='https://codeload.github.com/ninja-build/ninja/tar.gz/refs/tags/v1.10.0'
  8. ARCH=$1
  9. echo "ARCH: ${ARCH}"
  10. yum install -y pcre-devel devtoolset-9-libatomic-devel.${ARCH}
  11. yum install -y devtoolset-8 devtoolset-8-libatomic-devel.${ARCH}
  12. # install a default python3 for cmake PYTHON3_EXECUTABLE_WITHOUT_VERSION
  13. yum install -y python3 python3-devel
  14. python3 -m pip install cython -i https://mirrors.aliyun.com/pypi/simple
  15. python3 -m pip install numpy -i https://mirrors.aliyun.com/pypi/simple
  16. # FIXME: failed when install pip with python3.10 because python3.10
  17. # is not installed on aarch64, so we remove 310 from ALL_PYTHON version now
  18. ALL_PYTHON="36m 37m 38 39"
  19. numpy_version="1.19.5"
  20. for ver in ${ALL_PYTHON}
  21. do
  22. python_ver=`echo $ver | tr -d m`
  23. PIP_URL=${GET_PIP_URL}
  24. if [ ${ver} = "36m" ];then
  25. PIP_URL=${GET_PIP_URL_36}
  26. fi
  27. echo "use pip url: ${PIP_URL}"
  28. curl ${PIP_URL} | /opt/python/cp${python_ver}-cp${ver}/bin/python - \
  29. --no-cache-dir --only-binary :all:
  30. /opt/python/cp${python_ver}-cp${ver}/bin/pip install \
  31. --no-cache-dir --only-binary :all: numpy==${numpy_version} setuptools==46.1.3 \
  32. -i https://mirrors.aliyun.com/pypi/simple
  33. done
  34. pushd /home >/dev/null
  35. echo "Install swig"
  36. curl -sSL ${SWIG_URL} | tar xz
  37. pushd swig-rel-3.0.12 >/dev/null
  38. ./autogen.sh
  39. mkdir build
  40. pushd build >/dev/null
  41. ../configure
  42. make -j$(nproc)
  43. make install
  44. popd >/dev/null
  45. popd >/dev/null
  46. rm -rf swig-3.0.12
  47. echo "Install llvm"
  48. curl -sSL ${LLVM_URL} | tar xz
  49. pushd llvm-release_60 >/dev/null
  50. mkdir build
  51. pushd build >/dev/null
  52. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  53. -DCMAKE_BUILD_TYPE=Release
  54. make -j$(nproc)
  55. make install
  56. popd >/dev/null
  57. popd >/dev/null
  58. rm -rf llvm-release_60
  59. echo "Install clang"
  60. curl -sSL ${CLANG_URL} | tar xz
  61. pushd clang-release_60 >/dev/null
  62. mkdir build
  63. pushd build >/dev/null
  64. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  65. -DCMAKE_BUILD_TYPE=Release
  66. make -j$(nproc)
  67. make install
  68. popd >/dev/null
  69. popd >/dev/null
  70. rm -rf clang-release_60
  71. echo "Install ninja build"
  72. curl -sSL ${NINJA_URL} | tar xz
  73. pushd ninja-1.10.0 >/dev/null
  74. mkdir build
  75. pushd build >/dev/null
  76. cmake .. -DCMAKE_BUILD_TYPE=Release
  77. make -j$(nproc)
  78. cp ninja /usr/bin/
  79. popd >/dev/null
  80. popd >/dev/null
  81. rm -rf ninja-1.10.0
  82. popd >/dev/null
  83. pushd /tmp >/dev/null
  84. curl -sSL https://github.com/NixOS/patchelf/archive/0.12.tar.gz | tar xz
  85. pushd /tmp/patchelf-0.12 >/dev/null
  86. sed -i '331s/32/256/' ./src/patchelf.cc
  87. ./bootstrap.sh && ./configure && make install-strip
  88. popd
  89. rm -rf /tmp/patchelf-0.12
  90. popd
  91. yum clean all