freedombone-utils-guile 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Recent version of guile
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2017 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. GUILE_VERSION='2.2.0'
  31. GUILE_HASH='c707b9cf6f97ecca3a4e3e704e62b83f95f1aec28ed1535f5d0a1d36af07a015'
  32. EIGHTSYNC_REPO="git://git.savannah.gnu.org/8sync.git"
  33. EIGHTSYNC_COMMIT='8cbb7f22227c0afdd3b0bd758ebec0efba2fa1e1'
  34. function install_8sync {
  35. apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo
  36. if [ ! -d $INSTALL_DIR ]; then
  37. mkdir $INSTALL_DIR
  38. fi
  39. cd $INSTALL_DIR
  40. git_clone $EIGHTSYNC_REPO $INSTALL_DIR/eightsync
  41. cd $INSTALL_DIR/eightsync
  42. git checkout ${EIGHTSYNC_COMMIT} -b ${EIGHTSYNC_COMMIT}
  43. export GUILE_BASE_PATH=/opt/guile-${GUILE_VERSION}
  44. export GUILE_CFLAGS="-I${GUILE_BASE_PATH}/include"
  45. export GUILE_LIBS="-L${GUILE_BASE_PATH}/lib -lguile -lqthreads -ldl -ltermcap -lsocket -lnsl -lm"
  46. ./bootstrap.sh
  47. configure
  48. make
  49. make install
  50. }
  51. function install_guile {
  52. # Currently this only works for x86_64
  53. read_config_param ARCHITECTURE
  54. if [[ ${ARCHITECTURE} != "x86_64" ]]; then
  55. return
  56. fi
  57. GUILE_ARCH='x86_64'
  58. apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo lzip wget
  59. if [ ! -d $INSTALL_DIR ]; then
  60. mkdir $INSTALL_DIR
  61. fi
  62. cd $INSTALL_DIR
  63. if [ ! -f guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz ]; then
  64. wget https://ftp.gnu.org/gnu/guile/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz
  65. fi
  66. if [ ! -f guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz ]; then
  67. echo 'Unable to download guile pack'
  68. exit 6735238
  69. fi
  70. CURR_GUILE_HASH=$(sha256sum guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz | awk -F ' ' '{print $1}')
  71. if [[ "$CURR_GUILE_HASH" != "$GUILE_HASH" ]]; then
  72. echo 'Guile hash does not match'
  73. exit 7237625
  74. fi
  75. cd /
  76. tar xvf $INSTALL_DIR/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz
  77. if [ ! -d /opt/guile-${GUILE_VERSION}/bin ]; then
  78. echo 'Guile was not installed'
  79. exit 825269
  80. fi
  81. echo "export GUILE_PATH=/opt/guile-${GUILE_VERSION}/bin" >> ~/.bashrc
  82. echo 'export PATH=$PATH:$GUILE_PATH' >> ~/.bashrc
  83. }
  84. # NOTE: deliberately no exit 0