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 2.8 kB

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