Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.42 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Release mode
  4. REL="release"
  5.  
  6.  
  7. # Change this variable to suit your need
  8. VER="5.3.1"
  9.  
  10.  
  11. # My configuration options for qt change to your hearts content, but make sure to clean out your current build before using it.
  12. OPTS=""
  13. OPTS+=" -v" # Log some more
  14. OPTS+=" -opensource"
  15. OPTS+=" -static"
  16. OPTS+=" -confirm-license"
  17. #OPTS+=" -fully-process" #Breaks my build
  18. OPTS+=" -c++11"
  19. OPTS+=" -skip qtwebkit"
  20. OPTS+=" -largefile"
  21. #OPTS+=" -continue"
  22. OPTS+=" -silent"
  23. #OPTS+=" -optimized-qmake"
  24. #OPTS+=" -reduce-relocations"
  25. OPTS+=" -qpa xcb"
  26. #OPTS+=" -declarative"
  27. OPTS+=" -opengl"
  28. #OPTS+=" -svg" #INVALID SINCE 5.3
  29. OPTS+=" -qt-zlib" # ........... Use the zlib bundled with Qt.
  30. OPTS+=" -qt-libpng" # ......... Use the libpng bundled with Qt.
  31. OPTS+=" -qt-libjpeg" # ........ Use the libjpeg bundled with Qt.
  32. OPTS+=" -qt-freetype" # ....... Use the freetype bundled with Qt.
  33. OPTS+=" -qt-harfbuzz" # ....... Use the freetype bundled with Qt.
  34. OPTS+=" -qt-pcre" # ........... Use the PCRE library bundled with Qt.
  35. OPTS+=" -qt-xcb" # ............ Use xcb- libraries bundled with Qt.
  36. OPTS+=" -qt-xkbcommon" # ...... Use xkb libraries bundled with Qt.
  37. OPTS+=" -no-gtkstyle"
  38. OPTS+=" -no-sql-db2"
  39. OPTS+=" -no-sql-ibase"
  40. OPTS+=" -no-sql-mysql"
  41. OPTS+=" -no-sql-oci"
  42. OPTS+=" -no-sql-odbc"
  43. OPTS+=" -no-sql-psql"
  44. #OPTS+=" -no-sql-sqlite"  # we want sqlite3 support
  45. OPTS+=" -no-sql-sqlite2"
  46. OPTS+=" -no-sql-tds"
  47. OPTS+=" -no-gif"
  48. OPTS+=" -no-nis"
  49. OPTS+=" -no-cups"
  50. OPTS+=" -no-iconv"
  51. OPTS+=" -no-dbus"
  52. OPTS+=" -no-eglfs"
  53. OPTS+=" -no-directfb"
  54. OPTS+=" -no-linuxfb"
  55. OPTS+=" -no-glib"
  56. OPTS+=" -no-kms"
  57. OPTS+=" -nomake examples"
  58. #OPTS+=" -nomake demos" NOT AVAILABLE ANYMORE
  59. OPTS+=" -nomake tests"
  60. #OPTS+=" -openssl-linked"
  61. #OPTS+=" -no-openssl"
  62.  
  63. # 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.
  64.  
  65. MODS=""
  66. MODS+=" qtbase"
  67. MODS+=" qtscript"
  68. MODS+=" qtxmlpatterns"
  69. MODS+=" qtsvg"
  70. MODS+=" qtimageformats"
  71. MODS+=" qtconnectivity"
  72. MODS+=" qtdeclarative"
  73. MODS+=" qtquick1"
  74. MODS+=" qtquickcontrols"
  75. MODS+=" qtdoc"
  76. MODS+=" qtlocation"
  77. MODS+=" qtsensors"
  78. MODS+=" qtserialport"
  79. MODS+=" qttranslations"
  80. MODS+=" qtx11extras"
  81. MODS+=" qtgraphicaleffects"
  82. MODS+=" qtmultimedia"
  83.  
  84. #MODS+=" qttools"
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. do_prep(){
  92.     # Dependencies:
  93.     local DEPS=""
  94.     # Build tools
  95.     DEPS+=" build-essential"
  96.     DEPS+=" perl"
  97.     DEPS+=" python"
  98.     DEPS+=" git"
  99.     # XCB/X11 support
  100.     DEPS+=" ^libxcb.*"
  101.     DEPS+=" libx11-xcb-dev"
  102.     DEPS+=" libglu1-mesa-dev"
  103.     DEPS+=" libxrender-dev"
  104.     # Sound support
  105.     DEPS+=" libasound2-dev"
  106.     # Media support
  107.     DEPS+=" libgstreamer0.10-dev"
  108.     DEPS+=" libgstreamer-plugins-base0.10-dev"
  109.     # XKB fixes for Qt5.4x
  110.     DEPS+=" libxkbfile1"
  111.     DEPS+=" x11-xkb-utils"
  112.     DEPS+=" xkb-data"
  113.     DEPS+=" libxkbfile-dev"
  114.     # SQLite 3 support
  115.     DEPS+=" libsqlite-dev"
  116.     DEPS+=" libsqlite3-dev"
  117.     # SSL/TLS Support
  118.     DEPS+=" libssl-dev"
  119.     DEPS+=" gnutls-dev"
  120.     DEPS+=" libgnutls-dev"
  121. #   DEPS+=" libgnutls-openssl-dev" # Not available on debian
  122.     DEPS+=" libsslcommon2-dev"
  123.     # OpenCV support (for bottle rig)
  124.     DEPS+=" libopencv-calib3d-dev"
  125.     DEPS+=" libopencv-contrib-dev"
  126.     DEPS+=" libopencv-core-dev"
  127.     DEPS+=" libopencv-dev"
  128.     DEPS+=" libopencv-features2d-dev"
  129.     DEPS+=" libopencv-flann-dev"
  130.     DEPS+=" libopencv-gpu-dev"
  131.     DEPS+=" libopencv-highgui-dev"
  132.     DEPS+=" libopencv-imgproc-dev"
  133.     DEPS+=" libopencv-legacy-dev"
  134.     DEPS+=" libopencv-ml-dev"
  135.     DEPS+=" libopencv-objdetect-dev"
  136.     DEPS+=" libopencv-video-dev"
  137.     sudo apt-get install $DEPS
  138. }
  139.  
  140.  
  141.  
  142. do_dirs(){
  143.     # Create dirs
  144.     mkdir -p "$Q"  ||       echo "error mkdir $Q"
  145.     mkdir -p "$Q/xz" ||     echo "error mkdir $Q/xz"
  146.     mkdir -p "$SRC" ||      echo "error mkdir $SRC"
  147.     mkdir -p "$O" ||        echo "error mkdir $O"
  148. }
  149.  
  150. do_vars(){
  151.     # Release mode
  152.     OPTS+=" -$REL"
  153.     # Shortened version used when downloading
  154.     VER2="${VER%.*}"
  155.     # Current dir ( allows this script to be called from another dir)
  156.     B=$(pwd)
  157.     # Base folder for the whole operation
  158.     Q="$B/qt"
  159.     # The download source
  160.     WSRC="http://download.qt-project.org/official_releases/qt/$VER2/$VER/single/qt-everywhere-opensource-src-$VER.tar.xz"
  161.     # The tar.xz archive
  162.     XZ="$Q/xz/qt-$VER.tar.xz"
  163.     # The uncompressed source
  164.     SRC="$Q/src/$VER"
  165.     # The actual shadow dir
  166.     O="$Q/build/$VER/$REL"
  167.     # The log file
  168.     LOG="$O/log.txt"
  169.     # The complete commandline
  170.     CMD="$@"
  171.     # Paralelle make, number of cores
  172.     J=$(grep -c ^processor /proc/cpuinfo)
  173.    
  174.    
  175.     # echo out the current config
  176.     echo "QT VERSION (VER): $VER"
  177.     echo "CURRENT DIRECTORY (B): $B"
  178.     echo "ENABLED MODULES (MODS): $MODS"
  179.     echo "CONFIGURATION OPTIONS (OPTS): $OPTS"
  180.     echo "BASE DIR (Q): $Q"
  181.     echo "SHADOW DIR (O): $O"
  182.     echo "SOURCE URL (WSRC): $WSRC"
  183.     echo "COMPRESSED SOURCE ARCHIVE (XZ): $XZ"
  184.     echo "UNCOMPRESSED SOURCE DIR (SRC): $SRC"
  185.     echo "LOG: $LOG"
  186.     echo "COMMANDLINE (CMD): $CMD"
  187.     echo "PARALELLE PROCESSES (J): $J"
  188. }
  189.  
  190.  
  191.  
  192. do_down(){
  193.     # Download source archive
  194.     [ ! -f $XZ ] && wget "$WSRC" -c -O "$XZ" >> "$LOG"
  195.     # Unpack source archive
  196.     [ ! -x $SRC/configure ] && tar pxf "$XZ" --strip=1 -C "$SRC" "qt-everywhere-opensource-src-$VER" >> "$LOG"
  197. }
  198.  
  199.  
  200. do_conf(){
  201.     cd "$O"
  202.     #OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'
  203.     MAKEFLAGS=-j$J  "$SRC/configure" -prefix "$O/qtbase" $OPTS >> "$LOG"
  204.    
  205.     # Configure modules with the new qmake
  206.     for M in $MODS
  207.     do
  208.         echo "------------------------------------------ QMAKE MODULE: $M"
  209.         D=$O/$M
  210.         mkdir -p $D
  211.         cd $D
  212.         $O/qtbase/bin/qmake $SRC/$M/ >> "$LOG" 2>&1
  213.     done
  214. }
  215.  
  216.  
  217. do_base(){
  218.     # 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)
  219.     cd "$O"
  220.     make -j$J >> "$LOG" 2>&1
  221. }
  222.  
  223.  
  224. do_mod(){
  225.     # 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
  226.     for M in $MODS
  227.     do
  228.         echo "------------------------------------------ MAKE MODULE: $M"
  229.         D=$O/$M
  230.         mkdir -p $D
  231.         cd $D
  232.         make -j$J >> "$LOG" 2>&1
  233.         #make -j$J "module-$M">> "$LOG" 2>&1
  234.     done
  235. }
  236.  
  237. while [ "${1+defined}" ];
  238. do
  239.     case $1 in
  240.         -v* ) shift; VER="$1" ;;
  241.         debug*) REL="debug" ;;
  242.         prep* )  do_prep ;;
  243.         vars* )  do_vars ;;
  244.         dirs* )  do_dirs ;;
  245.         down* )  do_down ;;
  246.         conf* )  do_conf ;;
  247.         base* )  do_base ;;
  248.         mod* )   do_mod  ;;
  249.         *) echo "UNKNWON COMMAND: '$1', SKIPPING..."    ;;
  250.     esac
  251.     shift
  252. done
  253.  
  254.  
  255. echo "DONE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement