freedombone-utils-guile 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. # _____ _ _
  3. # | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
  4. # | __| _| -_| -_| . | . | | . | . | | -_|
  5. # |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
  6. #
  7. # Freedom in the Cloud
  8. #
  9. # Recent version of guile
  10. #
  11. # License
  12. # =======
  13. #
  14. # Copyright (C) 2017-2018 Bob Mottram <bob@freedombone.net>
  15. #
  16. # This program is free software: you can redistribute it and/or modify
  17. # it under the terms of the GNU Affero General Public License as published by
  18. # the Free Software Foundation, either version 3 of the License, or
  19. # (at your option) any later version.
  20. #
  21. # This program is distributed in the hope that it will be useful,
  22. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. # GNU Affero General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU Affero General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. GUILE_VERSION='2.2.0'
  29. GUILE_HASH='c707b9cf6f97ecca3a4e3e704e62b83f95f1aec28ed1535f5d0a1d36af07a015'
  30. EIGHTSYNC_REPO="git://git.savannah.gnu.org/8sync.git"
  31. EIGHTSYNC_COMMIT='8cbb7f22227c0afdd3b0bd758ebec0efba2fa1e1'
  32. function install_8sync {
  33. apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo
  34. if [ ! -d "$INSTALL_DIR" ]; then
  35. mkdir "$INSTALL_DIR"
  36. fi
  37. cd "$INSTALL_DIR" || exit 67832456
  38. git_clone "$EIGHTSYNC_REPO" "$INSTALL_DIR/eightsync"
  39. cd "$INSTALL_DIR/eightsync" || exit 23468346
  40. git checkout "${EIGHTSYNC_COMMIT}" -b "${EIGHTSYNC_COMMIT}"
  41. export GUILE_BASE_PATH=/opt/guile-${GUILE_VERSION}
  42. export GUILE_CFLAGS="-I${GUILE_BASE_PATH}/include"
  43. export GUILE_LIBS="-L${GUILE_BASE_PATH}/lib -lguile -lqthreads -ldl -ltermcap -lsocket -lnsl -lm"
  44. ./bootstrap.sh
  45. sed -i 's|PKG_CHECK_MODULES|##PKG_CHECK_MODULES|g' configure
  46. configure
  47. make
  48. make install
  49. export GUILE_LOAD_COMPILED_PATH="$INSTALL_DIR/8sync"
  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" || exit 4298497
  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 / || exit 73563635
  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