build_and_deploy_tizen_plugin.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. CURDIR=$PWD
  3. SCRIPT_DIR=$( cd $(dirname $0) ; pwd -P )
  4. cd $SCRIPT_DIR
  5. set -e
  6. if [ -z "$QTC_BUILD" ]; then
  7. echo "undefined QTC_BUILD environment variable"
  8. exit 1;
  9. fi
  10. export DISPLAY=:0
  11. QT_CREATOR_VERSION_OUTPUT=$("$QTC_BUILD"/bin/qtcreator -version 2>&1)
  12. QT_CREATOR_VERSION=$(echo $QT_CREATOR_VERSION_OUTPUT | grep -o "Qt Creator [0-9][0-9\.]*" | grep -o "[0-9\.]*")
  13. QT_CREATOR_QT_VERSION=$(echo $QT_CREATOR_VERSION_OUTPUT | grep -o "based on Qt [0-9][0-9\.]*" | grep -o "[0-9\.]*")
  14. QT_CREATOR_QT_MAJOR_VERSION=$(echo $QT_CREATOR_QT_VERSION | cut -d . -f1)
  15. QMAKE_QT_PATH_VERSION=$(qmake -version | grep -o "Using Qt version [0-9\.]*" | grep -o "[0-9\.]*")
  16. QMAKE_QT_PATH_MAJOR_VERSION=$(echo $QMAKE_QT_PATH_VERSION | cut -d . -f1)
  17. if [ "$QT_CREATOR_QT_MAJOR_VERSION" != "$QMAKE_QT_PATH_MAJOR_VERSION" ]; then
  18. echo "qmake Qt version ($QMAKE_QT_PATH_VERSION) is not compatible with Qt used by Qt creator($QT_CREATOR_QT_VERSION)"
  19. exit 1
  20. fi
  21. if [[ "$QT_CREATOR_VERSION" != "3"* ]]; then
  22. echo "The plugin is compatible only with QtCreator 3.* version"
  23. exit 1
  24. fi
  25. echo found Qt Creator - version $QT_CREATOR_VERSION build with Qt $QT_CREATOR_QT_VERSION in $QTC_BUILD
  26. if [ -z "$QTC_SOURCE" ]; then
  27. if [ ! -d qt-creator-sources ]; then
  28. echo "undefined QTC_SOURCE environment variable and no qt-creator directory in $SCRIPT_DIR. Downloading creator sources for Qt Creator $QT_CREATOR_VERSION"
  29. QT_CREATOR_BRANCH=${QT_CREATOR_VERSION:0:-2}
  30. git clone http://git.gitorious.org/qt-creator/qt-creator.git -b $QT_CREATOR_BRANCH qt-creator-sources
  31. fi
  32. QTC_SOURCE="$PWD/qt-creator-sources"
  33. fi
  34. cd "$QTC_SOURCE"
  35. set +e
  36. echo fetching latest Qt Creator sources
  37. git fetch origin
  38. set -e
  39. git checkout v$QT_CREATOR_VERSION
  40. QTC_SOURCE=$PWD
  41. echo Qt Creator source set to $QTC_SOURCE
  42. export QTC_BUILD
  43. export QTC_SOURCE
  44. mkdir -p $SCRIPT_DIR/plugins
  45. cd $SCRIPT_DIR/plugins
  46. if [ ! -d tizen ]; then
  47. echo downloading plugin sources
  48. git clone https://git.gitorious.org/tizenbuildtools/qtcreator-tizen-plugin.git tizen
  49. fi
  50. cd tizen
  51. git fetch
  52. QTCREATOR_TIZEN_PLUGIN_BRANCH=${QT_CREATOR_VERSION:0:-2}
  53. CONTAINS_BRANCH=$(git branch -r | grep -c "origin/$QTCREATOR_TIZEN_PLUGIN_BRANCH")
  54. if [ "$CONTAINS_BRANCH" == "0" ]; then
  55. echo "There is no Tizen plugin for QtCreator: $QTCREATOR_TIZEN_PLUGIN_BRANCH"
  56. exit 1;
  57. fi
  58. git reset --hard origin/$QTCREATOR_TIZEN_PLUGIN_BRANCH
  59. qmake -r
  60. make
  61. echo "Done !!!"
  62. echo "Tizen Plugin built and deployed to Qt Creator plugins directory"
  63. cd "$CUR_DIR"