freedombone/src/freedombone-utils-guile

96 lines
3.3 KiB
Plaintext
Raw Normal View History

2017-08-23 18:30:13 +02:00
#!/bin/bash
2018-04-08 14:30:21 +02:00
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
2017-08-23 18:30:13 +02:00
#
2018-04-08 14:30:21 +02:00
# Freedom in the Cloud
2017-08-23 18:30:13 +02:00
#
# Recent version of guile
#
# License
# =======
#
2018-01-25 19:35:39 +01:00
# Copyright (C) 2017-2018 Bob Mottram <bob@freedombone.net>
2017-08-23 18:30:13 +02:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
GUILE_VERSION='2.2.0'
GUILE_HASH='c707b9cf6f97ecca3a4e3e704e62b83f95f1aec28ed1535f5d0a1d36af07a015'
EIGHTSYNC_REPO="git://git.savannah.gnu.org/8sync.git"
2017-08-23 23:00:58 +02:00
EIGHTSYNC_COMMIT='8cbb7f22227c0afdd3b0bd758ebec0efba2fa1e1'
2017-08-23 18:30:13 +02:00
function install_8sync {
apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo
2018-02-26 14:50:40 +01:00
if [ ! -d "$INSTALL_DIR" ]; then
mkdir "$INSTALL_DIR"
2017-08-23 18:30:13 +02:00
fi
2018-02-26 14:50:40 +01:00
cd "$INSTALL_DIR" || exit 67832456
2017-08-23 18:30:13 +02:00
2018-02-26 14:50:40 +01:00
git_clone "$EIGHTSYNC_REPO" "$INSTALL_DIR/eightsync"
cd "$INSTALL_DIR/eightsync" || exit 23468346
git checkout "${EIGHTSYNC_COMMIT}" -b "${EIGHTSYNC_COMMIT}"
2017-08-24 14:56:00 +02:00
2017-08-23 23:00:58 +02:00
export GUILE_BASE_PATH=/opt/guile-${GUILE_VERSION}
export GUILE_CFLAGS="-I${GUILE_BASE_PATH}/include"
export GUILE_LIBS="-L${GUILE_BASE_PATH}/lib -lguile -lqthreads -ldl -ltermcap -lsocket -lnsl -lm"
2017-08-23 18:30:13 +02:00
./bootstrap.sh
2017-10-16 00:48:01 +02:00
sed -i 's|PKG_CHECK_MODULES|##PKG_CHECK_MODULES|g' configure
2017-08-23 18:30:13 +02:00
configure
make
make install
2017-10-23 19:39:29 +02:00
export GUILE_LOAD_COMPILED_PATH="$INSTALL_DIR/8sync"
2017-08-23 18:30:13 +02:00
}
function install_guile {
# Currently this only works for x86_64
read_config_param ARCHITECTURE
if [[ ${ARCHITECTURE} != "x86_64" ]]; then
return
fi
GUILE_ARCH='x86_64'
apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo lzip wget
2018-02-26 14:50:40 +01:00
if [ ! -d "$INSTALL_DIR" ]; then
mkdir "$INSTALL_DIR"
2017-08-23 18:30:13 +02:00
fi
2018-02-26 14:50:40 +01:00
cd "$INSTALL_DIR" || exit 4298497
2017-08-23 18:30:13 +02:00
2018-02-26 14:50:40 +01:00
if [ ! -f "guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz" ]; then
wget "https://ftp.gnu.org/gnu/guile/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz"
2017-08-23 18:30:13 +02:00
fi
2018-02-26 14:50:40 +01:00
if [ ! -f "guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz" ]; then
2017-08-23 18:30:13 +02:00
echo 'Unable to download guile pack'
exit 6735238
fi
2018-02-26 14:50:40 +01:00
CURR_GUILE_HASH=$(sha256sum "guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz" | awk -F ' ' '{print $1}')
2017-08-23 18:30:13 +02:00
if [[ "$CURR_GUILE_HASH" != "$GUILE_HASH" ]]; then
echo 'Guile hash does not match'
exit 7237625
fi
2018-02-26 14:50:40 +01:00
cd / || exit 73563635
tar xvf "$INSTALL_DIR/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz"
if [ ! -d "/opt/guile-${GUILE_VERSION}/bin" ]; then
2017-08-23 23:00:58 +02:00
echo 'Guile was not installed'
exit 825269
fi
echo "export GUILE_PATH=/opt/guile-${GUILE_VERSION}/bin" >> ~/.bashrc
2018-02-26 14:50:40 +01:00
echo "export PATH=\$PATH:\$GUILE_PATH" >> ~/.bashrc
2017-08-23 18:30:13 +02:00
}
# NOTE: deliberately no exit 0