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,9 +25,10 @@ set -e
|
||||||
|
|
||||||
# Your home DIR really (Most of this happens in it) {DONT USE: ~ }
|
# Your home DIR really (Most of this happens in it) {DONT USE: ~ }
|
||||||
SUBGIT="" #Change this to define a 'sub' git folder e.g. "-Patch"
|
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
|
if [[ $TRAVIS = true ]]
|
||||||
|
then
|
||||||
MAIN_DIR="${TRAVIS_BUILD_DIR}"
|
MAIN_DIR="${TRAVIS_BUILD_DIR}"
|
||||||
QTOX_DIR="${MAIN_DIR}"
|
QTOX_DIR="${MAIN_DIR}"
|
||||||
else
|
else
|
||||||
|
@ -46,20 +47,20 @@ TOXCORE_DIR="${MAIN_DIR}/toxcore" # Change to Git location
|
||||||
|
|
||||||
LIB_INSTALL_PREFIX="${QTOX_DIR}/libs"
|
LIB_INSTALL_PREFIX="${QTOX_DIR}/libs"
|
||||||
|
|
||||||
if [[ ! -e "${LIB_INSTALL_PREFIX}" ]]; then
|
[[ ! -e "${LIB_INSTALL_PREFIX}" ]] \
|
||||||
mkdir -p "${LIB_INSTALL_PREFIX}"
|
&& mkdir -p "${LIB_INSTALL_PREFIX}"
|
||||||
fi
|
|
||||||
|
|
||||||
BUILD_DIR="${MAIN_DIR}/qTox-Mac_Build${SUBGIT}"
|
BUILD_DIR="${MAIN_DIR}/qTox-Mac_Build${SUBGIT}"
|
||||||
DEPLOY_DIR="${MAIN_DIR}/qTox-Mac_Deployed${SUBGIT}"
|
DEPLOY_DIR="${MAIN_DIR}/qTox-Mac_Deployed${SUBGIT}"
|
||||||
|
|
||||||
|
|
||||||
function fcho() {
|
# helper function to "pretty-print"
|
||||||
|
fcho() {
|
||||||
local msg="$1"; shift
|
local msg="$1"; shift
|
||||||
printf "\n$msg\n" "$@"
|
printf "\n$msg\n" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_toxcore() {
|
build_toxcore() {
|
||||||
echo "Starting Toxcore build and install"
|
echo "Starting Toxcore build and install"
|
||||||
cd $TOXCORE_DIR
|
cd $TOXCORE_DIR
|
||||||
echo "Now working in: ${PWD}"
|
echo "Now working in: ${PWD}"
|
||||||
|
@ -69,9 +70,8 @@ function build_toxcore() {
|
||||||
local LS_VER=($(ls ${LS_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p'))
|
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_VER="${LS_DIR}/${LS_VER[1]}"
|
||||||
|
|
||||||
if [[ $TRAVIS != true ]]; then
|
[[ $TRAVIS != true ]] \
|
||||||
sleep 3
|
&& sleep 3
|
||||||
fi
|
|
||||||
|
|
||||||
autoreconf -if
|
autoreconf -if
|
||||||
|
|
||||||
|
@ -85,11 +85,12 @@ function build_toxcore() {
|
||||||
make install > /dev/null || exit 1
|
make install > /dev/null || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function install() {
|
install() {
|
||||||
fcho "=============================="
|
fcho "=============================="
|
||||||
fcho "This script will install the necessary applications and libraries needed to compile qTox properly."
|
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."
|
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
|
if [[ $TRAVIS = true ]]
|
||||||
|
then
|
||||||
echo "Oh... It's just Travis...."
|
echo "Oh... It's just Travis...."
|
||||||
else
|
else
|
||||||
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
|
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
|
||||||
|
@ -98,18 +99,21 @@ function install() {
|
||||||
#fcho "Installing x-code Command line tools ..."
|
#fcho "Installing x-code Command line tools ..."
|
||||||
#xcode-select --install
|
#xcode-select --install
|
||||||
|
|
||||||
if [[ -e /usr/local/bin/brew ]]; then
|
if [[ -e /usr/local/bin/brew ]]
|
||||||
|
then
|
||||||
fcho "Homebrew already installed!"
|
fcho "Homebrew already installed!"
|
||||||
else
|
else
|
||||||
fcho "Installing homebrew ..."
|
fcho "Installing homebrew ..."
|
||||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||||
fi
|
fi
|
||||||
if [[ $TRAVIS != true ]]; then
|
if [[ $TRAVIS != true ]]
|
||||||
|
then
|
||||||
fcho "Updating brew formulas ..."
|
fcho "Updating brew formulas ..."
|
||||||
brew update
|
brew update
|
||||||
fi
|
fi
|
||||||
fcho "Getting home brew formulas ..."
|
fcho "Getting home brew formulas ..."
|
||||||
if [[ $TRAVIS != true ]]; then #travis check
|
if [[ $TRAVIS != true ]]
|
||||||
|
then
|
||||||
sleep 3
|
sleep 3
|
||||||
brew install git wget libtool autoconf automake
|
brew install git wget libtool autoconf automake
|
||||||
fi
|
fi
|
||||||
|
@ -119,7 +123,8 @@ function install() {
|
||||||
|
|
||||||
#cd $MAIN_DIR # just in case
|
#cd $MAIN_DIR # just in case
|
||||||
# Toxcore
|
# Toxcore
|
||||||
if [[ -e $TOX_DIR/.git/index ]]; then # Check if this exists
|
if [[ -e $TOX_DIR/.git/index ]]
|
||||||
|
then
|
||||||
fcho "Toxcore git repo already in place !"
|
fcho "Toxcore git repo already in place !"
|
||||||
cd $TOX_DIR
|
cd $TOX_DIR
|
||||||
git pull
|
git pull
|
||||||
|
@ -128,10 +133,12 @@ function install() {
|
||||||
git clone --depth=1 https://github.com/irungentoo/toxcore
|
git clone --depth=1 https://github.com/irungentoo/toxcore
|
||||||
fi
|
fi
|
||||||
# qTox
|
# qTox
|
||||||
if [[ $TRAVIS = true ]]; then #travis check
|
if [[ $TRAVIS = true ]]
|
||||||
|
then
|
||||||
fcho "Travis... You already have qTox..."
|
fcho "Travis... You already have qTox..."
|
||||||
else
|
else
|
||||||
if [[ -e $QTOX_DIR/.git/index ]]; then # Check if this exists
|
if [[ -e $QTOX_DIR/.git/index ]]
|
||||||
|
then
|
||||||
fcho "qTox git repo already in place !"
|
fcho "qTox git repo already in place !"
|
||||||
cd $QTOX_DIR
|
cd $QTOX_DIR
|
||||||
git pull
|
git pull
|
||||||
|
@ -142,19 +149,22 @@ function install() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# toxcore build
|
# toxcore build
|
||||||
if [[ $TRAVIS = true ]]; then #travis check
|
if [[ $TRAVIS = true ]]
|
||||||
|
then
|
||||||
build_toxcore
|
build_toxcore
|
||||||
else
|
else
|
||||||
fcho "If all went well you should now have all the tools needed to compile qTox!"
|
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
|
read -r -p "Would you like to install toxcore now? [y/N] " response
|
||||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||||
|
then
|
||||||
build_toxcore
|
build_toxcore
|
||||||
else
|
else
|
||||||
fcho "You can simply use the -u command and say [Yes/n] when prompted"
|
fcho "You can simply use the -u command and say [Yes/n] when prompted"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $TRAVIS = true ]]; then
|
if [[ $TRAVIS = true ]]
|
||||||
|
then
|
||||||
fcho "Updating brew formulas ..."
|
fcho "Updating brew formulas ..."
|
||||||
brew update > /dev/null
|
brew update > /dev/null
|
||||||
fi
|
fi
|
||||||
|
@ -168,7 +178,7 @@ function install() {
|
||||||
sudo ./bootstrap-osx.sh
|
sudo ./bootstrap-osx.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
update() {
|
||||||
fcho "------------------------------"
|
fcho "------------------------------"
|
||||||
fcho "Starting update process ..."
|
fcho "Starting update process ..."
|
||||||
#First update Toxcore from git
|
#First update Toxcore from git
|
||||||
|
@ -177,7 +187,8 @@ function update() {
|
||||||
fcho "Pulling ..."
|
fcho "Pulling ..."
|
||||||
git pull
|
git pull
|
||||||
read -r -p "Did Toxcore update from git? [y/N] " response
|
read -r -p "Did Toxcore update from git? [y/N] " response
|
||||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||||
|
then
|
||||||
build_toxcore
|
build_toxcore
|
||||||
else
|
else
|
||||||
fcho "Moving on!"
|
fcho "Moving on!"
|
||||||
|
@ -189,7 +200,8 @@ function update() {
|
||||||
fcho "Pulling ..."
|
fcho "Pulling ..."
|
||||||
git pull
|
git pull
|
||||||
read -r -p "Did qTox update from git? [y/N] " response
|
read -r -p "Did qTox update from git? [y/N] " response
|
||||||
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||||
|
then
|
||||||
fcho "Starting OSX bootstrap ..."
|
fcho "Starting OSX bootstrap ..."
|
||||||
sudo ./bootstrap-osx.sh
|
sudo ./bootstrap-osx.sh
|
||||||
else
|
else
|
||||||
|
@ -197,7 +209,7 @@ function update() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
build() {
|
||||||
fcho "------------------------------"
|
fcho "------------------------------"
|
||||||
fcho "Starting build process ..."
|
fcho "Starting build process ..."
|
||||||
rm -rf $BUILD_DIR
|
rm -rf $BUILD_DIR
|
||||||
|
@ -210,11 +222,12 @@ function build() {
|
||||||
make
|
make
|
||||||
}
|
}
|
||||||
|
|
||||||
function deploy() {
|
deploy() {
|
||||||
fcho "------------------------------"
|
fcho "------------------------------"
|
||||||
fcho "starting deployment process ..."
|
fcho "starting deployment process ..."
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
if [ ! -d $BUILD_DIR ]; then
|
if [ ! -d $BUILD_DIR ]
|
||||||
|
then
|
||||||
fcho "Error: Build directory not detected, please run -ubd, or -b before deploying"
|
fcho "Error: Build directory not detected, please run -ubd, or -b before deploying"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -225,7 +238,7 @@ function deploy() {
|
||||||
$MACDEPLOYQT qTox.app
|
$MACDEPLOYQT qTox.app
|
||||||
}
|
}
|
||||||
|
|
||||||
function bootstrap() {
|
bootstrap() {
|
||||||
fcho "------------------------------"
|
fcho "------------------------------"
|
||||||
fcho "starting bootstrap process ..."
|
fcho "starting bootstrap process ..."
|
||||||
|
|
||||||
|
@ -238,7 +251,7 @@ function bootstrap() {
|
||||||
sudo ./bootstrap-osx.sh
|
sudo ./bootstrap-osx.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function dmgmake() {
|
dmgmake() {
|
||||||
fcho "------------------------------"
|
fcho "------------------------------"
|
||||||
fcho "Starting DMG creation"
|
fcho "Starting DMG creation"
|
||||||
cd $DEPLOY_DIR
|
cd $DEPLOY_DIR
|
||||||
|
@ -251,7 +264,7 @@ function dmgmake() {
|
||||||
hdiutil create -volname qTox${SUBGIT} -srcfolder $DEPLOY_DIR -format UDZO qTox${SUBGIT}.dmg
|
hdiutil create -volname qTox${SUBGIT} -srcfolder $DEPLOY_DIR -format UDZO qTox${SUBGIT}.dmg
|
||||||
}
|
}
|
||||||
|
|
||||||
function helpme() {
|
helpme() {
|
||||||
echo "This script was created to help ease the process of compiling and creating a distributable qTox package for OSX systems."
|
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 "The available commands are:"
|
||||||
echo "-h | --help -- This help text."
|
echo "-h | --help -- This help text."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user