1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
agilob 2015-05-16 17:36:56 +01:00
parent 7d93379834
commit feb7f60806

View File

@ -17,11 +17,7 @@ INSTALL_DIR=libs
# just for convenience # just for convenience
BASE_DIR=${SCRIPT_DIR}/${INSTALL_DIR} BASE_DIR=${SCRIPT_DIR}/${INSTALL_DIR}
# the sodium version to use
SODIUM_VER=1.0.3
# directory names of cloned repositories # directory names of cloned repositories
SODIUM_DIR=libsodium-$SODIUM_VER
TOX_CORE_DIR=libtoxcore-latest TOX_CORE_DIR=libtoxcore-latest
FILTER_AUDIO_DIR=libfilteraudio-latest FILTER_AUDIO_DIR=libfilteraudio-latest
@ -31,12 +27,6 @@ if [ -z "$BASE_DIR" ]; then
exit 1 exit 1
fi fi
if [ -z "$SODIUM_DIR" ]; then
echo "internal error detected!"
echo "SODIUM_DIR should not be empty... aborting"
exit 1
fi
if [ -z "$TOX_CORE_DIR" ]; then if [ -z "$TOX_CORE_DIR" ]; then
echo "internal error detected!" echo "internal error detected!"
echo "TOX_CORE_DIR should not be empty... aborting" echo "TOX_CORE_DIR should not be empty... aborting"
@ -50,22 +40,14 @@ if [ -z "$FILTER_AUDIO_DIR" ]; then
fi fi
# default values for user given parameters # default values for user given parameters
INSTALL_SODIUM=true
INSTALL_TOX=true INSTALL_TOX=true
INSTALL_FILTER_AUDIO=true INSTALL_FILTER_AUDIO=true
SYSTEM_WIDE=true SYSTEM_WIDE=true
KEEP_BUILD_FILES=false KEEP_BUILD_FILES=false
########## parse input parameters ########## ########## parse input parameters ##########
while [ $# -ge 1 ] ; do while [ $# -ge 1 ] ; do
if [ ${1} = "--with-sodium" ] ; then if [ ${1} = "--with-tox" ] ; then
INSTALL_SODIUM=true
shift
elif [ ${1} = "--without-sodium" ] ; then
INSTALL_SODIUM=false
shift
elif [ ${1} = "--with-tox" ] ; then
INSTALL_TOX=true INSTALL_TOX=true
shift shift
elif [ ${1} = "--without-tox" ] ; then elif [ ${1} = "--without-tox" ] ; then
@ -90,14 +72,12 @@ while [ $# -ge 1 ] ; do
fi fi
# print help # print help
echo "Use this script to install/update libsodium, libtoxcore and libfilteraudio" echo "Use this script to install/update libtoxcore and libfilteraudio"
echo "" echo ""
echo "usage:" echo "usage:"
echo " ${0} PARAMETERS" echo " ${0} PARAMETERS"
echo "" echo ""
echo "parameters:" echo "parameters:"
echo " --with-sodium : install/update libsodium"
echo " --without-sodium : do not install/update libsodium"
echo " --with-tox : install/update libtoxcore" echo " --with-tox : install/update libtoxcore"
echo " --without-tox : do not install/update libtoxcore" echo " --without-tox : do not install/update libtoxcore"
echo " --with-filter-audio : install/update libfilteraudio" echo " --with-filter-audio : install/update libfilteraudio"
@ -107,14 +87,13 @@ while [ $# -ge 1 ] ; do
echo " -k|--keep : keep build files after installation/update" echo " -k|--keep : keep build files after installation/update"
echo "" echo ""
echo "example usages:" echo "example usages:"
echo " ${0} -- install libsodium, libtoxcore and libfilteraudio" echo " ${0} -- install libtoxcore and libfilteraudio"
exit 1 exit 1
fi fi
done done
########## print debug output ########## ########## print debug output ##########
echo "with sodium : ${INSTALL_SODIUM}"
echo "with tox : ${INSTALL_TOX}" echo "with tox : ${INSTALL_TOX}"
echo "with filter-audio : ${INSTALL_FILTER_AUDIO}" echo "with filter-audio : ${INSTALL_FILTER_AUDIO}"
echo "install into ${INSTALL_DIR} : ${SYSTEM_WIDE}" echo "install into ${INSTALL_DIR} : ${SYSTEM_WIDE}"
@ -128,32 +107,9 @@ mkdir -p ${BASE_DIR}
# maybe an earlier run of this script failed # maybe an earlier run of this script failed
# thus we should remove the cloned repositories # thus we should remove the cloned repositories
# if exists, otherwise cloning them may fail # if exists, otherwise cloning them may fail
rm -rf ${BASE_DIR}/${SODIUM_DIR}
rm -rf ${BASE_DIR}/${TOX_CORE_DIR} rm -rf ${BASE_DIR}/${TOX_CORE_DIR}
rm -rf ${BASE_DIR}/${FILTER_AUDIO_DIR} rm -rf ${BASE_DIR}/${FILTER_AUDIO_DIR}
############### install step ###############
# install libsodium
if [[ $INSTALL_SODIUM = "true" ]]; then
git clone --branch $SODIUM_VER git://github.com/jedisct1/libsodium.git ${BASE_DIR}/${SODIUM_DIR} --depth 1
pushd ${BASE_DIR}/${SODIUM_DIR}
./autogen.sh
if [[ $SYSTEM_WIDE = "false" ]]; then
./configure --prefix=${BASE_DIR}
make -j2 check
make install
else
./configure
make -j2 check
sudo make install
sudo ldconfig
fi
popd
fi
#install libtoxcore #install libtoxcore
if [[ $INSTALL_TOX = "true" ]]; then if [[ $INSTALL_TOX = "true" ]]; then
git clone https://github.com/irungentoo/toxcore.git ${BASE_DIR}/${TOX_CORE_DIR} --depth 1 git clone https://github.com/irungentoo/toxcore.git ${BASE_DIR}/${TOX_CORE_DIR} --depth 1
@ -161,7 +117,7 @@ if [[ $INSTALL_TOX = "true" ]]; then
./autogen.sh ./autogen.sh
if [[ $SYSTEM_WIDE = "false" ]]; then if [[ $SYSTEM_WIDE = "false" ]]; then
./configure --prefix=${BASE_DIR} --with-libsodium-headers=${BASE_DIR}/include --with-libsodium-libs=${BASE_DIR}/lib ./configure --prefix=${BASE_DIR}
make -j2 make -j2
make install make install
else else
@ -195,7 +151,6 @@ fi
############### cleanup step ############### ############### cleanup step ###############
# remove cloned repositories # remove cloned repositories
if [[ $KEEP_BUILD_FILES = "false" ]]; then if [[ $KEEP_BUILD_FILES = "false" ]]; then
rm -rf ${BASE_DIR}/${SODIUM_DIR}
rm -rf ${BASE_DIR}/${TOX_CORE_DIR} rm -rf ${BASE_DIR}/${TOX_CORE_DIR}
rm -rf ${BASE_DIR}/${FILTER_AUDIO_DIR} rm -rf ${BASE_DIR}/${FILTER_AUDIO_DIR}
fi fi