freedombone-utils-cmake 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Some things need a recent build of CMake to compile
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. CMAKE_REPO="https://github.com/Kitware/CMake"
  31. CMAKE_COMMIT='d6734eeb875ceca5d810e829ca90541918dca2b4'
  32. function mesh_install_cmake {
  33. if [ ! -d $rootdir$INSTALL_DIR ]; then
  34. chroot "$rootdir" mkdir -p $INSTALL_DIR
  35. fi
  36. chroot "$rootdir" apt-get -yq install build-essential
  37. git clone $CMAKE_REPO $rootdir$INSTALL_DIR/cmake
  38. cd $rootdir$INSTALL_DIR/cmake
  39. git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT
  40. cat <<EOF > $rootdir/root/install_cmake
  41. cd $INSTALL_DIR/cmake
  42. ./bootstrap
  43. make
  44. if [ ! "$?" = "0" ]; then
  45. exit 72581
  46. fi
  47. make install
  48. EOF
  49. chroot "$rootdir" chmod +x /root/install_cmake
  50. chroot "$rootdir" /root/install_cmake
  51. chroot "$rootdir" rm /root/install_cmake
  52. }
  53. function install_cmake {
  54. if [ $INSTALLING_MESH ]; then
  55. mesh_install_cmake
  56. return
  57. fi
  58. if [ -d $INSTALL_DIR/cmake ]; then
  59. if ! grep -q "CMake commit:$CMAKE_COMMIT" $COMPLETION_FILE; then
  60. set_repo_commit $INSTALL_DIR/cmake "CMake commit" "$CMAKE_COMMIT" $CMAKE_REPO
  61. cd $INSTALL_DIR/cmake
  62. ./bootstrap
  63. make
  64. if [ ! "$?" = "0" ]; then
  65. exit 72581
  66. fi
  67. make install
  68. fi
  69. fi
  70. if [[ $(is_completed $FUNCNAME) == "1" ]]; then
  71. return
  72. fi
  73. if [ ! -d $INSTALL_DIR ]; then
  74. mkdir -p $INSTALL_DIR
  75. fi
  76. apt-get -yq install build-essential
  77. git_clone $CMAKE_REPO $INSTALL_DIR/cmake
  78. cd $INSTALL_DIR/cmake
  79. git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT
  80. ./bootstrap
  81. make
  82. if [ ! "$?" = "0" ]; then
  83. exit 72581
  84. fi
  85. make install
  86. mark_completed $FUNCNAME
  87. }
  88. # NOTE: deliberately there is no "exit 0"