1
0
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:
Zetok Zalbavar 2016-09-27 03:15:52 +01:00
parent 610e21169a
commit 0fecb55024
No known key found for this signature in database
GPG Key ID: C953D3880212068A

View File

@ -25,9 +25,10 @@ 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
if [[ $TRAVIS = true ]]
then
MAIN_DIR="${TRAVIS_BUILD_DIR}"
QTOX_DIR="${MAIN_DIR}"
else
@ -46,20 +47,20 @@ 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() {
# helper function to "pretty-print"
fcho() {
local msg="$1"; shift
printf "\n$msg\n" "$@"
}
function build_toxcore() {
build_toxcore() {
echo "Starting Toxcore build and install"
cd $TOXCORE_DIR
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_DIR_VER="${LS_DIR}/${LS_VER[1]}"
if [[ $TRAVIS != true ]]; then
sleep 3
fi
[[ $TRAVIS != true ]] \
&& sleep 3
autoreconf -if
@ -85,11 +85,12 @@ function build_toxcore() {
make install > /dev/null || exit 1
}
function install() {
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
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'
@ -98,18 +99,21 @@ function install() {
#fcho "Installing x-code Command line tools ..."
#xcode-select --install
if [[ -e /usr/local/bin/brew ]]; then
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
if [[ $TRAVIS != true ]]
then
fcho "Updating brew formulas ..."
brew update
fi
fcho "Getting home brew formulas ..."
if [[ $TRAVIS != true ]]; then #travis check
if [[ $TRAVIS != true ]]
then
sleep 3
brew install git wget libtool autoconf automake
fi
@ -119,7 +123,8 @@ function install() {
#cd $MAIN_DIR # just in case
# 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 !"
cd $TOX_DIR
git pull
@ -128,10 +133,12 @@ function install() {
git clone --depth=1 https://github.com/irungentoo/toxcore
fi
# qTox
if [[ $TRAVIS = true ]]; then #travis check
if [[ $TRAVIS = true ]]
then
fcho "Travis... You already have qTox..."
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 !"
cd $QTOX_DIR
git pull
@ -142,19 +149,22 @@ function install() {
fi
# toxcore build
if [[ $TRAVIS = true ]]; then #travis check
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
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
if [[ $TRAVIS = true ]]
then
fcho "Updating brew formulas ..."
brew update > /dev/null
fi
@ -168,7 +178,7 @@ function install() {
sudo ./bootstrap-osx.sh
}
function update() {
update() {
fcho "------------------------------"
fcho "Starting update process ..."
#First update Toxcore from git
@ -177,7 +187,8 @@ function update() {
fcho "Pulling ..."
git pull
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
else
fcho "Moving on!"
@ -189,7 +200,8 @@ function update() {
fcho "Pulling ..."
git pull
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 ..."
sudo ./bootstrap-osx.sh
else
@ -197,7 +209,7 @@ function update() {
fi
}
function build() {
build() {
fcho "------------------------------"
fcho "Starting build process ..."
rm -rf $BUILD_DIR
@ -210,11 +222,12 @@ function build() {
make
}
function deploy() {
deploy() {
fcho "------------------------------"
fcho "starting deployment process ..."
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"
exit 0
fi
@ -225,7 +238,7 @@ function deploy() {
$MACDEPLOYQT qTox.app
}
function bootstrap() {
bootstrap() {
fcho "------------------------------"
fcho "starting bootstrap process ..."
@ -238,7 +251,7 @@ function bootstrap() {
sudo ./bootstrap-osx.sh
}
function dmgmake() {
dmgmake() {
fcho "------------------------------"
fcho "Starting DMG creation"
cd $DEPLOY_DIR
@ -251,7 +264,7 @@ function dmgmake() {
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 "The available commands are:"
echo "-h | --help -- This help text."