mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore(build): Remove bootstrap.sh
* It is untested by CI and adds a lot of complexity compared to manually compiling toxcore and toxext in a couple commands. This also exposes the cmake configs rather than wrapping them in an out of date list of script configs for users.
This commit is contained in:
parent
ff2cad3b03
commit
7d0d62c154
16
INSTALL.md
16
INSTALL.md
|
@ -25,7 +25,6 @@
|
|||
- [Ubuntu](#ubuntu-other-deps)
|
||||
- [Compile dependencies](#compile-dependencies)
|
||||
- [docker](#docker)
|
||||
- [bootstrap.sh](#bootstrap.sh)
|
||||
- [Compile toxcore](#compile-toxcore)
|
||||
- [Compile extensions](#compile-extensions)
|
||||
- [Compile qTox](#compile-qtox)
|
||||
|
@ -287,21 +286,6 @@ Please see buildscripts/docker/Dockerfile... for your distribution for an up to
|
|||
|
||||
### Compile dependencies
|
||||
|
||||
Toxcore and ToxExt extensions can either be built with bootstrap.sh or manually.
|
||||
|
||||
|
||||
<a name="bootstrap.sh" />
|
||||
|
||||
#### bootstrap.sh
|
||||
If you want to develop on your hostmachine, `bootstrap.sh` will build toxcore
|
||||
and extensions for you, allowing you to skip to [compiling qTox](#compile-qtox)
|
||||
after running it. To use it, run
|
||||
```bash
|
||||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig"
|
||||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
|
||||
./bootstrap.sh
|
||||
```
|
||||
|
||||
<a name="compile-toxcore" />
|
||||
|
||||
#### Compile toxcore
|
||||
|
|
299
bootstrap.sh
299
bootstrap.sh
|
@ -1,299 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright © 2019 by The qTox Project Contributors
|
||||
#
|
||||
# This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
# qTox is libre software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qTox 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qTox. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
# This script's purpose is to ease compiling qTox for users.
|
||||
#
|
||||
# NO AUTOMATED BUILDS SHOULD DEPEND ON IT.
|
||||
#
|
||||
# This script is and will be a subject to breaking changes, and at no time one
|
||||
# should expect it to work - it's something that you could try to use but
|
||||
# don't expect that it will work for sure.
|
||||
#
|
||||
# If script doesn't work, you should use instructions provided in INSTALL.md
|
||||
# before reporting issues like “qTox doesn't compile”.
|
||||
#
|
||||
# With that being said, reporting that this script doesn't work would be nice.
|
||||
#
|
||||
# If you are contributing code to qTox that change its dependencies / the way
|
||||
# it's being build, please keep in mind that changing just bootstrap.sh
|
||||
# *IS NOT* and will not be sufficient - you should update INSTALL.md first.
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
|
||||
################ parameters ################
|
||||
# directory where the script is located
|
||||
readonly SCRIPT_DIR=$( cd $(dirname $0); pwd -P)
|
||||
|
||||
# directory where dependencies will be installed
|
||||
readonly INSTALL_DIR=libs
|
||||
|
||||
# just for convenience
|
||||
readonly BASE_DIR="${SCRIPT_DIR}/${INSTALL_DIR}"
|
||||
|
||||
# directory names of cloned repositories
|
||||
readonly TOXCORE_DIR="libtoxcore"
|
||||
readonly TOXEXT_DIR="toxext"
|
||||
readonly TOX_EXT_MESSAGES_DIR="tox_ext_messages"
|
||||
readonly SQLCIPHER_DIR="sqlcipher"
|
||||
|
||||
# default values for user given parameters
|
||||
INSTALL_TOX=true
|
||||
INSTALL_TOXEXT=true
|
||||
INSTALL_TOX_EXT_MESSAGES=true
|
||||
INSTALL_SQLCIPHER=false
|
||||
SYSTEM_WIDE=true
|
||||
KEEP_BUILD_FILES=false
|
||||
|
||||
# if Fedora, by default install sqlcipher
|
||||
if which dnf &> /dev/null
|
||||
then
|
||||
INSTALL_SQLCIPHER=true
|
||||
fi
|
||||
|
||||
|
||||
print_help() {
|
||||
echo "Use this script to install/update libtoxcore"
|
||||
echo ""
|
||||
echo "usage:"
|
||||
echo " ${0} PARAMETERS"
|
||||
echo ""
|
||||
echo "parameters:"
|
||||
echo " --with-tox : install/update libtoxcore"
|
||||
echo " --without-tox : do not install/update libtoxcore"
|
||||
echo " --with-sqlcipher : install/update sqlcipher"
|
||||
echo " --without-sqlcipher : do not install/update sqlcipher"
|
||||
echo " -h|--help : displays this help"
|
||||
echo " -l|--local : install packages into ${INSTALL_DIR}"
|
||||
echo " -k|--keep : keep build files after installation/update"
|
||||
echo ""
|
||||
echo "example usages:"
|
||||
echo " ${0} -- install libtoxcore"
|
||||
}
|
||||
|
||||
############ 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}"
|
||||
}
|
||||
|
||||
# remove not needed dirs
|
||||
remove_build_dirs() {
|
||||
rm -rf "${BASE_DIR}/${TOXCORE_DIR}"
|
||||
rm -rf "${BASE_DIR}/${TOXEXT_DIR}"
|
||||
rm -rf "${BASE_DIR}/${TOX_EXT_MESSAGES_DIR}"
|
||||
rm -rf "${BASE_DIR}/${SQLCIPHER_DIR}"
|
||||
}
|
||||
|
||||
install_toxcore() {
|
||||
if [[ $INSTALL_TOX = "true" ]]
|
||||
then
|
||||
mkdir -p "${BASE_DIR}/${TOXCORE_DIR}"
|
||||
pushd ${BASE_DIR}/${TOXCORE_DIR}
|
||||
|
||||
"${SCRIPT_DIR}"/buildscripts/download/download_toxcore.sh
|
||||
|
||||
# compile and install
|
||||
if [[ $SYSTEM_WIDE = "false" ]]
|
||||
then
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=${BASE_DIR} -DBOOTSTRAP_DAEMON=OFF
|
||||
make -j $(nproc)
|
||||
make install
|
||||
else
|
||||
cmake . -DBOOTSTRAP_DAEMON=OFF
|
||||
make -j $(nproc)
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
fi
|
||||
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
install_toxext() {
|
||||
if [[ $INSTALL_TOXEXT = "true" ]]
|
||||
then
|
||||
mkdir -p "${BASE_DIR}/${TOXEXT_DIR}"
|
||||
pushd ${BASE_DIR}/${TOXEXT_DIR}
|
||||
|
||||
"${SCRIPT_DIR}"/buildscripts/download/download_toxext.sh
|
||||
|
||||
# compile and install
|
||||
if [[ $SYSTEM_WIDE = "false" ]]
|
||||
then
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=${BASE_DIR}
|
||||
make -j $(nproc)
|
||||
make install
|
||||
else
|
||||
cmake .
|
||||
make -j $(nproc)
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
fi
|
||||
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
install_tox_ext_messages() {
|
||||
if [[ $INSTALL_TOX_EXT_MESSAGES = "true" ]]
|
||||
then
|
||||
mkdir -p "${BASE_DIR}/${TOX_EXT_MESSAGES_DIR}"
|
||||
pushd ${BASE_DIR}/${TOX_EXT_MESSAGES_DIR}
|
||||
|
||||
"${SCRIPT_DIR}"/buildscripts/download/download_toxext_messages.sh
|
||||
|
||||
# compile and install
|
||||
if [[ $SYSTEM_WIDE = "false" ]]
|
||||
then
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=${BASE_DIR}
|
||||
make -j $(nproc)
|
||||
make install
|
||||
else
|
||||
cmake .
|
||||
make -j $(nproc)
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
fi
|
||||
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
install_sqlcipher() {
|
||||
if [[ $INSTALL_SQLCIPHER = "true" ]]
|
||||
then
|
||||
mkdir -p "${BASE_DIR}/${SQLCIPHER_DIR}"
|
||||
pushd "${BASE_DIR}/${SQLCIPHER_DIR}"
|
||||
|
||||
"${SCRIPT_DIR}"/download/download_sqlcipher.sh
|
||||
|
||||
autoreconf -if
|
||||
|
||||
if [[ $SYSTEM_WIDE = "false" ]]
|
||||
then
|
||||
./configure --prefix="${BASE_DIR}" \
|
||||
--enable-tempstore=yes \
|
||||
CFLAGS="-DSQLITE_HAS_CODEC"
|
||||
make -j$(nproc)
|
||||
make install || \
|
||||
echo "" && \
|
||||
echo "Sqlcipher failed to install locally." && \
|
||||
echo "" && \
|
||||
echo "Try without \"-l|--local\"" && \
|
||||
exit 1
|
||||
else
|
||||
./configure \
|
||||
--enable-tempstore=yes \
|
||||
CFLAGS="-DSQLITE_HAS_CODEC"
|
||||
make -j$(nproc)
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
fi
|
||||
|
||||
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-toxext" ]
|
||||
then
|
||||
INSTALL_TOXEXT=true
|
||||
shift
|
||||
elif [ ${1} = "--without-toxext" ]
|
||||
then
|
||||
INSTALL_TOXEXT=false
|
||||
shift
|
||||
elif [ ${1} = "--with-toxext-messages" ]
|
||||
then
|
||||
INSTALL_TOX_EXT_MESSAGES=true
|
||||
shift
|
||||
elif [ ${1} = "--without-toxext-messages" ]
|
||||
then
|
||||
INSTALL_TOX_EXT_MESSAGES=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_toxext
|
||||
install_tox_ext_messages
|
||||
install_sqlcipher
|
||||
|
||||
############### cleanup step ###############
|
||||
# remove cloned repositories
|
||||
if [[ $KEEP_BUILD_FILES = "false" ]]
|
||||
then
|
||||
remove_build_dirs
|
||||
fi
|
||||
}
|
||||
main $@
|
Loading…
Reference in New Issue
Block a user