mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
style(OSX build): change tabs to spaces and adjust style to existing one
Also remove unnecessary `function`, since it's equal to `()`.
This commit is contained in:
parent
610e21169a
commit
0fecb55024
|
@ -25,14 +25,15 @@ set -e
|
|||
|
||||
# Your home DIR really (Most of this happens in it) {DONT USE: ~ }
|
||||
SUBGIT="" #Change this to define a 'sub' git folder e.g. "-Patch"
|
||||
#Applys to $QTOX_DIR, $BUILD_DIR, and $DEPLOY_DIR folders for organization puropses
|
||||
#Applies to $QTOX_DIR, $BUILD_DIR, and $DEPLOY_DIR folders for organization puropses
|
||||
|
||||
if [[ $TRAVIS = true ]]; then #travis check
|
||||
MAIN_DIR="${TRAVIS_BUILD_DIR}"
|
||||
QTOX_DIR="${MAIN_DIR}"
|
||||
if [[ $TRAVIS = true ]]
|
||||
then
|
||||
MAIN_DIR="${TRAVIS_BUILD_DIR}"
|
||||
QTOX_DIR="${MAIN_DIR}"
|
||||
else
|
||||
MAIN_DIR="/Users/${USER}"
|
||||
QTOX_DIR="${MAIN_DIR}/qTox${SUBGIT}"
|
||||
MAIN_DIR="/Users/${USER}"
|
||||
QTOX_DIR="${MAIN_DIR}/qTox${SUBGIT}"
|
||||
fi
|
||||
QT_DIR="/usr/local/Cellar/qt5" # Folder name of QT install
|
||||
# Figure out latest version
|
||||
|
@ -46,255 +47,267 @@ TOXCORE_DIR="${MAIN_DIR}/toxcore" # Change to Git location
|
|||
|
||||
LIB_INSTALL_PREFIX="${QTOX_DIR}/libs"
|
||||
|
||||
if [[ ! -e "${LIB_INSTALL_PREFIX}" ]]; then
|
||||
mkdir -p "${LIB_INSTALL_PREFIX}"
|
||||
fi
|
||||
[[ ! -e "${LIB_INSTALL_PREFIX}" ]] \
|
||||
&& mkdir -p "${LIB_INSTALL_PREFIX}"
|
||||
|
||||
BUILD_DIR="${MAIN_DIR}/qTox-Mac_Build${SUBGIT}"
|
||||
DEPLOY_DIR="${MAIN_DIR}/qTox-Mac_Deployed${SUBGIT}"
|
||||
|
||||
|
||||
function fcho() {
|
||||
local msg="$1"; shift
|
||||
printf "\n$msg\n" "$@"
|
||||
# helper function to "pretty-print"
|
||||
fcho() {
|
||||
local msg="$1"; shift
|
||||
printf "\n$msg\n" "$@"
|
||||
}
|
||||
|
||||
function build_toxcore() {
|
||||
echo "Starting Toxcore build and install"
|
||||
cd $TOXCORE_DIR
|
||||
echo "Now working in: ${PWD}"
|
||||
build_toxcore() {
|
||||
echo "Starting Toxcore build and install"
|
||||
cd $TOXCORE_DIR
|
||||
echo "Now working in: ${PWD}"
|
||||
|
||||
local LS_DIR="/usr/local/Cellar/libsodium/"
|
||||
#Figure out latest version
|
||||
local LS_VER=($(ls ${LS_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p'))
|
||||
local LS_DIR_VER="${LS_DIR}/${LS_VER[1]}"
|
||||
local LS_DIR="/usr/local/Cellar/libsodium/"
|
||||
#Figure out latest version
|
||||
local LS_VER=($(ls ${LS_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p'))
|
||||
local LS_DIR_VER="${LS_DIR}/${LS_VER[1]}"
|
||||
|
||||
if [[ $TRAVIS != true ]]; then
|
||||
sleep 3
|
||||
fi
|
||||
[[ $TRAVIS != true ]] \
|
||||
&& sleep 3
|
||||
|
||||
autoreconf -if
|
||||
autoreconf -if
|
||||
|
||||
#Make sure the correct version of libsodium is used
|
||||
./configure --with-libsodium-headers="${LS_DIR_VER}/include/" --with-libsodium-libs="${LS_DIR_VER}/lib/" --prefix="${LIB_INSTALL_PREFIX}"
|
||||
#Make sure the correct version of libsodium is used
|
||||
./configure --with-libsodium-headers="${LS_DIR_VER}/include/" --with-libsodium-libs="${LS_DIR_VER}/lib/" --prefix="${LIB_INSTALL_PREFIX}"
|
||||
|
||||
make clean &> /dev/null
|
||||
fcho "Compiling toxcore."
|
||||
make > /dev/null || exit 1
|
||||
fcho "Installing toxcore."
|
||||
make install > /dev/null || exit 1
|
||||
make clean &> /dev/null
|
||||
fcho "Compiling toxcore."
|
||||
make > /dev/null || exit 1
|
||||
fcho "Installing toxcore."
|
||||
make install > /dev/null || exit 1
|
||||
}
|
||||
|
||||
function install() {
|
||||
fcho "=============================="
|
||||
fcho "This script will install the necessary applications and libraries needed to compile qTox properly."
|
||||
fcho "Note that this is not a 100 percent automated install it just helps simplify the process for less experienced or lazy users."
|
||||
if [[ $TRAVIS = true ]]; then #travis check
|
||||
echo "Oh... It's just Travis...."
|
||||
else
|
||||
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
|
||||
fi
|
||||
install() {
|
||||
fcho "=============================="
|
||||
fcho "This script will install the necessary applications and libraries needed to compile qTox properly."
|
||||
fcho "Note that this is not a 100 percent automated install it just helps simplify the process for less experienced or lazy users."
|
||||
if [[ $TRAVIS = true ]]
|
||||
then
|
||||
echo "Oh... It's just Travis...."
|
||||
else
|
||||
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
|
||||
fi
|
||||
|
||||
#fcho "Installing x-code Command line tools ..."
|
||||
#xcode-select --install
|
||||
#fcho "Installing x-code Command line tools ..."
|
||||
#xcode-select --install
|
||||
|
||||
if [[ -e /usr/local/bin/brew ]]; then
|
||||
fcho "Homebrew already installed!"
|
||||
else
|
||||
fcho "Installing homebrew ..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
if [[ $TRAVIS != true ]]; then
|
||||
fcho "Updating brew formulas ..."
|
||||
brew update
|
||||
fi
|
||||
fcho "Getting home brew formulas ..."
|
||||
if [[ $TRAVIS != true ]]; then #travis check
|
||||
sleep 3
|
||||
brew install git wget libtool autoconf automake
|
||||
fi
|
||||
brew install check libvpx opus libsodium
|
||||
if [[ -e /usr/local/bin/brew ]]
|
||||
then
|
||||
fcho "Homebrew already installed!"
|
||||
else
|
||||
fcho "Installing homebrew ..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
if [[ $TRAVIS != true ]]
|
||||
then
|
||||
fcho "Updating brew formulas ..."
|
||||
brew update
|
||||
fi
|
||||
fcho "Getting home brew formulas ..."
|
||||
if [[ $TRAVIS != true ]]
|
||||
then
|
||||
sleep 3
|
||||
brew install git wget libtool autoconf automake
|
||||
fi
|
||||
brew install check libvpx opus libsodium
|
||||
|
||||
fcho "Starting git repo checks ..."
|
||||
fcho "Starting git repo checks ..."
|
||||
|
||||
#cd $MAIN_DIR # just in case
|
||||
# Toxcore
|
||||
if [[ -e $TOX_DIR/.git/index ]]; then # Check if this exists
|
||||
fcho "Toxcore git repo already in place !"
|
||||
cd $TOX_DIR
|
||||
git pull
|
||||
else
|
||||
fcho "Cloning Toxcore git ... "
|
||||
git clone --depth=1 https://github.com/irungentoo/toxcore
|
||||
fi
|
||||
# qTox
|
||||
if [[ $TRAVIS = true ]]; then #travis check
|
||||
fcho "Travis... You already have qTox..."
|
||||
else
|
||||
if [[ -e $QTOX_DIR/.git/index ]]; then # Check if this exists
|
||||
fcho "qTox git repo already in place !"
|
||||
cd $QTOX_DIR
|
||||
git pull
|
||||
else
|
||||
fcho "Cloning qTox git ... "
|
||||
git clone https://github.com/qTox/qTox.git
|
||||
fi
|
||||
fi
|
||||
#cd $MAIN_DIR # just in case
|
||||
# Toxcore
|
||||
if [[ -e $TOX_DIR/.git/index ]]
|
||||
then
|
||||
fcho "Toxcore git repo already in place !"
|
||||
cd $TOX_DIR
|
||||
git pull
|
||||
else
|
||||
fcho "Cloning Toxcore git ... "
|
||||
git clone --depth=1 https://github.com/irungentoo/toxcore
|
||||
fi
|
||||
# qTox
|
||||
if [[ $TRAVIS = true ]]
|
||||
then
|
||||
fcho "Travis... You already have qTox..."
|
||||
else
|
||||
if [[ -e $QTOX_DIR/.git/index ]]
|
||||
then
|
||||
fcho "qTox git repo already in place !"
|
||||
cd $QTOX_DIR
|
||||
git pull
|
||||
else
|
||||
fcho "Cloning qTox git ... "
|
||||
git clone https://github.com/qTox/qTox.git
|
||||
fi
|
||||
fi
|
||||
|
||||
# toxcore build
|
||||
if [[ $TRAVIS = true ]]; then #travis check
|
||||
build_toxcore
|
||||
else
|
||||
fcho "If all went well you should now have all the tools needed to compile qTox!"
|
||||
read -r -p "Would you like to install toxcore now? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
||||
build_toxcore
|
||||
else
|
||||
fcho "You can simply use the -u command and say [Yes/n] when prompted"
|
||||
fi
|
||||
fi
|
||||
# toxcore build
|
||||
if [[ $TRAVIS = true ]]
|
||||
then
|
||||
build_toxcore
|
||||
else
|
||||
fcho "If all went well you should now have all the tools needed to compile qTox!"
|
||||
read -r -p "Would you like to install toxcore now? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
then
|
||||
build_toxcore
|
||||
else
|
||||
fcho "You can simply use the -u command and say [Yes/n] when prompted"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $TRAVIS = true ]]; then
|
||||
fcho "Updating brew formulas ..."
|
||||
brew update > /dev/null
|
||||
fi
|
||||
brew install ffmpeg qrencode qt5 sqlcipher
|
||||
if [[ $TRAVIS = true ]]
|
||||
then
|
||||
fcho "Updating brew formulas ..."
|
||||
brew update > /dev/null
|
||||
fi
|
||||
brew install ffmpeg qrencode qt5 sqlcipher
|
||||
|
||||
QT_VER=($(ls ${QT_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p'))
|
||||
QT_DIR_VER="${QT_DIR}/${QT_VER[1]}"
|
||||
QT_VER=($(ls ${QT_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p'))
|
||||
QT_DIR_VER="${QT_DIR}/${QT_VER[1]}"
|
||||
|
||||
# put required by qTox libs/headers in `libs/`
|
||||
cd "${QTOX_DIR}"
|
||||
sudo ./bootstrap-osx.sh
|
||||
# put required by qTox libs/headers in `libs/`
|
||||
cd "${QTOX_DIR}"
|
||||
sudo ./bootstrap-osx.sh
|
||||
}
|
||||
|
||||
function update() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting update process ..."
|
||||
#First update Toxcore from git
|
||||
cd $TOXCORE_DIR
|
||||
fcho "Now in ${PWD}"
|
||||
fcho "Pulling ..."
|
||||
git pull
|
||||
read -r -p "Did Toxcore update from git? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
||||
build_toxcore
|
||||
else
|
||||
fcho "Moving on!"
|
||||
fi
|
||||
update() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting update process ..."
|
||||
#First update Toxcore from git
|
||||
cd $TOXCORE_DIR
|
||||
fcho "Now in ${PWD}"
|
||||
fcho "Pulling ..."
|
||||
git pull
|
||||
read -r -p "Did Toxcore update from git? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
then
|
||||
build_toxcore
|
||||
else
|
||||
fcho "Moving on!"
|
||||
fi
|
||||
|
||||
#Now let's update qTox!
|
||||
cd $QTOX_DIR
|
||||
fcho "Now in ${PWD}"
|
||||
fcho "Pulling ..."
|
||||
git pull
|
||||
read -r -p "Did qTox update from git? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
||||
fcho "Starting OSX bootstrap ..."
|
||||
sudo ./bootstrap-osx.sh
|
||||
else
|
||||
fcho "Moving on!"
|
||||
fi
|
||||
#Now let's update qTox!
|
||||
cd $QTOX_DIR
|
||||
fcho "Now in ${PWD}"
|
||||
fcho "Pulling ..."
|
||||
git pull
|
||||
read -r -p "Did qTox update from git? [y/N] " response
|
||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
then
|
||||
fcho "Starting OSX bootstrap ..."
|
||||
sudo ./bootstrap-osx.sh
|
||||
else
|
||||
fcho "Moving on!"
|
||||
fi
|
||||
}
|
||||
|
||||
function build() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting build process ..."
|
||||
rm -rf $BUILD_DIR
|
||||
rm -rf $DEPLOY_DIR
|
||||
mkdir $BUILD_DIR
|
||||
cd $BUILD_DIR
|
||||
fcho "Now working in ${PWD}"
|
||||
fcho "Starting qmake ... "
|
||||
$QMAKE $QTOX_DIR/qtox.pro
|
||||
make
|
||||
build() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting build process ..."
|
||||
rm -rf $BUILD_DIR
|
||||
rm -rf $DEPLOY_DIR
|
||||
mkdir $BUILD_DIR
|
||||
cd $BUILD_DIR
|
||||
fcho "Now working in ${PWD}"
|
||||
fcho "Starting qmake ... "
|
||||
$QMAKE $QTOX_DIR/qtox.pro
|
||||
make
|
||||
}
|
||||
|
||||
function deploy() {
|
||||
fcho "------------------------------"
|
||||
fcho "starting deployment process ..."
|
||||
cd $BUILD_DIR
|
||||
if [ ! -d $BUILD_DIR ]; then
|
||||
fcho "Error: Build directory not detected, please run -ubd, or -b before deploying"
|
||||
exit 0
|
||||
fi
|
||||
mkdir $DEPLOY_DIR
|
||||
cp -r $BUILD_DIR/qTox.app $DEPLOY_DIR/qTox.app
|
||||
cd $DEPLOY_DIR
|
||||
fcho "Now working in ${PWD}"
|
||||
$MACDEPLOYQT qTox.app
|
||||
deploy() {
|
||||
fcho "------------------------------"
|
||||
fcho "starting deployment process ..."
|
||||
cd $BUILD_DIR
|
||||
if [ ! -d $BUILD_DIR ]
|
||||
then
|
||||
fcho "Error: Build directory not detected, please run -ubd, or -b before deploying"
|
||||
exit 0
|
||||
fi
|
||||
mkdir $DEPLOY_DIR
|
||||
cp -r $BUILD_DIR/qTox.app $DEPLOY_DIR/qTox.app
|
||||
cd $DEPLOY_DIR
|
||||
fcho "Now working in ${PWD}"
|
||||
$MACDEPLOYQT qTox.app
|
||||
}
|
||||
|
||||
function bootstrap() {
|
||||
fcho "------------------------------"
|
||||
fcho "starting bootstrap process ..."
|
||||
bootstrap() {
|
||||
fcho "------------------------------"
|
||||
fcho "starting bootstrap process ..."
|
||||
|
||||
#Toxcore
|
||||
build_toxcore
|
||||
#Toxcore
|
||||
build_toxcore
|
||||
|
||||
#Boot Strap
|
||||
fcho "Running: sudo ${QTOX_DIR_VER}/bootstrap-osx.sh"
|
||||
cd $QTOX_DIR
|
||||
sudo ./bootstrap-osx.sh
|
||||
#Boot Strap
|
||||
fcho "Running: sudo ${QTOX_DIR_VER}/bootstrap-osx.sh"
|
||||
cd $QTOX_DIR
|
||||
sudo ./bootstrap-osx.sh
|
||||
}
|
||||
|
||||
function dmgmake() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting DMG creation"
|
||||
cd $DEPLOY_DIR
|
||||
ln -s /Applications "./Install to Applications"
|
||||
cp -r -f $QTOX_DIR/osx/background-DMG ./.background
|
||||
cp -f $QTOX_DIR/osx/DS_Store-DMG ./.DS_Store
|
||||
cp -f $QTOX_DIR/LICENSE ./LICENSE
|
||||
cp -f $QTOX_DIR/README.md ./README.md
|
||||
cd $QTOX_DIR
|
||||
hdiutil create -volname qTox${SUBGIT} -srcfolder $DEPLOY_DIR -format UDZO qTox${SUBGIT}.dmg
|
||||
dmgmake() {
|
||||
fcho "------------------------------"
|
||||
fcho "Starting DMG creation"
|
||||
cd $DEPLOY_DIR
|
||||
ln -s /Applications "./Install to Applications"
|
||||
cp -r -f $QTOX_DIR/osx/background-DMG ./.background
|
||||
cp -f $QTOX_DIR/osx/DS_Store-DMG ./.DS_Store
|
||||
cp -f $QTOX_DIR/LICENSE ./LICENSE
|
||||
cp -f $QTOX_DIR/README.md ./README.md
|
||||
cd $QTOX_DIR
|
||||
hdiutil create -volname qTox${SUBGIT} -srcfolder $DEPLOY_DIR -format UDZO qTox${SUBGIT}.dmg
|
||||
}
|
||||
|
||||
function helpme() {
|
||||
echo "This script was created to help ease the process of compiling and creating a distributable qTox package for OSX systems."
|
||||
echo "The available commands are:"
|
||||
echo "-h | --help -- This help text."
|
||||
echo "-i | --instal -- A slightly automated process for getting an OSX machine ready to build Toxcore and qTox."
|
||||
echo "-u | --update -- Check for updates and build Toxcore from git & update qTox from git."
|
||||
echo "-b | --build -- Builds qTox in: ${BUILD_DIR}"
|
||||
echo "-d | --deploy -- Makes a distributable qTox.app file in: ${DEPLOY_DIR}"
|
||||
echo "-bs | --bootstrap -- Performs bootstrap steps."
|
||||
fcho "Issues with Toxcore or qTox should be reported to their respective repos: https://github.com/irungentoo/toxcore | https://github.com/qTox/qTox"
|
||||
exit 0
|
||||
helpme() {
|
||||
echo "This script was created to help ease the process of compiling and creating a distributable qTox package for OSX systems."
|
||||
echo "The available commands are:"
|
||||
echo "-h | --help -- This help text."
|
||||
echo "-i | --instal -- A slightly automated process for getting an OSX machine ready to build Toxcore and qTox."
|
||||
echo "-u | --update -- Check for updates and build Toxcore from git & update qTox from git."
|
||||
echo "-b | --build -- Builds qTox in: ${BUILD_DIR}"
|
||||
echo "-d | --deploy -- Makes a distributable qTox.app file in: ${DEPLOY_DIR}"
|
||||
echo "-bs | --bootstrap -- Performs bootstrap steps."
|
||||
fcho "Issues with Toxcore or qTox should be reported to their respective repos: https://github.com/irungentoo/toxcore | https://github.com/qTox/qTox"
|
||||
exit 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-h | --help)
|
||||
helpme
|
||||
exit
|
||||
;;
|
||||
-i | --install)
|
||||
install
|
||||
exit
|
||||
;;
|
||||
-u | --update)
|
||||
update
|
||||
exit
|
||||
;;
|
||||
-b | --build)
|
||||
build
|
||||
exit
|
||||
;;
|
||||
-d | --deploy)
|
||||
deploy
|
||||
exit
|
||||
;;
|
||||
-bs | --bootstrap)
|
||||
bootstrap
|
||||
exit
|
||||
;;
|
||||
-dmg)
|
||||
dmgmake
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
-h | --help)
|
||||
helpme
|
||||
exit
|
||||
;;
|
||||
-i | --install)
|
||||
install
|
||||
exit
|
||||
;;
|
||||
-u | --update)
|
||||
update
|
||||
exit
|
||||
;;
|
||||
-b | --build)
|
||||
build
|
||||
exit
|
||||
;;
|
||||
-d | --deploy)
|
||||
deploy
|
||||
exit
|
||||
;;
|
||||
-bs | --bootstrap)
|
||||
bootstrap
|
||||
exit
|
||||
;;
|
||||
-dmg)
|
||||
dmgmake
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
fcho "Oh dear! You seemed to of started this script improperly! Use -h to get available commands and information!"
|
||||
|
|
Loading…
Reference in New Issue
Block a user