From 3dcbe0434dddb874bdef742da54196f2d755bced Mon Sep 17 00:00:00 2001 From: Mike Tzou Date: Mon, 23 Oct 2017 23:07:44 +0800 Subject: [PATCH] Updated Compilation guide for macOS systems (markdown) --- Compilation-guide-for-macOS-systems.md | 131 +++++++++++++++---------- 1 file changed, 80 insertions(+), 51 deletions(-) diff --git a/Compilation-guide-for-macOS-systems.md b/Compilation-guide-for-macOS-systems.md index c00fbbb..3466003 100644 --- a/Compilation-guide-for-macOS-systems.md +++ b/Compilation-guide-for-macOS-systems.md @@ -2,79 +2,108 @@ A full installation of Xcode.app is required to compile qt5.
Xcode can be installed from the [App Store](http://www.apple.com/osx/apps/app-store/).
-After installing Xcode you need to do below. See [this discussion](http://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-t). +After installing Xcode you need to do below. See [this discussion](https://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-t). -`sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer` - -`(cd /Applications/Xcode.app/Contents/Developer/usr/bin; sudo ln -s xcodebuild xcrun)` +```shell +sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer +(cd /Applications/Xcode.app/Contents/Developer/usr/bin; sudo ln -s xcodebuild xcrun) +``` # Install Homebrew -See [Install Homebrew](http://brew.sh/). +https://brew.sh/ # Install tools and dependencies -`brew install pkg-config autoconf automake libtool openssl boost` +```shell +brew install pkg-config autoconf automake libtool openssl boost +``` -If you want to use libtorrent 1.1.*, you need to do
-`brew link libtool` +If you want to use libtorrent 1.1.*, you need to do: +```shell +brew link libtool +``` -# Install [libtorrent-rasterbar](https://github.com/arvidn/libtorrent) from source -`git clone https://github.com/arvidn/libtorrent.git` +# Install [libtorrent-rasterbar](https://github.com/arvidn/libtorrent) +## From brew +```shell +brew install libtorrent-rasterbar +``` -`cd libtorrent` +## From source +```shell +git clone https://github.com/arvidn/libtorrent.git +cd libtorrent -libtorrent 1.0.*
-`git checkout RC_1_0`
-Or libtorrent 1.1.*
-`git checkout RC_1_1` +# use libtorrent 1.0.* +git checkout RC_1_0 +# or libtorrent 1.1.* +git checkout RC_1_1 -`./autotool.sh` +./autotool.sh +``` -Edit the src/Makefile.in file. Find the libtorrent_rasterbar_la_LIBADD = line and add `@OPENSSL_LDFLAGS@` before `@OPENSSL_LIBS@`.
-`sed -i “” -e "s/^\(libtorrent_rasterbar_la_LIBADD\)\(.*\)\(@OPENSSL_LIBS@\)/\1\2@OPENSSL_LDFLAGS@ \3/" src/Makefile.in` +Edit the src/Makefile.in file. Find the libtorrent_rasterbar_la_LIBADD = line and add `@OPENSSL_LDFLAGS@` before `@OPENSSL_LIBS@`: +```shell +sed -i “” -e "s/^\(libtorrent_rasterbar_la_LIBADD\)\(.*\)\(@OPENSSL_LIBS@\)/\1\2@OPENSSL_LDFLAGS@ \3/" src/Makefile.in +``` -`./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --enable-encryption --prefix=/usr/local --with-boost=/usr/local/opt/boost --with-openssl=/usr/local/opt/openssl CXXFLAGS=-std=c++11`
+Then +```shell +./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --enable-encryption --prefix=/usr/local --with-boost=/usr/local/opt/boost --with-openssl=/usr/local/opt/openssl CXXFLAGS=-std=c++11 +make -j2 # where 2 is your number of cores +make install +``` -`make -j4` where 4 is your number of cores +# Install qt5 +## From brew +```shell +brew install qt +``` -`make install` +## From source +```shell +curl -L -O https://download.qt.io/official_releases/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.1.tar.xz +tar -xvf qt-everywhere-opensource-src-5.7.1.tar.xz +cd qt-everywhere-opensource-src-5.7.1 +``` -# Install qt5 from source -`curl -L -O https://download.qt.io/official_releases/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.1.tar.xz` +Apply [this patch](https://github.com/Homebrew/homebrew-core/issues/3219#issuecomment-235820697): +```shell +curl https://github.com/okeatime/qBittorrent/releases/download/depend.tar.ball/macdeployqt.patch | patch -p1 +``` -`tar xvf qt-everywhere-opensource-src-5.7.1.tar.xz` - -`cd qt-everywhere-opensource-src-5.7.1` - -Apply [this patch](https://github.com/Homebrew/homebrew-core/issues/3219#issuecomment-235820697).
-`curl https://github.com/okeatime/qBittorrent/releases/download/depend.tar.ball/macdeployqt.patch | patch -p1` - -`OPENSSL_LIBS='-L/usr/local/opt/openssl/lib -lssl -lcrypto' ./configure -prefix /usr/local/qt5.7.1 -I/usr/local/opt/openssl/include -no-rpath -opensource -confirm-license -release -openssl-linked -no-securetransport -make libs -make tools -nomake examples -nomake tests -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtdeclarative -skip qtdoc -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtscript -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -skip qtwebview -skip qtwebengine -skip qtconnectivity -v` - -`make -j4 && sudo make install` +```shell +OPENSSL_LIBS='-L/usr/local/opt/openssl/lib -lssl -lcrypto' ./configure -prefix /usr/local/qt5.7.1 -I/usr/local/opt/openssl/include -no-rpath -opensource -confirm-license -release -openssl-linked -no-securetransport -make libs -make tools -nomake examples -nomake tests -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtdeclarative -skip qtdoc -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtscript -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -skip qtwebview -skip qtwebengine -skip qtconnectivity -v +make -j2 && sudo make install +``` # Download qBittorrent source - - 1. Clone from GitHub: `git clone https://github.com/qbittorrent/qBittorrent.git` - 2. Optional: Download the [geoip dat](http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz) file and extract it to qbittorrent's src/gui/geoip folder using gzip or a similar tool. +Clone from GitHub: +```shell +git clone https://github.com/qbittorrent/qBittorrent.git +``` -# Compilation +# Compile qBittorrent ## With Autotools -* Set environment variable: `export QT_QMAKE=/usr/local/qt5.7.1/bin` -* Configuration: `./configure` -* Compilation: `make -j4` -* Packaging: `$QT_QMAKE/macdeployqt src/qbittorrent.app` (may require sudo) -* Or packaging and create DMG: `$QT_QMAKE/macdeployqt src/qbittorrent.app -dmg` (may require sudo) +```shell +export QT_QMAKE=/usr/local/qt5.7.1/bin +./configure +make -j2 +$QT_QMAKE/macdeployqt src/qbittorrent.app -dmg +``` ## With CMake -* `mkdir build` -* `cd build` -* `OPENSSL_ROOT_DIR=/usr/local/opt/openssl Qt5_DIR=/usr/local/qt5.7.1/lib/cmake/Qt5 cmake -DDBUS=OFF ..` -* `make -j4` -* `/usr/local/qt5.7.1/bin/macdeployqt src/app/qbittorrent.app` +```shell +mkdir build && cd build +OPENSSL_ROOT_DIR=/usr/local/opt/openssl Qt5_DIR=/usr/local/qt5.7.1/lib/cmake/Qt5 cmake -DDBUS=OFF .. +make -j2 +/usr/local/qt5.7.1/bin/macdeployqt src/app/qbittorrent.app +``` # Optionally install python for the search function -You can choose python2 or python3. +```shell +# use python3 +brew install python3 -`brew install python`
-or
-`brew install python3` \ No newline at end of file +# or python2 +brew install python +```