Skip to content

Instantly share code, notes, and snippets.

@Darksonn
Created February 2, 2020 08:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Darksonn/4b901af3a85e0e9724ab8aa41a96aef5 to your computer and use it in GitHub Desktop.
Save Darksonn/4b901af3a85e0e9724ab8aa41a96aef5 to your computer and use it in GitHub Desktop.
Staticly link qbittorrent v4.1.9.1
#!/bin/bash
set -e
QBITTORRENT_TAG=release-4.1.9.1
LIBTORRENT_TAG=RC_1_1
QT5_TAG=5.12
BOOST_VER=1.69.0
BOOST_BUILD_TAG=boost-$BOOST_VER
rm -rf work
mkdir work
cd work
export LIBRARY_PATH=`pwd`/qt-qbittorrent
BOOST_FILE_NAME="boost_${BOOST_VER//./_}.tar.gz"
wget https://dl.bintray.com/boostorg/release/$BOOST_VER/source/$BOOST_FILE_NAME
tar xzf $BOOST_FILE_NAME
cd boost_${BOOST_VER//./_}
./bootstrap.sh --prefix=$LIBRARY_PATH
./b2 link=static cxxflags=-std=c++14 install
cd ..
git clone https://github.com/boostorg/build.git --branch $BOOST_BUILD_TAG --single-branch --depth 1
cd build
./bootstrap.sh
./b2 link=static cxxflags=-std=c++14 install --prefix=$LIBRARY_PATH
cd ..
git clone https://github.com/qt/qtbase.git --branch $QT5_TAG --single-branch --depth 1
cd qtbase
./configure -static -openssl-linked -opensource \
-confirm-license -c++std 14 -no-compile-examples \
-prefix $LIBRARY_PATH
make -j$(nproc)
make install
cd ..
PATH="`pwd`/qt-qbittorrent/bin:$PATH"
git clone https://github.com/qt/qttools.git --branch $QT5_TAG --single-branch --depth 1
cd qttools
qmake
make -j$(nproc)
make install
cd ..
git clone https://github.com/qt/qtsvg.git --branch $QT5_TAG --single-branch --depth 1
cd qtsvg
qmake
make -j$(nproc)
make install
cd ..
git clone https://github.com/arvidn/libtorrent.git --branch $LIBTORRENT_TAG --single-branch --depth 1
cd libtorrent
b2 link=static variant=release boost-link=static dht=on encryption=on crypto=openssl i2p=on extensions=on cxxflags=-std=c++14
cd ..
cp $(find -name libtorrent.a) qt-qbittorrent/lib
git clone https://github.com/qbittorrent/qBittorrent.git --branch $QBITTORRENT_TAG --single-branch --depth 1
cd qBittorrent
QT_QMAKE=`pwd`/../qt-qbittorrent/bin \
LDFLAGS="-L`pwd`/../qt-qbittorrent/lib -l:libboost_system.a" \
CXXFLAGS="-std=c++14" \
libtorrent_CFLAGS="-I`pwd`/../libtorrent/include" \
libtorrent_LIBS="-L`pwd`/../qt-qbittorrent/lib -ltorrent" \
./configure
sed -i 's/-lboost_system//' conf.pri
make -j$(nproc)
cd ../..
cp ./work/qBittorrent/src/qbittorrent .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment