2016-01-26 15:46:35 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2017-01-28 11:31:46 +08:00
|
|
|
# Copyright © 2015-2017 by The qTox Project Contributors
|
2016-01-26 15:46:35 +08:00
|
|
|
#
|
|
|
|
# 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/>.
|
2016-08-11 17:51:53 +08:00
|
|
|
#
|
2016-01-26 15:46:35 +08:00
|
|
|
|
2016-07-08 23:56:18 +08:00
|
|
|
# stop as soon as one of steps will fail
|
|
|
|
set -e -o pipefail
|
2016-01-26 15:46:35 +08:00
|
|
|
|
2017-06-28 21:42:04 +08:00
|
|
|
# Qt 5.5, since that's the lowest supported version
|
2017-06-26 20:26:08 +08:00
|
|
|
sudo add-apt-repository -y ppa:beineri/opt-qt551-trusty
|
2016-01-26 15:46:35 +08:00
|
|
|
sudo apt-get update -qq
|
|
|
|
|
|
|
|
# install needed Qt, OpenAL, opus, qrencode, GTK tray deps, sqlcipher
|
2016-08-18 08:41:21 +08:00
|
|
|
# `--force-yes` since we don't care about GPG failing to work with short IDs
|
|
|
|
sudo apt-get install -y --force-yes \
|
2016-07-03 18:41:21 +08:00
|
|
|
automake \
|
|
|
|
autotools-dev \
|
|
|
|
build-essential \
|
|
|
|
check \
|
|
|
|
checkinstall \
|
|
|
|
libgdk-pixbuf2.0-dev \
|
|
|
|
libglib2.0-dev \
|
|
|
|
libgtk2.0-dev \
|
|
|
|
libopenal-dev \
|
|
|
|
libopus-dev \
|
|
|
|
libqrencode-dev \
|
|
|
|
libsqlcipher-dev \
|
|
|
|
libtool \
|
|
|
|
libvpx-dev \
|
|
|
|
libxss-dev qrencode \
|
2017-06-26 20:26:08 +08:00
|
|
|
qt55base \
|
|
|
|
qt55script \
|
|
|
|
qt55svg \
|
|
|
|
qt55tools \
|
|
|
|
qt55xmlpatterns \
|
2016-07-03 18:41:21 +08:00
|
|
|
pkg-config || yes
|
2016-01-26 15:46:35 +08:00
|
|
|
|
|
|
|
# Qt
|
2017-06-26 20:26:08 +08:00
|
|
|
source /opt/qt55/bin/qt55-env.sh || yes
|
2016-01-26 15:46:35 +08:00
|
|
|
|
|
|
|
# ffmpeg
|
|
|
|
if [ ! -e "libs" ]; then mkdir libs; fi
|
|
|
|
if [ ! -e "ffmpeg" ]; then mkdir ffmpeg; fi
|
|
|
|
#
|
|
|
|
cd libs/
|
|
|
|
export PREFIX_DIR="$PWD"
|
|
|
|
#
|
|
|
|
cd ../ffmpeg
|
|
|
|
wget http://ffmpeg.org/releases/ffmpeg-2.8.5.tar.bz2
|
|
|
|
tar xf ffmpeg*
|
|
|
|
cd ffmpeg*
|
2016-10-02 06:33:13 +08:00
|
|
|
# enabled:
|
|
|
|
# v4l2 -> webcam
|
|
|
|
# x11grab_xcb -> screen grabbing
|
|
|
|
# demuxers, decoders and parsers needed for webcams:
|
|
|
|
# mjpeg, h264
|
|
|
|
|
2017-01-28 11:31:46 +08:00
|
|
|
CC="ccache $CC" CXX="ccache $CXX" ./configure --prefix="$PREFIX_DIR" \
|
2016-07-03 18:41:21 +08:00
|
|
|
--disable-avfilter \
|
|
|
|
--disable-avresample \
|
|
|
|
--disable-bzlib \
|
2016-10-02 06:33:13 +08:00
|
|
|
--disable-bsfs \
|
2016-07-03 18:41:21 +08:00
|
|
|
--disable-dct \
|
2016-10-02 06:33:13 +08:00
|
|
|
--disable-decoders \
|
|
|
|
--disable-demuxers \
|
2016-07-03 18:41:21 +08:00
|
|
|
--disable-doc \
|
|
|
|
--disable-dwt \
|
|
|
|
--disable-encoders \
|
|
|
|
--disable-faan \
|
|
|
|
--disable-fft \
|
|
|
|
--disable-filters \
|
|
|
|
--disable-iconv \
|
2016-10-02 06:33:13 +08:00
|
|
|
--disable-indevs \
|
2016-07-03 18:41:21 +08:00
|
|
|
--disable-lsp \
|
|
|
|
--disable-lzma \
|
|
|
|
--disable-lzo \
|
|
|
|
--disable-mdct \
|
|
|
|
--disable-muxers \
|
|
|
|
--disable-network \
|
2016-10-02 06:33:13 +08:00
|
|
|
--disable-outdevs \
|
|
|
|
--disable-parsers \
|
2016-07-03 18:41:21 +08:00
|
|
|
--disable-postproc \
|
|
|
|
--disable-programs \
|
|
|
|
--disable-protocols \
|
|
|
|
--disable-rdft \
|
|
|
|
--disable-sdl \
|
|
|
|
--disable-static \
|
|
|
|
--disable-swresample \
|
|
|
|
--disable-swscale-alpha \
|
|
|
|
--disable-vaapi \
|
|
|
|
--disable-vdpau \
|
|
|
|
--disable-xlib \
|
|
|
|
--disable-yasm \
|
|
|
|
--disable-zlib \
|
|
|
|
--enable-shared \
|
2016-10-02 06:33:13 +08:00
|
|
|
--enable-memalign-hack \
|
|
|
|
--enable-indev=v4l2 \
|
|
|
|
--enable-indev=x11grab_xcb \
|
|
|
|
--enable-demuxer=h264 \
|
|
|
|
--enable-demuxer=mjpeg \
|
|
|
|
--enable-parser=h264 \
|
|
|
|
--enable-parser=mjpeg \
|
|
|
|
--enable-decoder=h264 \
|
|
|
|
--enable-decoder=mjpeg
|
2016-07-03 18:41:21 +08:00
|
|
|
|
2017-01-28 11:31:46 +08:00
|
|
|
CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc)
|
2016-01-26 15:46:35 +08:00
|
|
|
make install
|
|
|
|
cd ../../
|
|
|
|
# libsodium
|
|
|
|
git clone git://github.com/jedisct1/libsodium.git
|
|
|
|
cd libsodium
|
|
|
|
git checkout tags/1.0.8
|
|
|
|
./autogen.sh
|
2017-01-28 11:31:46 +08:00
|
|
|
CC="ccache $CC" CXX="ccache $CXX" ./configure
|
|
|
|
CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc)
|
2016-01-26 15:46:35 +08:00
|
|
|
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.8 --nodoc -y
|
|
|
|
sudo ldconfig
|
|
|
|
cd ..
|
|
|
|
# toxcore
|
2016-12-14 18:54:19 +08:00
|
|
|
git clone --branch v0.1.0 --depth=1 https://github.com/toktok/c-toxcore.git toxcore
|
2016-01-26 15:46:35 +08:00
|
|
|
cd toxcore
|
|
|
|
autoreconf -if
|
2017-01-28 11:31:46 +08:00
|
|
|
CC="ccache $CC" CXX="ccache $CXX" ./configure
|
|
|
|
CC="ccache $CC" CXX="ccache $CXX" make -j$(nproc) > /dev/null
|
2016-01-26 15:46:35 +08:00
|
|
|
sudo make install
|
|
|
|
echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
|
|
|
|
sudo ldconfig
|
|
|
|
cd ..
|
|
|
|
|
2017-05-15 17:20:29 +08:00
|
|
|
# filteraudio
|
|
|
|
git clone --branch v0.0.1 --depth=1 https://github.com/irungentoo/filter_audio filteraudio
|
|
|
|
cd filteraudio
|
|
|
|
CC="ccache $CC" CXX="ccache $CXX" sudo make install -j$(nproc)
|
|
|
|
sudo ldconfig
|
|
|
|
cd ..
|
|
|
|
|
2016-01-26 15:46:35 +08:00
|
|
|
$CC --version
|
|
|
|
$CXX --version
|
2016-07-05 10:37:26 +08:00
|
|
|
|
|
|
|
# needed, otherwise ffmpeg doesn't get detected
|
|
|
|
export PKG_CONFIG_PATH="$PWD/libs/lib/pkgconfig"
|
|
|
|
|
2017-01-28 11:31:46 +08:00
|
|
|
build_qtox() {
|
|
|
|
bdir() {
|
|
|
|
cd $BUILDDIR
|
|
|
|
make -j$(nproc)
|
|
|
|
# check if `qtox` file has been made, is non-empty and is an executable
|
|
|
|
[[ -s qtox ]] && [[ -x qtox ]]
|
2017-01-31 14:19:08 +08:00
|
|
|
cd -
|
2017-01-28 11:31:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2017-01-31 14:19:08 +08:00
|
|
|
|
|
|
|
test_qtox() {
|
|
|
|
local BUILDDIR=_build
|
|
|
|
|
|
|
|
cd $BUILDDIR
|
|
|
|
make test
|
|
|
|
cd -
|
|
|
|
}
|
|
|
|
|
2017-02-23 04:36:21 +08:00
|
|
|
# CMake is supposed to process files, e.g. ones with versions.
|
|
|
|
# Check whether those changes have been committed.
|
|
|
|
check_if_differs() {
|
|
|
|
echo "Checking whether files processed by CMake have been committed..."
|
|
|
|
echo ""
|
|
|
|
# ↓ `0` exit status only if there are no changes
|
|
|
|
git diff --exit-code
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
build_qtox
|
|
|
|
test_qtox
|
|
|
|
check_if_differs
|
|
|
|
}
|
|
|
|
main
|