install-boost.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) 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. if [ $# -lt 1 ]; then
  18. echo "ERROR: Need at least 1 argument, $# were provided"
  19. exit 1
  20. fi
  21. pkg-resolver/check_platform.py "$1"
  22. if [ $? -eq 1 ]; then
  23. echo "ERROR: Unsupported platform $1"
  24. exit 1
  25. fi
  26. default_version="1.72.0"
  27. version_to_install=$default_version
  28. if [ -n "$2" ]; then
  29. version_to_install="$2"
  30. fi
  31. if [ "$version_to_install" != "1.72.0" ]; then
  32. echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
  33. version_to_install=$default_version
  34. fi
  35. if [ "$version_to_install" == "1.72.0" ]; then
  36. # hadolint ignore=DL3003
  37. mkdir -p /opt/boost-library &&
  38. curl -L https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download >boost_1_72_0.tar.bz2 &&
  39. mv boost_1_72_0.tar.bz2 /opt/boost-library &&
  40. cd /opt/boost-library &&
  41. tar --bzip2 -xf boost_1_72_0.tar.bz2 &&
  42. cd /opt/boost-library/boost_1_72_0 &&
  43. ./bootstrap.sh --prefix=/usr/ &&
  44. ./b2 --without-python install &&
  45. cd /root &&
  46. rm -rf /opt/boost-library
  47. else
  48. echo "ERROR: Don't know how to install version $version_to_install"
  49. exit 1
  50. fi