Last active
July 3, 2021 12:23
-
-
Save notsure2/e3c3ec6897f801d00cf491fedb70bf4d to your computer and use it in GitHub Desktop.
How to compile latest qBittorrent-nox with static qt, boost and openssl for Ubuntu 16.04 xenial (using Ubuntu 16.04 xenial)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
apt update -y | |
apt install -y build-essential git perl python2.7 python2.7-dev zlib1g-dev autoconf libicu-dev pkg-config perl ccache | |
OPENSSL_TAG=OpenSSL_1_1_1-stable | |
QBITTORRENT_TAG=v4_2_x | |
LIBTORRENT_TAG=RC_1_2 | |
QT5_TAG=5.14 | |
BOOST_VER=1.72.0 | |
BOOST_BUILD_TAG=boost-$BOOST_VER | |
PATH=/usr/lib/ccache:$PATH | |
rm -rf work | |
mkdir work | |
cd work | |
git clone https://github.com/openssl/openssl.git --branch $OPENSSL_TAG --single-branch --depth 1 | |
cd openssl | |
./config | |
make -j${nproc} | |
cd .. | |
if ! [ -f "/usr/local/lib/libboost_system.so.$BOOST_VER" ]; then | |
git clone --recursive --single-branch --branch boost-$BOOST_VER --depth=1 -j$(nproc) --shallow-submodules https://github.com/boostorg/boost.git | |
cd boost | |
./bootstrap.sh | |
./b2 link=static cxxflags=-std=c++14 install | |
cd .. | |
fi; | |
if ! [ -f "/usr/local/bin/b2" ]; then | |
git clone https://github.com/boostorg/build.git --branch $BOOST_BUILD_TAG --single-branch --depth 1 | |
cd build | |
./bootstrap.sh | |
./b2 cxxflags=-std=c++14 install | |
cd .. | |
fi; | |
git clone https://github.com/qt/qtbase.git --branch $QT5_TAG --single-branch --depth 1 | |
cd qtbase | |
./configure -static -openssl-linked -opensource \ | |
-I`pwd`/../openssl/include -L`pwd`/../openssl \ | |
-confirm-license -c++std 14 -no-opengl -no-dbus -no-widgets -no-gui -no-compile-examples \ | |
-prefix `pwd`/../../qt-qbittorrent | |
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 .. | |
# Patch the newly compiled qt to make it static link openssl | |
sed -i "s/-lssl -lcrypto/-l:libssl.a -l:libcrypto.a/" `pwd`/../qt-qbittorrent/lib/libQt5Network.prl | |
sed -i "s/;-lssl;-lcrypto/;-l:libssl.a;-l:libcrypto.a/" `pwd`/../qt-qbittorrent/lib/libQt5Network.prl | |
sed -i "s/-lssl -lcrypto/-l:libssl.a -l:libcrypto.a/" `pwd`/../qt-qbittorrent/plugins/bearer/libqgenericbearer.prl | |
sed -i "s/;-lssl;-lcrypto/;-l:libssl.a;-l:libcrypto.a/" `pwd`/../qt-qbittorrent/plugins/bearer/libqgenericbearer.prl | |
sed -i "s/-lssl -lcrypto/-l:libssl.a -l:libcrypto.a/" `pwd`/../qt-qbittorrent/lib/pkgconfig/Qt5Network.pc | |
sed -i "s/-lssl -lcrypto/-l:libssl.a -l:libcrypto.a/" `pwd`/../qt-qbittorrent/mkspecs/modules/qt_lib_network_private.pri | |
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 \ | |
openssl-lib=`pwd`/../openssl openssl-include=`pwd`/../openssl/include | |
cd .. | |
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:libboost_system.a" \ | |
CXXFLAGS="-std=c++14" \ | |
libtorrent_CFLAGS="-I`pwd`/../libtorrent/include" \ | |
libtorrent_LIBS="-L`pwd`/../libtorrent/bin/gcc-5.4.0/release/crypto-openssl/link-static/threading-multi -l:libtorrent.a" \ | |
openssl_CFLAGS="-I`pwd`/../openssl/include" \ | |
openssl_LIBS="-L`pwd`/../openssl -l:libssl.a -l:libcrypto.a" \ | |
./configure --disable-gui --disable-qt-dbus | |
sed -i 's/-lboost_system//' conf.pri | |
make -j$(nproc) | |
strip src/qbittorrent-nox | |
cd ../.. | |
cp ./work/qBittorrent/src/qbittorrent-nox . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment