|
|
|
@ -20,7 +20,8 @@
@@ -20,7 +20,8 @@
|
|
|
|
|
set -eu -o pipefail |
|
|
|
|
|
|
|
|
|
# windows check |
|
|
|
|
if cmd.exe /c ver 2>/dev/null ; then |
|
|
|
|
if cmd.exe /c ver 2>/dev/null |
|
|
|
|
then |
|
|
|
|
cd windows |
|
|
|
|
./bootstrap.sh |
|
|
|
|
exit $? |
|
|
|
@ -37,12 +38,13 @@ readonly INSTALL_DIR=libs
@@ -37,12 +38,13 @@ readonly INSTALL_DIR=libs
|
|
|
|
|
# just for convenience |
|
|
|
|
readonly BASE_DIR="${SCRIPT_DIR}/${INSTALL_DIR}" |
|
|
|
|
|
|
|
|
|
# toxcore version to checkout |
|
|
|
|
# versions of libs to checkout |
|
|
|
|
readonly TOXCORE_VERSION="v0.1.2" |
|
|
|
|
readonly SQLCIPHER_VERSION="v3.4.0" |
|
|
|
|
|
|
|
|
|
# directory names of cloned repositories |
|
|
|
|
readonly TOXCORE_DIR="libtoxcore-$TOXCORE_VERSION" |
|
|
|
|
readonly SQLCIPHER_DIR="sqlcipher-stable" |
|
|
|
|
readonly SQLCIPHER_DIR="sqlcipher-$SQLCIPHER_VERSION" |
|
|
|
|
|
|
|
|
|
# default values for user given parameters |
|
|
|
|
INSTALL_TOX=true |
|
|
|
@ -51,38 +53,13 @@ SYSTEM_WIDE=true
@@ -51,38 +53,13 @@ SYSTEM_WIDE=true
|
|
|
|
|
KEEP_BUILD_FILES=false |
|
|
|
|
|
|
|
|
|
# if Fedora, by default install sqlcipher |
|
|
|
|
if which dnf &> /dev/null ; then |
|
|
|
|
if which dnf &> /dev/null |
|
|
|
|
then |
|
|
|
|
INSTALL_SQLCIPHER=true |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########## parse input parameters ########## |
|
|
|
|
while [ $# -ge 1 ] ; do |
|
|
|
|
if [ ${1} = "--with-tox" ] ; then |
|
|
|
|
INSTALL_TOX=true |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--without-tox" ] ; then |
|
|
|
|
INSTALL_TOX=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--with-sqlcipher" ] ; then |
|
|
|
|
INSTALL_SQLCIPHER=true |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--without-sqlcipher" ] ; then |
|
|
|
|
INSTALL_SQLCIPHER=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "-l" -o ${1} = "--local" ] ; then |
|
|
|
|
SYSTEM_WIDE=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "-k" -o ${1} = "--keep" ]; then |
|
|
|
|
KEEP_BUILD_FILES=true |
|
|
|
|
shift |
|
|
|
|
else |
|
|
|
|
if [ ${1} != "-h" -a ${1} != "--help" ] ; then |
|
|
|
|
echo "[ERROR] Unknown parameter \"${1}\"" |
|
|
|
|
echo "" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# print help |
|
|
|
|
print_help() { |
|
|
|
|
echo "Use this script to install/update libtoxcore" |
|
|
|
|
echo "" |
|
|
|
|
echo "usage:" |
|
|
|
@ -99,22 +76,15 @@ while [ $# -ge 1 ] ; do
@@ -99,22 +76,15 @@ while [ $# -ge 1 ] ; do
|
|
|
|
|
echo "" |
|
|
|
|
echo "example usages:" |
|
|
|
|
echo " ${0} -- install libtoxcore" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
############ print debug output ############ |
|
|
|
|
print_debug_output() { |
|
|
|
|
echo "with tox : ${INSTALL_TOX}" |
|
|
|
|
echo "with sqlcipher : ${INSTALL_SQLCIPHER}" |
|
|
|
|
echo "install system-wide : ${SYSTEM_WIDE}" |
|
|
|
|
echo "keep build files : ${KEEP_BUILD_FILES}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
############### prepare step ############### |
|
|
|
|
# create BASE_DIR directory if necessary |
|
|
|
|
mkdir -p "${BASE_DIR}" |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# remove not needed dirs |
|
|
|
|
remove_build_dirs() { |
|
|
|
@ -122,16 +92,9 @@ remove_build_dirs() {
@@ -122,16 +92,9 @@ remove_build_dirs() {
|
|
|
|
|
rm -rf "${BASE_DIR}/${SQLCIPHER_DIR}" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# maybe an earlier run of this script failed |
|
|
|
|
# thus we should remove the cloned repositories |
|
|
|
|
# if exists, otherwise cloning them may fail |
|
|
|
|
remove_build_dirs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
############### install step ############### |
|
|
|
|
#install libtoxcore |
|
|
|
|
if [[ $INSTALL_TOX = "true" ]]; then |
|
|
|
|
install_toxcore() { |
|
|
|
|
if [[ $INSTALL_TOX = "true" ]] |
|
|
|
|
then |
|
|
|
|
git clone https://github.com/toktok/c-toxcore.git \ |
|
|
|
|
--branch $TOXCORE_VERSION \ |
|
|
|
|
--depth 1 \ |
|
|
|
@ -141,7 +104,8 @@ if [[ $INSTALL_TOX = "true" ]]; then
@@ -141,7 +104,8 @@ if [[ $INSTALL_TOX = "true" ]]; then
|
|
|
|
|
./autogen.sh |
|
|
|
|
|
|
|
|
|
# configure |
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]]; then |
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]] |
|
|
|
|
then |
|
|
|
|
./configure --prefix=${BASE_DIR} |
|
|
|
|
else |
|
|
|
|
./configure |
|
|
|
@ -159,7 +123,8 @@ if [[ $INSTALL_TOX = "true" ]]; then
@@ -159,7 +123,8 @@ if [[ $INSTALL_TOX = "true" ]]; then
|
|
|
|
|
make -j $(nproc) |
|
|
|
|
|
|
|
|
|
# install |
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]]; then |
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]] |
|
|
|
|
then |
|
|
|
|
make install |
|
|
|
|
else |
|
|
|
|
sudo make install |
|
|
|
@ -168,19 +133,22 @@ if [[ $INSTALL_TOX = "true" ]]; then
@@ -168,19 +133,22 @@ if [[ $INSTALL_TOX = "true" ]]; then
|
|
|
|
|
|
|
|
|
|
popd |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#install sqlcipher |
|
|
|
|
if [[ $INSTALL_SQLCIPHER = "true" ]]; then |
|
|
|
|
install_sqlcipher() { |
|
|
|
|
if [[ $INSTALL_SQLCIPHER = "true" ]] |
|
|
|
|
then |
|
|
|
|
git clone https://github.com/sqlcipher/sqlcipher.git \ |
|
|
|
|
"${BASE_DIR}/${SQLCIPHER_DIR}" \ |
|
|
|
|
--depth 1 \ |
|
|
|
|
--branch v3.4.0 |
|
|
|
|
--branch $SQLCIPHER_VERSION \ |
|
|
|
|
--depth 1 |
|
|
|
|
|
|
|
|
|
pushd "${BASE_DIR}/${SQLCIPHER_DIR}" |
|
|
|
|
autoreconf -if |
|
|
|
|
|
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]]; then |
|
|
|
|
if [[ $SYSTEM_WIDE = "false" ]] |
|
|
|
|
then |
|
|
|
|
./configure --prefix="${BASE_DIR}" \ |
|
|
|
|
--enable-tempstore=yes \ |
|
|
|
|
CFLAGS="-DSQLITE_HAS_CODEC" |
|
|
|
@ -202,10 +170,71 @@ if [[ $INSTALL_SQLCIPHER = "true" ]]; then
@@ -202,10 +170,71 @@ if [[ $INSTALL_SQLCIPHER = "true" ]]; then
|
|
|
|
|
|
|
|
|
|
popd |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main() { |
|
|
|
|
########## parse input parameters ########## |
|
|
|
|
while [ $# -ge 1 ] |
|
|
|
|
do |
|
|
|
|
if [ ${1} = "--with-tox" ] |
|
|
|
|
then |
|
|
|
|
INSTALL_TOX=true |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--without-tox" ] |
|
|
|
|
then |
|
|
|
|
INSTALL_TOX=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--with-sqlcipher" ] |
|
|
|
|
then |
|
|
|
|
INSTALL_SQLCIPHER=true |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "--without-sqlcipher" ] |
|
|
|
|
then |
|
|
|
|
INSTALL_SQLCIPHER=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "-l" -o ${1} = "--local" ] |
|
|
|
|
then |
|
|
|
|
SYSTEM_WIDE=false |
|
|
|
|
shift |
|
|
|
|
elif [ ${1} = "-k" -o ${1} = "--keep" ] |
|
|
|
|
then |
|
|
|
|
KEEP_BUILD_FILES=true |
|
|
|
|
shift |
|
|
|
|
else |
|
|
|
|
if [ ${1} != "-h" -a ${1} != "--help" ] |
|
|
|
|
then |
|
|
|
|
echo "[ERROR] Unknown parameter \"${1}\"" |
|
|
|
|
echo "" |
|
|
|
|
print_help |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
print_help |
|
|
|
|
exit 0 |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
print_debug_output |
|
|
|
|
|
|
|
|
|
############### prepare step ############### |
|
|
|
|
# create BASE_DIR directory if necessary |
|
|
|
|
mkdir -p "${BASE_DIR}" |
|
|
|
|
|
|
|
|
|
# maybe an earlier run of this script failed |
|
|
|
|
# thus we should remove the cloned repositories |
|
|
|
|
# if they exist, otherwise cloning them may fail |
|
|
|
|
remove_build_dirs |
|
|
|
|
|
|
|
|
|
############### install step ############### |
|
|
|
|
install_toxcore |
|
|
|
|
install_sqlcipher |
|
|
|
|
|
|
|
|
|
############### cleanup step ############### |
|
|
|
|
# remove cloned repositories |
|
|
|
|
if [[ $KEEP_BUILD_FILES = "false" ]]; then |
|
|
|
|
if [[ $KEEP_BUILD_FILES = "false" ]] |
|
|
|
|
then |
|
|
|
|
remove_build_dirs |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
main $@ |
|
|
|
|