Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Release mode
- REL="release"
- # Change this variable to suit your need
- VER="5.3.1"
- # My configuration options for qt change to your hearts content, but make sure to clean out your current build before using it.
- OPTS=""
- OPTS+=" -v" # Log some more
- OPTS+=" -opensource"
- OPTS+=" -static"
- OPTS+=" -confirm-license"
- #OPTS+=" -fully-process" #Breaks my build
- OPTS+=" -c++11"
- OPTS+=" -skip qtwebkit"
- OPTS+=" -largefile"
- #OPTS+=" -continue"
- OPTS+=" -silent"
- #OPTS+=" -optimized-qmake"
- #OPTS+=" -reduce-relocations"
- OPTS+=" -qpa xcb"
- #OPTS+=" -declarative"
- OPTS+=" -opengl"
- #OPTS+=" -svg" #INVALID SINCE 5.3
- OPTS+=" -qt-zlib" # ........... Use the zlib bundled with Qt.
- OPTS+=" -qt-libpng" # ......... Use the libpng bundled with Qt.
- OPTS+=" -qt-libjpeg" # ........ Use the libjpeg bundled with Qt.
- OPTS+=" -qt-freetype" # ....... Use the freetype bundled with Qt.
- OPTS+=" -qt-harfbuzz" # ....... Use the freetype bundled with Qt.
- OPTS+=" -qt-pcre" # ........... Use the PCRE library bundled with Qt.
- OPTS+=" -qt-xcb" # ............ Use xcb- libraries bundled with Qt.
- OPTS+=" -qt-xkbcommon" # ...... Use xkb libraries bundled with Qt.
- OPTS+=" -no-gtkstyle"
- OPTS+=" -no-sql-db2"
- OPTS+=" -no-sql-ibase"
- OPTS+=" -no-sql-mysql"
- OPTS+=" -no-sql-oci"
- OPTS+=" -no-sql-odbc"
- OPTS+=" -no-sql-psql"
- #OPTS+=" -no-sql-sqlite" # we want sqlite3 support
- OPTS+=" -no-sql-sqlite2"
- OPTS+=" -no-sql-tds"
- OPTS+=" -no-gif"
- OPTS+=" -no-nis"
- OPTS+=" -no-cups"
- OPTS+=" -no-iconv"
- OPTS+=" -no-dbus"
- OPTS+=" -no-eglfs"
- OPTS+=" -no-directfb"
- OPTS+=" -no-linuxfb"
- OPTS+=" -no-glib"
- OPTS+=" -no-kms"
- OPTS+=" -nomake examples"
- #OPTS+=" -nomake demos" NOT AVAILABLE ANYMORE
- OPTS+=" -nomake tests"
- #OPTS+=" -openssl-linked"
- #OPTS+=" -no-openssl"
- # The modules that are relevant for client. Please observe that THE ORDER MATTERS! I would add one module at the time and see how it complains when you try to build it.
- MODS=""
- MODS+=" qtbase"
- MODS+=" qtscript"
- MODS+=" qtxmlpatterns"
- MODS+=" qtsvg"
- MODS+=" qtimageformats"
- MODS+=" qtconnectivity"
- MODS+=" qtdeclarative"
- MODS+=" qtquick1"
- MODS+=" qtquickcontrols"
- MODS+=" qtdoc"
- MODS+=" qtlocation"
- MODS+=" qtsensors"
- MODS+=" qtserialport"
- MODS+=" qttranslations"
- MODS+=" qtx11extras"
- MODS+=" qtgraphicaleffects"
- MODS+=" qtmultimedia"
- #MODS+=" qttools"
- do_prep(){
- # Dependencies:
- local DEPS=""
- # Build tools
- DEPS+=" build-essential"
- DEPS+=" perl"
- DEPS+=" python"
- DEPS+=" git"
- # XCB/X11 support
- DEPS+=" ^libxcb.*"
- DEPS+=" libx11-xcb-dev"
- DEPS+=" libglu1-mesa-dev"
- DEPS+=" libxrender-dev"
- # Sound support
- DEPS+=" libasound2-dev"
- # Media support
- DEPS+=" libgstreamer0.10-dev"
- DEPS+=" libgstreamer-plugins-base0.10-dev"
- # XKB fixes for Qt5.4x
- DEPS+=" libxkbfile1"
- DEPS+=" x11-xkb-utils"
- DEPS+=" xkb-data"
- DEPS+=" libxkbfile-dev"
- # SQLite 3 support
- DEPS+=" libsqlite-dev"
- DEPS+=" libsqlite3-dev"
- # SSL/TLS Support
- DEPS+=" libssl-dev"
- DEPS+=" gnutls-dev"
- DEPS+=" libgnutls-dev"
- # DEPS+=" libgnutls-openssl-dev" # Not available on debian
- DEPS+=" libsslcommon2-dev"
- # OpenCV support (for bottle rig)
- DEPS+=" libopencv-calib3d-dev"
- DEPS+=" libopencv-contrib-dev"
- DEPS+=" libopencv-core-dev"
- DEPS+=" libopencv-dev"
- DEPS+=" libopencv-features2d-dev"
- DEPS+=" libopencv-flann-dev"
- DEPS+=" libopencv-gpu-dev"
- DEPS+=" libopencv-highgui-dev"
- DEPS+=" libopencv-imgproc-dev"
- DEPS+=" libopencv-legacy-dev"
- DEPS+=" libopencv-ml-dev"
- DEPS+=" libopencv-objdetect-dev"
- DEPS+=" libopencv-video-dev"
- sudo apt-get install $DEPS
- }
- do_dirs(){
- # Create dirs
- mkdir -p "$Q" || echo "error mkdir $Q"
- mkdir -p "$Q/xz" || echo "error mkdir $Q/xz"
- mkdir -p "$SRC" || echo "error mkdir $SRC"
- mkdir -p "$O" || echo "error mkdir $O"
- }
- do_vars(){
- # Release mode
- OPTS+=" -$REL"
- # Shortened version used when downloading
- VER2="${VER%.*}"
- # Current dir ( allows this script to be called from another dir)
- B=$(pwd)
- # Base folder for the whole operation
- Q="$B/qt"
- # The download source
- WSRC="http://download.qt-project.org/official_releases/qt/$VER2/$VER/single/qt-everywhere-opensource-src-$VER.tar.xz"
- # The tar.xz archive
- XZ="$Q/xz/qt-$VER.tar.xz"
- # The uncompressed source
- SRC="$Q/src/$VER"
- # The actual shadow dir
- O="$Q/build/$VER/$REL"
- # The log file
- LOG="$O/log.txt"
- # The complete commandline
- CMD="$@"
- # Paralelle make, number of cores
- J=$(grep -c ^processor /proc/cpuinfo)
- # echo out the current config
- echo "QT VERSION (VER): $VER"
- echo "CURRENT DIRECTORY (B): $B"
- echo "ENABLED MODULES (MODS): $MODS"
- echo "CONFIGURATION OPTIONS (OPTS): $OPTS"
- echo "BASE DIR (Q): $Q"
- echo "SHADOW DIR (O): $O"
- echo "SOURCE URL (WSRC): $WSRC"
- echo "COMPRESSED SOURCE ARCHIVE (XZ): $XZ"
- echo "UNCOMPRESSED SOURCE DIR (SRC): $SRC"
- echo "LOG: $LOG"
- echo "COMMANDLINE (CMD): $CMD"
- echo "PARALELLE PROCESSES (J): $J"
- }
- do_down(){
- # Download source archive
- [ ! -f $XZ ] && wget "$WSRC" -c -O "$XZ" >> "$LOG"
- # Unpack source archive
- [ ! -x $SRC/configure ] && tar pxf "$XZ" --strip=1 -C "$SRC" "qt-everywhere-opensource-src-$VER" >> "$LOG"
- }
- do_conf(){
- cd "$O"
- #OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'
- MAKEFLAGS=-j$J "$SRC/configure" -prefix "$O/qtbase" $OPTS >> "$LOG"
- # Configure modules with the new qmake
- for M in $MODS
- do
- echo "------------------------------------------ QMAKE MODULE: $M"
- D=$O/$M
- mkdir -p $D
- cd $D
- $O/qtbase/bin/qmake $SRC/$M/ >> "$LOG" 2>&1
- done
- }
- do_base(){
- # Build qtbase with new config (results in the basic qt libs plus a new qmake that you can use for building the rest of the modules and your own projects)
- cd "$O"
- make -j$J >> "$LOG" 2>&1
- }
- do_mod(){
- # Build your modules with the new qmake, keeping the resulting static libs in each module's shadow build folder where they will be located by qmke during compilation of your projects
- for M in $MODS
- do
- echo "------------------------------------------ MAKE MODULE: $M"
- D=$O/$M
- mkdir -p $D
- cd $D
- make -j$J >> "$LOG" 2>&1
- #make -j$J "module-$M">> "$LOG" 2>&1
- done
- }
- while [ "${1+defined}" ];
- do
- case $1 in
- -v* ) shift; VER="$1" ;;
- debug*) REL="debug" ;;
- prep* ) do_prep ;;
- vars* ) do_vars ;;
- dirs* ) do_dirs ;;
- down* ) do_down ;;
- conf* ) do_conf ;;
- base* ) do_base ;;
- mod* ) do_mod ;;
- *) echo "UNKNWON COMMAND: '$1', SKIPPING..." ;;
- esac
- shift
- done
- echo "DONE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement