downloadAndBuildAll.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. # Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
  3. # All rights reserved.
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. # 1. Redistributions of source code must retain the copyright
  8. # notice, this list of conditions and the following disclaimer.
  9. # 2. Redistributions in binary form must reproduce the copyright
  10. # notice, this list of conditions and the following disclaimer in the
  11. # documentation and/or other materials provided with the distribution.
  12. # 3. The name of the author may not be used to endorse or promote products
  13. # derived from this software without specific prior written permission.
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  18. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. #
  26. set -e
  27. CURRENT_DIR=$(pwd)
  28. SCRIPT_DIR=$(dirname $0)
  29. cd $SCRIPT_DIR
  30. function usage {
  31. echo -e "\n"
  32. echo "Script for Qt for tizen compilation. "
  33. echo "Set Parameters or environment variables with absolute paths"
  34. echo ""
  35. echo "Usage:"
  36. echo "sudo [MAKE_THREADS=numberOfCPUCores] [QT5SRCDIR=Qt5SrcPath] [INSTALLDIR=QtInstallPrefix] ./downloadAndBuildAll.sh"
  37. echo ""
  38. echo "QT5SRCDIR - directory with qt5 sources"
  39. echo "INSTALLDIR - here qmake and other host binaries will be installed"
  40. echo "If corresponding environment variables are set then script can be invoked without parameters"
  41. echo "set MAKE_THREADS environment variable to number of your CPU cores to fast up compilation step"
  42. echo ""
  43. cd $CURRENT_DIR
  44. exit;
  45. }
  46. if [ "$1" == "-h" -o "$1" == "--help" ]; then
  47. usage
  48. fi
  49. if [ "$QT5SRCDIR" == "" ]; then
  50. QT5SRCDIR=$PWD/qt5.gitorious
  51. echo "Setting QT5SRCDIR to $QT5SRCDIR"
  52. fi
  53. if [ "$INSTALLDIR" == "" ]; then
  54. INSTALLDIR=$PWD/qt5hostInstall
  55. echo "Setting INSTALLDIR to $INSTALLDIR"
  56. fi
  57. if [ "$QT5SRCDIR" == "$PWD/qt5.gitorious" ]; then
  58. if [ ! -d qt5.gitorious ]; then
  59. mkdir qt5.gitorious
  60. else
  61. echo "Looks like qt5.gitorious directory exists"
  62. fi;
  63. cd qt5.gitorious
  64. $PWD/../../scripts/clone_or_update_tizen_repos
  65. cd ..
  66. fi;
  67. if [ "$INSTALLDIR" == "$PWD/qt5hostInstall" ]; then
  68. echo "removing default installation directory: $INSTALLDIR"
  69. rm -rf $INSTALLDIR
  70. fi
  71. rm -rf buildQt5 qt5hostInstall
  72. mkdir -p buildQt5/qtbase
  73. cd buildQt5/qtbase
  74. echo "================================================="
  75. echo "Configuration:"
  76. echo "QT5SRCDIR=$QT5SRCDIR"
  77. echo "INSTALLDIR=$INSTALLDIR"
  78. echo "================================================="
  79. $QT5SRCDIR/qtbase/configure --disable-static -confirm-license -opensource -no-warnings-are-errors -prefix $INSTALLDIR -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -plugin-sql-sqlite -no-sql-sqlite2 -no-sql-tds -nomake tests -nomake examples -verbose
  80. MAKE_ARGS=""
  81. if [ "$MAKE_THREADS" != "" ]; then
  82. echo "setting make thread"
  83. MAKE_ARGS="-j $MAKE_THREADS"
  84. fi
  85. echo =======================
  86. echo building qtbase: make $MAKE_ARGS
  87. echo =======================
  88. make $MAKE_ARGS
  89. echo Installing qtbase: make install $MAKE_ARGS
  90. make install $MAKE_ARGS
  91. cd ..
  92. #without qtbase
  93. parts="qtxmlpatterns qtgraphicaleffects qtimageformats qtdeclarative qtquickcontrols qtquickcontrols-tizen qtsensors qttools qtmultimedia"
  94. for repo in $parts; do
  95. echo =======================
  96. echo building $repo: make $MAKE_ARGS
  97. echo =======================
  98. mkdir -p $repo
  99. cd $repo
  100. $INSTALLDIR/bin/qmake $QT5SRCDIR/$repo
  101. make $MAKE_ARGS
  102. echo Installing qtbase: make install $MAKE_ARGS
  103. make install $MAKE_ARGS
  104. cd ..
  105. done
  106. cd $CURRENT_DIR