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

chore(build): correct switch to cmake

This commit is contained in:
Zetok Zalbavar 2017-01-28 03:31:46 +00:00
parent 5694f97d58
commit 657d1a84d1
No known key found for this signature in database
GPG Key ID: C953D3880212068A
5 changed files with 141 additions and 59 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright © 2016 by The qTox Project Contributors # Copyright © 2016-2017 by The qTox Project Contributors
# #
# This program is libre software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -23,9 +23,6 @@ set -e -o pipefail
install_ccache() { install_ccache() {
echo "Installing ccache ..." echo "Installing ccache ..."
brew install ccache brew install ccache
# make sure to use ccache for all the compiling
export CC="ccache $CC"
export CXX="ccache $CXX"
} }
# Build OSX # Build OSX

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright © 2015-2016 by The qTox Project Contributors # Copyright © 2015-2017 by The qTox Project Contributors
# #
# This program is libre software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -48,10 +48,6 @@ sudo apt-get install -y --force-yes \
qt53xmlpatterns \ qt53xmlpatterns \
pkg-config || yes pkg-config || yes
# make sure to use ccache for all the compiling
export CC="ccache $CC"
export CXX="ccache $CXX"
# Qt # Qt
source /opt/qt53/bin/qt53-env.sh || yes source /opt/qt53/bin/qt53-env.sh || yes
@ -72,7 +68,7 @@ cd ffmpeg*
# demuxers, decoders and parsers needed for webcams: # demuxers, decoders and parsers needed for webcams:
# mjpeg, h264 # mjpeg, h264
./configure --prefix="$PREFIX_DIR" \ CC="ccache $CC" CXX="ccache $CXX" ./configure --prefix="$PREFIX_DIR" \
--disable-avfilter \ --disable-avfilter \
--disable-avresample \ --disable-avresample \
--disable-bzlib \ --disable-bzlib \
@ -120,7 +116,7 @@ cd ffmpeg*
--enable-decoder=h264 \ --enable-decoder=h264 \
--enable-decoder=mjpeg --enable-decoder=mjpeg
make -j$(nproc) CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc)
make install make install
cd ../../ cd ../../
# libsodium # libsodium
@ -128,7 +124,8 @@ git clone git://github.com/jedisct1/libsodium.git
cd libsodium cd libsodium
git checkout tags/1.0.8 git checkout tags/1.0.8
./autogen.sh ./autogen.sh
./configure && make -j$(nproc) CC="ccache $CC" CXX="ccache $CXX" ./configure
CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc)
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.8 --nodoc -y sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.8 --nodoc -y
sudo ldconfig sudo ldconfig
cd .. cd ..
@ -136,8 +133,8 @@ cd ..
git clone --branch v0.1.0 --depth=1 https://github.com/toktok/c-toxcore.git toxcore git clone --branch v0.1.0 --depth=1 https://github.com/toktok/c-toxcore.git toxcore
cd toxcore cd toxcore
autoreconf -if autoreconf -if
./configure CC="ccache $CC" CXX="ccache $CXX" ./configure
make -j$(nproc) > /dev/null CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc) > /dev/null
sudo make install sudo make install
echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
sudo ldconfig sudo ldconfig
@ -149,14 +146,33 @@ $CXX --version
# needed, otherwise ffmpeg doesn't get detected # needed, otherwise ffmpeg doesn't get detected
export PKG_CONFIG_PATH="$PWD/libs/lib/pkgconfig" export PKG_CONFIG_PATH="$PWD/libs/lib/pkgconfig"
# first build qTox without support for optional dependencies
echo '*** BUILDING "MINIMAL" VERSION ***' build_qtox() {
cmake . -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND=NO -DENABLE_SYSTRAY_GTK_BACKEND=NO -DDISABLE_PLATFORM_EXT=YES -DSMILEYS=DISABLED bdir() {
# ↓ reduce if build fails with OOM pushd .
make -j$(nproc) cd $BUILDDIR
# clean it up, and build normal version make -j$(nproc)
make clean # check if `qtox` file has been made, is non-empty and is an executable
echo '*** BUILDING "FULL" VERSION ***' [[ -s qtox ]] && [[ -x qtox ]]
cmake . -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" popd
# ↓ reduce if build fails with OOM }
make -j$(nproc)
local BUILDDIR=_build
# first build qTox without support for optional dependencies
echo '*** BUILDING "MINIMAL" VERSION ***'
cmake -H. -B"$BUILDDIR" \
-DSMILEYS=DISABLED \
-DENABLE_STATUSNOTIFIER=False \
-DENABLE_GTK_SYSTRAY=False
bdir
# clean it up, and build normal version
rm -rf "$BUILDDIR"
echo '*** BUILDING "FULL" VERSION ***'
cmake -H. -B"$BUILDDIR"
bdir
}
build_qtox

View File

@ -34,6 +34,7 @@
- [Compile qTox](#compile-qtox) - [Compile qTox](#compile-qtox)
- [OS X](#osx) - [OS X](#osx)
- [Windows](#windows) - [Windows](#windows)
- [Compile-time switches](#compile-time-switches)
<a name="dependencies" /> <a name="dependencies" />
## Dependencies ## Dependencies
@ -52,8 +53,8 @@
## Optional dependencies ## Optional dependencies
They can be disabled/enabled by passing arguments to `cmake` as They can be disabled/enabled by passing arguments to `cmake` command when
`-D{name}={value}` command when building qTox. building qTox.
If they are missing, qTox is built without support for the functionality. If they are missing, qTox is built without support for the functionality.
@ -66,7 +67,7 @@ If they are missing, qTox is built without support for the functionality.
| [libXScrnSaver] | >= 1.2 | | [libXScrnSaver] | >= 1.2 |
| [libX11] | >= 1.6.0 | | [libX11] | >= 1.6.0 |
To disable: `DISABLE_PLATFORM_EXT=YES` Disabled if dependencies are missing during compilation.
#### KDE Status Notifier / GTK tray backend #### KDE Status Notifier / GTK tray backend
@ -79,8 +80,7 @@ To disable: `DISABLE_PLATFORM_EXT=YES`
| [GTK+] | >= 2.0 | | [GTK+] | >= 2.0 |
| [Pango] | >= 1.18 | | [Pango] | >= 1.18 |
To disable: `ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND=NO To disable: `-DENABLE_STATUSNOTIFIER=False -DENABLE_GTK_SYSTRAY=False`
ENABLE_SYSTRAY_GTK_BACKEND=NO`
#### Unity tray backend #### Unity tray backend
@ -97,7 +97,7 @@ Disabled by default.
| [libappindicator] | >= 0.4.92 | | [libappindicator] | >= 0.4.92 |
| [Pango] | >= 1.18 | | [Pango] | >= 1.18 |
To enable: `ENABLE_SYSTRAY_UNITY_BACKEND=YES` To enable: `-DENABLE_APPINDICATOR=True`
<a name="linux" /> <a name="linux" />
@ -238,10 +238,25 @@ your `sources.list`. Adding backports:
http://backports.debian.org/Instructions/ http://backports.debian.org/Instructions/
```bash ```bash
sudo apt-get install build-essential cmake qt5-qmake qt5-default qttools5-dev-tools \ sudo apt-get install \
libqt5opengl5-dev libqt5svg5-dev libopenal-dev libxss-dev qrencode \ build-essential \
libqrencode-dev libglib2.0-dev libgdk-pixbuf2.0-dev libgtk2.0-dev ffmpeg \ cmake \
libsqlcipher-dev pkg-config yasm ffmpeg \
libgdk-pixbuf2.0-dev \
libglib2.0-dev \
libgtk2.0-dev \
libopenal-dev \
libqrencode-dev \
libqt5opengl5-dev \
libqt5svg5-dev \
libsqlcipher-dev \
libxss-dev \
pkg-config \
qrencode \
qt5-default \
qt5-qmake \
qttools5-dev-tools \
yasm
``` ```
**Go to [FFmpeg](#ffmpeg) section to compile it.** **Go to [FFmpeg](#ffmpeg) section to compile it.**
@ -288,22 +303,54 @@ http://slackbuilds.org/repository/14.1/network/qTox/
<a name="ubuntu-other-deps" /> <a name="ubuntu-other-deps" />
#### Ubuntu >=15.04 #### Ubuntu >=15.04
```bash ```bash
sudo apt-get install build-essential cmake qt5-qmake qt5-default qttools5-dev-tools \ sudo apt-get install \
libqt5opengl5-dev libqt5svg5-dev libopenal-dev libxss-dev qrencode \ build-essential cmake \
libqrencode-dev libavutil-ffmpeg-dev libswresample-ffmpeg-dev \ libavcodec-ffmpeg-dev \
libavcodec-ffmpeg-dev libswscale-ffmpeg-dev libavfilter-ffmpeg-dev \ libavdevice-ffmpeg-dev \
libavdevice-ffmpeg-dev libglib2.0-dev libgdk-pixbuf2.0-dev libgtk2.0-dev \ libavfilter-ffmpeg-dev \
libsqlcipher-dev libavutil-ffmpeg-dev \
libgdk-pixbuf2.0-dev \
libglib2.0-dev \
libgtk2.0-dev \
libopenal-dev \
libqrencode-dev \
libqt5opengl5-dev \
libqt5svg5-dev \
libsqlcipher-dev \
libswresample-ffmpeg-dev \
libswscale-ffmpeg-dev \
libxss-dev \
qrencode \
qt5-default \
qt5-qmake \
qttools5-dev-tools
``` ```
<a name="ubuntu-other-1604-deps" /> <a name="ubuntu-other-1604-deps" />
#### Ubuntu >=16.04: #### Ubuntu >=16.04:
```bash ```bash
sudo apt-get install build-essential cmake qt5-qmake qt5-default \ sudo apt-get install \
qttools5-dev-tools libqt5opengl5-dev libqt5svg5-dev libopenal-dev \ build-essential \
libxss-dev qrencode libqrencode-dev libavutil-dev libswresample-dev \ cmake \
libavcodec-dev libswscale-dev libavfilter-dev libavdevice-dev \ libavcodec-dev \
libglib2.0-dev libgdk-pixbuf2.0-dev libgtk2.0-dev libsqlcipher-dev libavdevice-dev \
libavfilter-dev \
libavutil-dev \
libgdk-pixbuf2.0-dev \
libglib2.0-dev \
libgtk2.0-dev \
libopenal-dev \
libqrencode-dev \
libqt5opengl5-dev \
libqt5svg5-dev \
libsqlcipher-dev \
libswresample-dev \
libswscale-dev \
libxss-dev \
qrencode \
qt5-default \
qt5-qmake \
qttools5-dev-tools
``` ```
### FFmpeg ### FFmpeg
@ -680,6 +727,25 @@ Run `bootstrap.bat` in cloned `C:\qTox` directory. Script will download rest of
dependencies compile them and put to appropriate directories. dependencies compile them and put to appropriate directories.
## Compile-time switches
They are passed as an argument to `cmake` command. E.g. with a switch `SWITCH`
that has value `YES` it would be passed to `cmake` in a following manner:
```bash
cmake -DSWITCH=yes
```
Switches:
- `SMILEYS`, values:
- if not defined or an unsupported value is passed, all emoticon packs are
included
- `DISABLED` don't include any emoticon packs, custom ones are still loaded
- `MIN` minimal support for emoticons, only a single emoticon pack is
included
[Atk]: https://wiki.gnome.org/Accessibility [Atk]: https://wiki.gnome.org/Accessibility
[Cairo]: https://www.cairographics.org/ [Cairo]: https://www.cairographics.org/
[DBus Menu]: https://launchpad.net/libdbusmenu [DBus Menu]: https://launchpad.net/libdbusmenu

View File

@ -2,7 +2,7 @@
# #
# Copyright © 2015 by RowenStipe # Copyright © 2015 by RowenStipe
# Copyright © 2016 by The qTox Project Contributors # Copyright © 2016-2017 by The qTox Project Contributors
# #
# This program is libre software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -166,6 +166,8 @@ install() {
then then
fcho "Updating brew formulas ..." fcho "Updating brew formulas ..."
brew update > /dev/null brew update > /dev/null
else
brew install cmake
fi fi
brew install ffmpeg qrencode qt5 sqlcipher brew install ffmpeg qrencode qt5 sqlcipher
@ -226,8 +228,9 @@ build() {
cd $BUILD_DIR cd $BUILD_DIR
fcho "Now working in ${PWD}" fcho "Now working in ${PWD}"
fcho "Starting cmake ... " fcho "Starting cmake ... "
cmake $QTOX_DIR export CMAKE_PREFIX_PATH=$(brew --prefix qt5)
make cmake -H$QTOX_DIR -B.
make -j$(sysctl -n hw.ncpu)
} }
deploy() { deploy() {

View File

@ -8,6 +8,7 @@ apt_install() {
autotools-dev autotools-dev
check check
checkinstall checkinstall
cmake
git build-essential git build-essential
libavdevice-dev libavdevice-dev
libgdk-pixbuf2.0-dev libgdk-pixbuf2.0-dev
@ -27,7 +28,6 @@ apt_install() {
qt5-default qt5-default
qt5-qmake qt5-qmake
qttools5-dev-tools qttools5-dev-tools
cmake
) )
local codename=$(lsb_release -c -s) local codename=$(lsb_release -c -s)
@ -115,27 +115,27 @@ fedora_locallib() {
zypper_install() { zypper_install() {
local zypper_packages=( local zypper_packages=(
cmake
git git
libffmpeg-devel
libopus-devel
libQt5Concurrent-devel libQt5Concurrent-devel
libqt5-linguist
libQt5Network-devel libQt5Network-devel
libQt5OpenGL-devel libQt5OpenGL-devel
libQt5Sql-devel
libQt5Sql5-sqlite
libQt5Xml-devel
libXScrnSaver-devel
libffmpeg-devel
libopus-devel
libqt5-linguist
libqt5-qtbase-common-devel libqt5-qtbase-common-devel
libqt5-qtsvg-devel libqt5-qtsvg-devel
libQt5Sql5-sqlite
libQt5Sql-devel
libQt5Xml-devel
libsodium-devel libsodium-devel
libvpx-devel libvpx-devel
libXScrnSaver-devel
openal-soft-devel openal-soft-devel
patterns-openSUSE-devel_basis patterns-openSUSE-devel_basis
patterns-openSUSE-devel_basis patterns-openSUSE-devel_basis
qrencode-devel qrencode-devel
sqlcipher-devel sqlcipher-devel
cmake
) )
sudo zypper in "${zypper_packages[@]}" sudo zypper in "${zypper_packages[@]}"
} }
@ -159,7 +159,7 @@ main() {
fi fi
./bootstrap.sh ./bootstrap.sh
cmake . cmake -H. -B_build
make -j$(nproc) make -j$(nproc)
} }
main main