downloadAndBuildAll.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. SCRIPT_DIR=$PWD
  31. cd $CURRENT_DIR
  32. function usage {
  33. echo -e "\n"
  34. echo "Script for Qt for tizen compilation. "
  35. echo "Set Parameters or environment variables with absolute paths"
  36. echo ""
  37. echo "Usage:"
  38. echo "[MAKE_THREADS=numberOfCPUCores] [QT5SRCDIR=Qt5SrcPath] [INSTALLDIR=QtInstallPrefix] ./downloadAndBuildAll.sh"
  39. echo ""
  40. echo "QT5SRCDIR - directory with qt5 sources"
  41. echo "INSTALLDIR - here qmake and other host binaries will be installed"
  42. echo "CROSS_COMPILER - absolute path to Tizen cross compiler"
  43. echo "QT_TIZEN_DEVICE_MKSPEC - Qt tizen device mkspec"
  44. echo "TARGET_ARCH - arch (i386,armv7l)"
  45. echo "If corresponding environment variables are set then script can be invoked without parameters"
  46. echo "set MAKE_THREADS environment variable to number of your CPU cores to fast up compilation step"
  47. echo ""
  48. cd $CURRENT_DIR
  49. exit;
  50. }
  51. if [ "$1" == "-h" -o "$1" == "--help" ]; then
  52. usage
  53. fi
  54. if [ "$QT5SRCDIR" == "" ]; then
  55. QT5SRCDIR=$PWD/qt5.gitorious
  56. echo "Setting QT5SRCDIR to $QT5SRCDIR"
  57. fi
  58. if [ "$INSTALLDIR" == "" ]; then
  59. INSTALLDIR=$PWD/qt5hostInstall
  60. echo "Setting INSTALLDIR to $INSTALLDIR"
  61. fi
  62. if [ "$TARGET_ARCH" == "" ]; then
  63. echo "TARGET_ARCH variable undefined"
  64. usage
  65. fi
  66. if [ "$QT5SRCDIR" == "$PWD/qt5.gitorious" ]; then
  67. if [ ! -d qt5.gitorious ]; then
  68. mkdir qt5.gitorious
  69. cd qt5.gitorious
  70. $PWD/../../scripts/clone_or_update_tizen_repos
  71. cd ..
  72. else
  73. echo "Looks like qt5.gitorious directory exists"
  74. fi;
  75. fi;
  76. mkdir -p buildQt5/qtbase
  77. cd buildQt5/qtbase
  78. echo "================================================="
  79. echo "Configuration:"
  80. echo "QT5SRCDIR=$QT5SRCDIR"
  81. echo "INSTALLDIR=$INSTALLDIR"
  82. echo "CROSS_COMPILER=$CROSS_COMPILER"
  83. echo "QT_TIZEN_DEVICE_MKSPEC=$QT_TIZEN_DEVICE_MKSPEC"
  84. echo "================================================="
  85. if [ "$CROSS_COMPILER" == "" ]; then
  86. echo "You must set CROSS_COMPILER variable"
  87. exit 1
  88. fi
  89. if [ "$QT_TIZEN_DEVICE_MKSPEC" == "" ]; then
  90. echo "You must set QT_TIZEN_DEVICE_MKSPEC variable"
  91. exit 1
  92. fi
  93. TIZENSYSROOT=$CURRENT_DIR/GBS-ROOT-CROSSCOMPILE/local/BUILD-ROOTS/scratch.$TARGET_ARCH.0
  94. export PKG_CONFIG_LIBDIR=$TIZENSYSROOT/usr/lib
  95. export PKG_CONFIG_SYSROOT_DIR=$TIZENSYSROOT
  96. export PKG_CONFIG_PATH=$TIZENSYSROOT/usr/lib/pkgconfig
  97. $QT5SRCDIR/qtbase/configure --disable-static -no-rpath -confirm-license -opensource -no-warnings-are-errors -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 -device $QT_TIZEN_DEVICE_MKSPEC -device-option CROSS_COMPILE=$CROSS_COMPILER -no-widgets -qpa xcb -qt-xcb -no-eglfs -sysroot $TIZENSYSROOT -hostprefix $INSTALLDIR -opengl es2 -extprefix $INSTALLDIR
  98. MAKE_ARGS=""
  99. if [ "$MAKE_THREADS" != "" ]; then
  100. echo "setting make thread"
  101. MAKE_ARGS="-j $MAKE_THREADS"
  102. fi
  103. echo =======================
  104. echo building qtbase: make $MAKE_ARGS
  105. echo =======================
  106. make $MAKE_ARGS
  107. echo Installing qtbase: make install $MAKE_ARGS
  108. make install $MAKE_ARGS
  109. cd ..
  110. #without qtbase
  111. parts="qtxmlpatterns qtgraphicaleffects qtimageformats qtdeclarative qtquickcontrols qtquickcontrols-tizen qtsensors qttools"
  112. for repo in $parts; do
  113. echo =======================
  114. echo building $repo: make $MAKE_ARGS
  115. echo =======================
  116. mkdir -p $repo
  117. cd $repo
  118. $INSTALLDIR/bin/qmake $QT5SRCDIR/$repo
  119. make $MAKE_ARGS
  120. echo Installing qtbase: make install $MAKE_ARGS
  121. make install $MAKE_ARGS
  122. cd ..
  123. done
  124. cd $CURRENT_DIR