1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(build): Remove qTox-Mac-Deployer-ULTIMATE.sh

* It is only partially covered by CI and doesn't simplify the build process
much for users. Replacing it in CI with just build-osx.sh significantly reduces
script complexity and is fully tested.
* bootstrap-osx.sh copying system libs and headers locally is unneeded.
  Already the DMG file contains them, and re-linking the app against
updated system files may be desirable.
* Update INSTALL.md for macOS to use brewfile, use common dependency build
  scripts, and use cmake rather than wrapper scripts.
* Build macOS in Release mode in CI, for release artifact creation
* Don't copy all used libs into a local folder, macdeployerqt already
  handles this for the dmg, and for local running of the app using the
system libs and relinking on update is desirable to avoid running out of
date dependencies unexpectedly.
This commit is contained in:
Anthony Bilinski 2022-01-04 11:11:09 -08:00
parent e405868037
commit ff2cad3b03
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
5 changed files with 34 additions and 608 deletions

View File

@ -273,20 +273,19 @@ jobs:
build-osx:
name: macOS
runs-on: macos-10.15
env:
TRAVIS: true
TRAVIS_BUILD_DIR: ${{ github.workspace }}
steps:
- uses: actions/checkout@v2
- name: homebrew
run: brew upgrade && brew bundle --file ./osx/Brewfile
- name: Run
- name: Install toxcore and toxext
run: buildscripts/build_toxcore_linux.sh
- name: Build qTox
run: ./.travis/build-osx.sh
- name: Upload dmg
uses: actions/upload-artifact@v2
with:
name: qTox-${{ github.sha }}.dmg
path: qTox-Mac_Build/qTox.dmg
path: qTox.dmg
build-docs:
name: Docs
runs-on: ubuntu-18.04

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright © 2016-2019 by The qTox Project Contributors
# Copyright © 2016-2021 by The qTox Project Contributors
#
# This program is libre software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,19 +20,20 @@ set -eu -o pipefail
readonly BIN_NAME="qTox.dmg"
# Build OSX
build() {
bash ./osx/qTox-Mac-Deployer-ULTIMATE.sh -i
bash ./osx/qTox-Mac-Deployer-ULTIMATE.sh -b
bash ./osx/qTox-Mac-Deployer-ULTIMATE.sh -d
bash ./osx/qTox-Mac-Deployer-ULTIMATE.sh -dmg
build_qtox() {
cmake -DUPDATE_CHECK=ON \
-DSPELL_CHECK=OFF \
-DSTRICT_OPTIONS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$(brew --prefix qt5)" .
make -j$(sysctl -n hw.ncpu)
make install
}
# check if binary was built
check() {
if [[ ! -s "$BIN_NAME" ]]
then
echo "There's no $BIN_NAME !"
echo "There's no $BIN_NAME!"
exit 1
fi
}
@ -42,7 +43,7 @@ make_hash() {
}
main() {
build
build_qtox
check
make_hash
}

View File

@ -435,55 +435,11 @@ make install clean
## OS X
Supported OS X versions: >=10.8. (NOTE: only 10.13 is tested during CI)
Supported OS X versions: >=10.13. (NOTE: only 10.13 is tested during CI)
Compiling qTox on OS X for development requires 2 tools:
[Xcode](https://developer.apple.com/xcode/) and [homebrew](https://brew.sh).
### Automated Script
You can now set up your OS X system to compile qTox automatically thanks to the
script in: `./osx/qTox-Mac-Deployer-ULTIMATE.sh`
This script can be run independently of the qTox repo and is all that's needed
to build from scratch on OS X.
To use this script you must launch terminal which can be found:
`Applications > Utilities > Terminal.app`
If you wish to lean more you can run `./qTox-Mac-Deployer-ULTIMATE.sh -h`
Note that the script will revert any non-committed changes to qTox repository
during the `update` phase.
#### First Run / Install
If you are running the script for the first time you will want to make sure your
system is ready. To do this simply run `./qTox-Mac-Deployer-ULTIMATE.sh -i` to
run you through the automated install set up.
After running the installation setup you are now ready to build qTox from
source, to do this simply run: `./qTox-Mac-Deployer-ULTIMATE.sh -b`
If there aren't any errors then you'll find a locally working qTox application
in your home folder under `~/qTox-Mac_Build`
#### Updating
If you want to update your application for testing purposes or you want to run a
nightly build setup then run: `./qTox-Mac-Deployer-ULTIMATE.sh -u` and follow
the prompts. (NOTE: If you know you updated the repos before running this hit Y)
followed by `./qTox-Mac-Deployer-ULTIMATE.sh -b` to build the application once
more. (NOTE: This will delete your previous build.)
#### Deploying
OS X requires an extra step to make the `qTox.app` file shareable on a system
that doesn't have the required libraries installed already.
If you want to share the build you've made with your other friends who use OS X
then simply run: `./qTox-Mac-Deployer-ULTIMATE.sh -d`
### Manual Compiling
#### Required Libraries
@ -493,74 +449,41 @@ Install homebrew if you don't have it:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
First, let's install the dependencies available via `brew`.
```bash
brew install git ffmpeg qrencode libtool automake autoconf check qt5 libvpx \
opus sqlcipher libsodium
```
Next, install
[toxcore](https://github.com/toktok/c-toxcore/blob/master/INSTALL.md#osx)
Then, clone qTox:
First, clone qTox.
```bash
git clone https://github.com/qTox/qTox
cd qTox
```
Finally, copy all required files. Whenever you update your brew packages, you
may skip all of the above steps and simply run the following commands:
Then install required dependencies available via `brew`.
```bash
cd ./git/qTox
sudo bash bootstrap-osx.sh
brew bundle --file osx/Brewfile
```
Then, install [toxcore](https://github.com/toktok/c-toxcore/blob/master/INSTALL.md), [ToxExt](https://github.com/toxext/toxext), and [tox_extension_messages](https://github.com/toxext/tox_extension_messages.
```bash
buildscripts/build_toxcore_linux.sh
```
Finally, build qTox.
#### Compiling
You can build qTox with Qt Creator
[seperate download](http://www.qt.io/download-open-source/#section-6) or
manually with cmake
With that; in your terminal you can compile qTox in the git dir:
```bash
cmake .
make
```
Or a cleaner method would be to:
```bash
cd ./git/dir/qTox
mkdir ./build
cd build
mkdir -p _build
cd _build
cmake ..
```
#### Deploying
If you compiled qTox properly you can now deploy the `qTox.app` that's created
where you built qTox so you can distribute the package.
Using your qt5 homebrew installation from the build directory:
```bash
/usr/local/Cellar/qt5/5.5.1_2/bin/macdeployqt ./qTox.app
make -j$(sysctl -n hw.ncpu)
make install
```
#### Running qTox
You've got 2 choices, either click on the qTox app that suddenly exists, or do
the following:
```bash
qtox.app/Contents/MacOS/qtox
```
Enjoy the snazzy CLI output as your friends and family congratulate you on
becoming a hacker
`qTox.dmg` should be in your build directory. You can install qTox from the dmg
to your Applications folder, or run qTox directly from the dmg.
<a name="windows" />

View File

@ -1,86 +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
# copy libs to given destination
copy_libs() {
local dest="$@"
local libs=(
/usr/local/lib/libsodium*
/usr/local/lib/libvpx*
/usr/local/lib/libopus*
/usr/local/lib/libav*
/usr/local/lib/libswscale*
/usr/local/lib/libqrencode*
/usr/local/lib/libsqlcipher*
)
echo Copying libraries…
for lib in "${libs[@]}"
do
cp -v -r "$lib" "$dest"
done
}
# copy includes to given destination
copy_includes() {
local dest="$@"
local includes=(
/usr/local/include/vpx*
/usr/local/include/sodium*
/usr/local/include/qrencode*
/usr/local/include/libav*
/usr/local/include/libswscale*
/usr/local/include/sqlcipher*
)
echo Copying include files…
for include in "${includes[@]}"
do
cp -v -r "$include" "$dest"
done
}
main() {
local libs_dir="libs/lib"
local inc_dir="libs/include"
echo Creating directories…
mkdir -v -p "$libs_dir" "$inc_dir"
copy_libs "$libs_dir"
copy_includes "$inc_dir"
echo Done.
}
main

View File

@ -1,411 +0,0 @@
#!/usr/bin/env bash
# Copyright © 2015 by RowenStipe
# Copyright © 2016-2019 by The qTox Project Contributors
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
# This uses the same process as doing it manually but with a few varients
# Use: ./qTox-Mac-Deployer-ULTIMATE.sh -h
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"
#Applies to $QTOX_DIR, $BUILD_DIR, and $DEPLOY_DIR folders for organization puropses
if [[ $TRAVIS = true ]]
then
MAIN_DIR="${TRAVIS_BUILD_DIR}"
QTOX_DIR="${MAIN_DIR}"
else
# the directory which qTox is cloned in, wherever that is
MAIN_DIR="$(dirname $(readlink -f $0))/../.."
QTOX_DIR="${MAIN_DIR}/qTox${SUBGIT}"
fi
QT_DIR="/usr/local/Cellar/qt5" # Folder name of QT install
# Figure out latest version
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]}"
SCRIPT_DIR=$( cd $(dirname $0); pwd -P)
TOXCORE_DIR="${MAIN_DIR}/toxcore" # Change to Git location
TOX_EXT_DIR="${MAIN_DIR}/toxext"
TOX_EXT_MESSAGES_DIR="${MAIN_DIR}/tox_extension_messages"
LIB_INSTALL_PREFIX="${QTOX_DIR}/libs"
[[ ! -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}"
# helper function to "pretty-print"
fcho() {
local msg="$1"; shift
printf "\n$msg\n" "$@"
}
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]}"
[[ $TRAVIS != true ]] \
&& sleep 3
mkdir -p _build && cd _build
fcho "Starting cmake ..."
#Make sure the correct version of libsodium is used
cmake -DBOOTSTRAP_DAEMON=OFF -DLIBSODIUM_CFLAGS="-I${LS_DIR_VER}/include/" -DLIBSODIUM_LDFLAGS="L${LS_DIR_VER}/lib/" -DCMAKE_INSTALL_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
}
build_toxext() {
echo "Starting Toxext build and install"
cd $TOX_EXT_DIR
echo "Now working in: ${PWD}"
[[ $TRAVIS != true ]] \
&& sleep 3
mkdir _build && cd _build
fcho "Starting cmake ..."
PKG_CONFIG_PATH="${LIB_INSTALL_PREFIX}"/lib/pkgconfig cmake -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" ..
make clean &> /dev/null
fcho "Compiling toxext."
make > /dev/null || exit 1
fcho "Installing toxext."
make install > /dev/null || exit 1
}
build_tox_extension_messages() {
echo "Starting tox_extension_messages build and install"
cd $TOX_EXT_MESSAGES_DIR
echo "Now working in: ${PWD}"
[[ $TRAVIS != true ]] \
&& sleep 3
mkdir _build && cd _build
fcho "Starting cmake ..."
PKG_CONFIG_PATH="${LIB_INSTALL_PREFIX}"/lib/pkgconfig cmake -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" ..
make clean &> /dev/null
fcho "Compiling tox_extension_messages."
make > /dev/null || exit 1
fcho "Installing tox_extension_messages."
make install > /dev/null || exit 1
}
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
# osx 10.13 High Sierra doesn't come with a /usr/local/sbin, yet it is needed by some brew packages
NEEDED_DEP_DIR="/usr/local/sbin"
if [[ $TRAVIS = true ]]
then
sudo mkdir -p $NEEDED_DEP_DIR
sudo chown -R $(whoami) $NEEDED_DEP_DIR
elif [[ ! -d $NEEDED_DEP_DIR ]]
then
fcho "The direcory $NEEDED_DEP_DIR must exist for some development packages."
read -r -p "Would you like to create it now, and set the owner to $(whoami)? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
sudo mkdir $NEEDED_DEP_DIR
sudo chown -R $(whoami) $NEEDED_DEP_DIR
else
fcho "Cannot proceed without $NEEDED_DEP_DIR. Exiting."
exit 0
fi
fi
#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
brew bundle install -f ./osx/Brewfile
fi
fcho "Starting git repo checks ..."
#cd $MAIN_DIR # just in case
# Toxcore
rm -fr "${TOXCORE_DIR}"
mkdir -p "${TOXCORE_DIR}"
cd "${TOXCORE_DIR}"
"${SCRIPT_DIR}"/../buildscripts/download/download_toxcore.sh
rm -fr "${TOX_EXT_DIR}"
mkdir -p "${TOX_EXT_DIR}"
cd "${TOX_EXT_DIR}"
"${SCRIPT_DIR}"/../buildscripts/download/download_toxext.sh
rm -fr "${TOX_EXT_MESSAGES_DIR}"
mkdir -p "${TOX_EXT_MESSAGES_DIR}"
cd "${TOX_EXT_MESSAGES_DIR}"
"${SCRIPT_DIR}"/../buildscripts/download/download_toxext_messages.sh
# 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
if [[ $TRAVIS != true ]]
then
fcho "If all went well you should now have all the tools needed to compile qTox!"
fi
# toxcore build
if [[ $TRAVIS = true ]]
then
build_toxcore
else
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
# toxext build
if [[ $TRAVIS = true ]]
then
build_toxext
else
read -r -p "Would you like to install toxext now? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
build_toxext
else
fcho "You can simply use the -u command and say [Yes/n] when prompted"
fi
fi
# tox_extension_messages build
if [[ $TRAVIS = true ]]
then
build_tox_extension_messages
else
read -r -p "Would you like to install tox_extension_messages now? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
build_tox_extension_messages
else
fcho "You can simply use the -u command and say [Yes/n] when prompted"
fi
fi
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
}
update() {
fcho "------------------------------"
fcho "Starting update process ..."
#First update Toxcore from git
cd $TOXCORE_DIR
fcho "Now in ${PWD}"
fcho "Pulling ..."
# make sure that pull can be applied, i.e. clean up files from any
# changes that could have been applied to them
git checkout -f
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 ..."
# make sure that pull can be applied, i.e. clean up files from any
# changes that could have been applied to them
git checkout -f
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
}
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 cmake ..."
if [[ $TRAVIS = true ]]
then
STRICT_OPTIONS="ON"
else
STRICT_OPTIONS="OFF"
fi
cmake -H$QTOX_DIR -B. \
-DUPDATE_CHECK=ON \
-DSPELL_CHECK=OFF \
-DSTRICT_OPTIONS="${STRICT_OPTIONS}" \
-DCMAKE_PREFIX_PATH="$(brew --prefix qt5);${LIB_INSTALL_PREFIX}"
make -j$(sysctl -n hw.ncpu)
}
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
make install
cp -r $BUILD_DIR/qTox.app $DEPLOY_DIR/qTox.app
}
bootstrap() {
fcho "------------------------------"
fcho "starting bootstrap process ..."
#Toxcore
build_toxcore
build_toxext
build_tox_extension_messages
#Boot Strap
fcho "Running: sudo ${QTOX_DIR}/bootstrap-osx.sh"
cd $QTOX_DIR
sudo ./bootstrap-osx.sh
}
dmgmake() {
fcho "------------------------------"
fcho "Starting DMG creation"
cp $BUILD_DIR/qTox.dmg $QTOX_DIR/
}
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 | --install -- 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/toktok/c-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
;;
*)
;;
esac
fcho "Oh dear! You seemed to of started this script improperly! Use -h to get available commands and information!"
echo " "
say -v Kathy -r 255 "Oh dear! You seemed to of started this script improperly! Use -h to get available commands and information!"
exit 0