Skip to content

Instantly share code, notes, and snippets.

@thomastoye
Forked from notadecent/tox.sh
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomastoye/68041f615a7cb3129d1e to your computer and use it in GitHub Desktop.
Save thomastoye/68041f615a7cb3129d1e to your computer and use it in GitHub Desktop.
#!/bin/bash
## wget -O tox.sh waa.ai/iqt && chmod +x ./tox.sh && ./tox.sh
## ./tox.sh -sl to skip libsodium (they don't update that often)
## ./tox.sh -sd to skip libsodium and all the other dependencies
## If libraries are missing, remove /etc/ld.so.conf.d/locallib.conf and
## try running again. Else, try messing around with the prefix paths.
## Suggestions, comments and the alike are welcome on http://waa.ai/4vsk
## or send me a mail, to notadecent AT tox DOT im
upd=2014/05/08 # Date this script was updated
com="urras optimized Gentoo compatibility"
# Check if script is being ran as root
test "$(whoami)" == 'root' && (echo "Please don't run this script as root"; exit 1)
# Check for arguments
nolibsm=0
nodep=0
[ "$1" == '-sl' ] && nolibsm=1
[ "$1" == '-sd' ] && nodep=1
[ "$nodep" == "1" ] && nolibsm=1
# Prompt installation
echo last updated $upd
echo comment: $com
while true; do
read -p "continue?" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "answer yes or no";;
esac
done
# Clear update directory
sudo rm -rf /tmp/tox-update/
sudo rm /usr/share/applications/venom.desktop
mkdir -p /tmp/tox-update/
cd /tmp/tox-update/
# libsodium with checkinstall
getlibsodium() {
git clone https://github.com/jedisct1/libsodium.git
cd libsodium
autoreconf -if
./autogen.sh
./configure --prefix=/usr/local/
yes "" | sudo checkinstall --install --pkgname libsodium --pkgversion 0.4.2 --nodoc
sudo /sbin/ldconfig
cd ..
}
# libsodium without checkinstall
getlibsodiumnc() {
git clone https://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/0.4.2
./autogen.sh
./configure --prefix=/usr/local/
make check
make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# toxcore
gettoxcore() {
git clone https://github.com/irungentoo/ProjectTox-Core.git
cd ProjectTox-Core
autoreconf -if
./configure --prefix=/usr/local/ --with-dependency-search=/usr/local/
make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# toxcore for non-pleb distros
gettoxcorenc() {
git clone https://github.com/irungentoo/ProjectTox-Core.git
cd ProjectTox-Core
autoreconf -if
./configure --prefix=/usr/local/ --with-dependency-search=/usr/local/
make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# toxic
gettoxic() {
git clone https://github.com/Tox/toxic.git
cd toxic
autoreconf -if
./configure --with-dependency-search=/usr/local/lib/
make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# toxic for non-pleb distros
gettoxicnc() {
git clone https://github.com/Tox/toxic.git
cd toxic
autoreconf -if
./configure --with-dependency-search=/usr/local/
make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# make headers available
exportlibpath() {
if grep -Fxq "/usr/local/" /etc/ld.so.conf.d/locallib.conf; then
echo "/etc/ld.so.conf.d/locallib.conf found, skipping"
grep --quiet "^/usr/local/lib/$" /etc/ld.so.conf.d/locallib.conf || echo "Make sure you have /usr/local/lib/ in /etc/ld.so.conf.d/locallib.conf, otherwise builds may fail"
else
echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
sudo /sbin/ldconfig
fi
}
# Temporary workaround for 'Auto-connect failed with error code 1'
sudo mkdir -p /usr/local/share/toxic/DHTnodes
wget -T 4 -t 3 -O DHTnodes http://stupiddog.soupwhale.com/files/tox/dht/DHTnodes
sudo mv DHTnodes /usr/local/share/toxic/DHTnodes
# nurupo's Qt GUI (optional}
getqtgui() {
git clone --recursive https://github.com/nurupo/ProjectTox-Qt-GUI.git
cd ProjectTox-Qt-GUI
mkdir build && cd build
qmake -Wall ../projectfiles/QtCreator/TOX-Qt-GUI.pro
sudo make
sudo make install
sudo /sbin/ldconfig
cd ..
}
# Venom GUI (optional)
getvenom() {
#
# GResolverRecordType was added since glib version 2.34
# In case if glib is < 2.34, we have to use branch glib_2_32 when cloning Venom (git)
#
if [ "$(pkg-config --modversion glib-2.0 |cut -f2 -d.)" -lt "34" ]; then
git clone -b glib_2_32 https://github.com/naxuroqa/Venom.git
else
git clone https://github.com/naxuroqa/Venom.git
fi
cd Venom
mkdir build
cd build
#
# GResolverRecordType was added since glib version 2.34
# In case if glib is < 2.34, we have to use branch glib_2_32 when cloning Venom (git)
# And as long as GResolverRecordType is not used, we have to use djbdns
#
if [ "$(pkg-config --modversion glib-2.0 |cut -f2 -d.)" -lt "34" ]; then
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ -DDJBDNS_DIRECTORY="../../djbdns-1.05"
else
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake .. -DCMAKE_INSTALL_PREFIX=/usr/
fi
make
sudo make install
sudo /sbin/ldconfig
sudo wget -O /usr/share/applications/venom.desktop https://raw.github.com/naxuroqa/Venom/master/misc/venom.desktop.in
cd ..
}
get_distro_type() {
# Fedora / RHEL / CentOS / RedHat derivative
if [ -r /etc/yum.conf ]; then
echo "RHEL / derivative detected"
[ "$nodep" != "1" ] && {
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo yum groupinstall "Development Tools"
sudo yum install git-core libtool curl autoconf automake ffmpeg libconfig-devel ncurses-devel opusfile-devel opusfile libvpx libvpx-devel
}
exportlibpath && exlibpth=1
[ "$nolibsm" != "1" ] && getlibsodiumnc && gotlibsm=1
gettoxcorenc && gottcore=1
gettoxicnc && gottoxic=1
# SUSE
elif [ -r /etc/SuSE-release ]; then
echo "SuSE Linux / derivative detected"
[ "$nodep" != "1" ] && {
sudo zypper install ncurses-utils curl autoconf git ffmpeg libconfig-devel libconfig9 check libtool libavcodec55 libvpx libavdevice55 libavformat55 libswscale2 libopenal1 libSDL2-2_0-0 libopus0
sudo zypper install --type pattern devel_basis
}
[ "$nolibsm" != "1" ] && getlibsodium && gotlibsm=1
gettoxcore && gottcore=1
gettoxic && gottoxic=1
# Debian / Ubuntu / Mint / Debian derivative
elif [ -r /etc/apt ]; then
echo "Debian Linux / derivative detected"
sudo rm -rf /tmp/tox-update
mkdir -p /tmp/tox-update
cd /tmp/tox-update
[ "$nodep" != "1" ] && {
wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz
tar -xvzf libconfig-1.4.9.tar.gz
cd libconfig-1.4.9
./configure
make -j3
sudo make install
rm ../libconfig.tar.gz
}
[ "$nodep" != "1" ] && {
sudo apt-get install git curl build-essential libtool autotools-dev automake ncurses-dev checkinstall libavformat-dev libavdevice-dev libswscale-dev libsdl-dev libopenal-dev libopus-dev libvpx-dev check yasm valac cmake libgtk-3-dev libjson-glib-dev libsqlite3-dev
cd ..
}
#sudo rm -rf ./libconfig-1.4.9.tar.gz
#git clone https://github.com/FFmpeg/FFmpeg.git
#cd FFmpeg
#git checkout n2.0.2
#./configure --disable-programs
#sudo make && sudo make install
#cd ..
#
# GResolverRecordType was added since glib version 2.34
# In case if glib is < 2.34, we have to use branch glib_2_32 when cloning Venom (git)
# And as long as GResolverRecordType is not used, we have to use djbdns
#
if [ "$(pkg-config --modversion glib-2.0 |cut -f2 -d.)" -lt "34" ]; then
mkdir -p /tmp/tox-update
cd /tmp/tox-update
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
tar xvzf djbdns-1.05.tar.gz
cd djbdns-1.05/
echo "gcc -O2 -include /usr/include/errno.h" > conf-cc
make
make setup check
sudo /sbin/ldconfig
cd /tmp/tox-update
fi
[ "$nolibsm" != "1" ] && getlibsodium && gotlibsm=1
exportlibpath && exlibpth=1
gettoxcore && gottcore=1
gettoxic && gottoxic=1
getvenom && gotvenom=1
# Gentoo / Gentoo derivative
elif [ -r /etc/gentoo-release ]; then
echo "Gentoo Linux / derivative detected"
echo "If you run into problems with this script, refer to http://wiki.gentoo.org/wiki/Layman and report problems to notadecent or urras"
sudo emerge dev-vcs/git layman
sudo layman -f -o https://raw.github.com/fr0stycl34r/gentoo-overlay-tox/master/repository.xml -a tox-overlay
sudo layman -S
sudo emerge --sync
sudo emerge --autounmask-write virtual/ffmpeg
sudo emerge --autounmask-write dev-libs/libsodium
sudo emerge --autounmask-write net-libs/tox
sudo emerge --autounmask-write net-im/toxic
sudo echo u | sudo dispatch-conf
sudo emerge virtual/ffmpeg
sudo emerge dev-libs/libsodium
sudo emerge net-libs/tox
sudo emerge net-im/toxic
# Arch / Arch derivative
elif [ -r /etc/pacman.d/ ]; then
echo "Arch Linux / derivative detected"
[ "$nodep" != "1" ] && sudo pacman -S ncurses libconfig qt5-base git curl openal opus libvpx sdl libvorbis ffmpeg
[ "$nodep" != "1" ] && sudo pacman -S base-devel vala cmake gtk3 libgee # last 4 optional
[ "$nolibsm" != "1" ] && getlibsodiumnc && gotlibsm=1
exportlibpath && exlibpth=1
gettoxcorenc && gottcore=1
gettoxicnc && gottoxic=1
#getqtgui && gotqtgui=1
getvenom && gotvenom=1
# Other
else
echo "Unknown distro, install manually"
fi
}
# Detect GNU/Linux distribution/install dependencies for Tox/Toxic
# (no arguments passed)
get_distro_type
echo '
'
test "$exlibpth" == 1 && echo "Linked to headers in /usr/local/lib/"
test "$gotlibsm" == 1 && echo "Installed libsodium"
test "$gottcore" == 1 && echo "Installed toxcore"
test "$gottoxic" == 1 && echo "Installed toxic"
test "$gotqtgui" == 1 && echo "Installed nurupo's Qt GUI"
test "$gotvenom" == 1 && echo "Installed venom"
echo "Done"; exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment