2015-03-26 13:16:22 +08:00
|
|
|
#!/usr/bin/env bash
|
2014-09-11 06:36:34 +08:00
|
|
|
|
2016-06-18 17:31:38 +08:00
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
apt_install() {
|
|
|
|
local apt_packages=(
|
|
|
|
automake
|
|
|
|
autotools-dev
|
2017-03-19 03:36:01 +08:00
|
|
|
build-essential
|
2016-06-18 17:31:38 +08:00
|
|
|
check
|
|
|
|
checkinstall
|
2017-01-28 11:31:46 +08:00
|
|
|
cmake
|
2017-03-19 03:36:01 +08:00
|
|
|
git
|
2016-06-18 17:31:38 +08:00
|
|
|
libavdevice-dev
|
|
|
|
libgdk-pixbuf2.0-dev
|
|
|
|
libglib2.0-dev
|
|
|
|
libgtk2.0-dev
|
|
|
|
libopenal-dev
|
|
|
|
libopus-dev
|
|
|
|
libqrencode-dev
|
|
|
|
libqt5opengl5-dev
|
|
|
|
libqt5svg5-dev
|
|
|
|
libsodium-dev
|
2016-03-26 19:17:36 +08:00
|
|
|
libsqlcipher-dev
|
2016-06-18 17:31:38 +08:00
|
|
|
libtool
|
|
|
|
libvpx-dev
|
|
|
|
libxss-dev
|
|
|
|
qrencode
|
|
|
|
qt5-default
|
|
|
|
qt5-qmake
|
2017-03-19 03:36:01 +08:00
|
|
|
qttools5-dev
|
2016-06-18 17:31:38 +08:00
|
|
|
qttools5-dev-tools
|
|
|
|
)
|
2016-09-04 19:45:44 +08:00
|
|
|
|
|
|
|
local codename=$(lsb_release -c -s)
|
|
|
|
|
|
|
|
# Enable Debian Jessie backports repository for libsqlcipher-dev (if not yet enabled)
|
|
|
|
if [ ${codename} == jessie ] && [ $(apt-cache policy | fgrep jessie-backports -c) == 0 ]
|
|
|
|
then
|
|
|
|
echo "deb http://httpredir.debian.org/debian jessie-backports main" | sudo tee /etc/apt/sources.list.d/qtox-backports.list
|
|
|
|
sudo apt-get update
|
|
|
|
fi
|
|
|
|
|
2016-06-18 17:31:38 +08:00
|
|
|
sudo apt-get install "${apt_packages[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
pacman_install() {
|
|
|
|
local pacman_packages=(
|
|
|
|
base-devel
|
|
|
|
git
|
|
|
|
libsodium
|
|
|
|
libvpx
|
|
|
|
libxss
|
|
|
|
openal
|
|
|
|
opus
|
|
|
|
qrencode
|
|
|
|
qt5
|
|
|
|
)
|
|
|
|
sudo pacman -S --needed "${pacman_packages[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
dnf_install() {
|
|
|
|
local dnf_group_packages=(
|
|
|
|
'Development Tools'
|
|
|
|
'C Development Tools and Libraries'
|
|
|
|
)
|
|
|
|
sudo dnf group install "${dnf_group_packages[@]}"
|
|
|
|
|
2016-04-29 18:33:57 +08:00
|
|
|
# pure Fedora doesn't have what it takes to compile qTox (ffmpeg)
|
2016-06-18 17:31:38 +08:00
|
|
|
local fedora_version=$(rpm -E %fedora)
|
|
|
|
local dnf_rpmfusion_package=(
|
|
|
|
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$fedora_version.noarch.rpm
|
|
|
|
)
|
|
|
|
sudo dnf install "$dnf_rpmfusion_package"
|
|
|
|
|
|
|
|
local dnf_packages=(
|
|
|
|
ffmpeg-devel
|
|
|
|
gdk-pixbuf2-devel
|
|
|
|
git
|
|
|
|
glib2-devel
|
|
|
|
gtk2-devel
|
|
|
|
libsodium-devel
|
|
|
|
libtool
|
|
|
|
libvpx-devel
|
|
|
|
libXScrnSaver-devel
|
|
|
|
openal-soft-devel
|
2016-06-16 22:24:15 +08:00
|
|
|
openssl-devel
|
2016-06-18 17:31:38 +08:00
|
|
|
opus-devel
|
|
|
|
qrencode-devel
|
|
|
|
qt5-qtsvg
|
|
|
|
qt5-qtsvg-devel
|
|
|
|
qt5-qttools-devel
|
|
|
|
qt-creator
|
|
|
|
qt-devel
|
|
|
|
qt-doc
|
|
|
|
sqlite
|
|
|
|
sqlite-devel
|
|
|
|
)
|
|
|
|
sudo dnf install "${dnf_packages[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Fedora by default doesn't include libs in /usr/local/lib so add it
|
|
|
|
fedora_locallib() {
|
|
|
|
local llib_file="/etc/ld.so.conf.d/locallib.conf"
|
|
|
|
local llib_line="/usr/local/lib/"
|
|
|
|
|
|
|
|
# check whether needed line already exists
|
|
|
|
is_locallib() {
|
|
|
|
grep -q "^$llib_line\$" "$llib_file"
|
|
|
|
}
|
|
|
|
|
|
|
|
# proceed only if line doesn't exist
|
|
|
|
is_locallib \
|
|
|
|
|| echo "$llib_line" \
|
|
|
|
| sudo tee -a "$llib_file"
|
|
|
|
}
|
|
|
|
|
|
|
|
zypper_install() {
|
|
|
|
local zypper_packages=(
|
2017-01-28 11:31:46 +08:00
|
|
|
cmake
|
2016-06-18 17:31:38 +08:00
|
|
|
git
|
|
|
|
libQt5Concurrent-devel
|
|
|
|
libQt5Network-devel
|
|
|
|
libQt5OpenGL-devel
|
|
|
|
libQt5Sql-devel
|
2017-01-28 11:31:46 +08:00
|
|
|
libQt5Sql5-sqlite
|
2016-06-18 17:31:38 +08:00
|
|
|
libQt5Xml-devel
|
2017-01-28 11:31:46 +08:00
|
|
|
libXScrnSaver-devel
|
|
|
|
libffmpeg-devel
|
|
|
|
libopus-devel
|
|
|
|
libqt5-linguist
|
|
|
|
libqt5-qtbase-common-devel
|
|
|
|
libqt5-qtsvg-devel
|
2016-06-18 17:31:38 +08:00
|
|
|
libsodium-devel
|
|
|
|
libvpx-devel
|
|
|
|
openal-soft-devel
|
|
|
|
patterns-openSUSE-devel_basis
|
|
|
|
patterns-openSUSE-devel_basis
|
|
|
|
qrencode-devel
|
|
|
|
sqlcipher-devel
|
|
|
|
)
|
|
|
|
sudo zypper in "${zypper_packages[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
if which apt-get
|
|
|
|
then
|
|
|
|
apt_install
|
|
|
|
elif which pacman
|
|
|
|
then
|
|
|
|
pacman_install
|
|
|
|
elif which dnf
|
|
|
|
then
|
|
|
|
dnf_install
|
|
|
|
fedora_locallib
|
|
|
|
elif which zypper
|
|
|
|
then
|
|
|
|
zypper_install
|
|
|
|
else
|
|
|
|
echo "Unknown package manager, attempting to compile anyways"
|
|
|
|
fi
|
|
|
|
|
|
|
|
./bootstrap.sh
|
2017-01-28 11:31:46 +08:00
|
|
|
cmake -H. -B_build
|
2016-06-18 17:31:38 +08:00
|
|
|
make -j$(nproc)
|
|
|
|
}
|
|
|
|
main
|