123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #!/bin/bash
- CURDIR=$PWD
- SCRIPT_DIR=$( cd $(dirname $0) ; pwd -P )
- cd $SCRIPT_DIR
- usage()
- {
- cat << EOF
- usage: $0 [OPTIONS]
- Build and deploy Qt Creator Ninja plugin
- OPTIONS:
- -h Show this message
- -q path to qmake
- -b Qt Creator installation (build) directory. We will deploy plugin there
- -s Qt creator source directory. If it is not set script will download Qt sources automatically.
- examples:
- $0 -q /home/user/Qt5.3.1/5.3/gcc_64/bin/qmake -b /home/user/Qt5.3.1/Tools/QtCreator
- EOF
- exit
- }
- QMAKE_PATH=$(type -P qmake)
- while getopts ":b:hs:q:" opt; do
- case $opt in
- b)
- export QTC_BUILD="$OPTARG"
- ;;
- h)
- usage
- ;;
- s)
- QTC_SOURCE="$OPTARG"
- ;;
- q)
- export QMAKE_PATH="$OPTARG"
- ;;
- ?)
- echo "Invalid option: -$OPTARG"
- usage
- ;;
- esac
- done
- set -e
- if [ -z "$QTC_BUILD" ]; then
- echo "undefined Qt Creator's build/install directory, use -b parameter"
- usage
- fi
- if [ -z "$QMAKE_PATH" ]; then
- echo "Can't find qmake in path, please set -q parameter"
- usage
- fi
- QT_CREATOR_VERSION_OUTPUT=$("$QTC_BUILD"/bin/qtcreator -platform minimal -version 2>&1)
- QT_CREATOR_VERSION=$(echo $QT_CREATOR_VERSION_OUTPUT | grep -o "Qt Creator [0-9][0-9\.]*" | grep -o "[0-9\.]*")
- QT_CREATOR_QT_VERSION=$(echo $QT_CREATOR_VERSION_OUTPUT | grep -o "based on Qt [0-9][0-9\.]*" | grep -o "[0-9\.]*")
- QT_CREATOR_QT_MAJOR_VERSION=$(echo $QT_CREATOR_QT_VERSION | cut -d . -f1)
- QMAKE_QT_PATH_VERSION=$(${QMAKE_PATH} -version | grep -o "Using Qt version [0-9\.]*" | grep -o "[0-9\.]*")
- QMAKE_QT_PATH_MAJOR_VERSION=$(echo $QMAKE_QT_PATH_VERSION | cut -d . -f1)
- if [ "$QT_CREATOR_QT_MAJOR_VERSION" != "$QMAKE_QT_PATH_MAJOR_VERSION" ]; then
- echo "qmake (${QMAKE_PATH}) Qt version ($QMAKE_QT_PATH_VERSION) is not compatible with Qt used by Qt creator($QT_CREATOR_QT_VERSION)"
- exit 1
- fi
- if [[ "$QT_CREATOR_VERSION" != "3"* ]]; then
- echo "The plugin is compatible only with QtCreator 3.* version"
- exit 1
- fi
- echo found Qt Creator - version $QT_CREATOR_VERSION build with Qt $QT_CREATOR_QT_VERSION in $QTC_BUILD
- if [ -z "$QTC_SOURCE" ]; then
- if [ ! -d qt-creator-sources ]; then
- echo "Qt creator's source directory not set no qt-creator-sources directory in $SCRIPT_DIR. Downloading creator sources for Qt Creator $QT_CREATOR_VERSION"
- QT_CREATOR_BRANCH=${QT_CREATOR_VERSION:0:-2}
- git clone http://git.gitorious.org/qt-creator/qt-creator.git -b $QT_CREATOR_BRANCH qt-creator-sources
- fi
- QTC_SOURCE="$PWD/qt-creator-sources"
- fi
- cd "$QTC_SOURCE"
- set +e
- echo fetching latest Qt Creator sources
- git fetch origin
- set -e
- git checkout v$QT_CREATOR_VERSION
- QTC_SOURCE=$PWD
- echo Qt Creator source set to $QTC_SOURCE
- export QTC_BUILD
- export QTC_SOURCE
- mkdir -p $SCRIPT_DIR/plugins
- cd $SCRIPT_DIR/plugins
- if [ ! -d tizen ]; then
- echo downloading plugin sources
- git clone http://git.gitorious.org/tizenbuildtools/qtcreator-tizen-plugin.git tizen
- fi
- cd tizen
- git fetch
- QTCREATOR_TIZEN_PLUGIN_BRANCH=${QT_CREATOR_VERSION:0:-2}
- set +e
- CONTAINS_BRANCH=$(git branch -r | grep -c "origin/$QTCREATOR_TIZEN_PLUGIN_BRANCH")
- set -e
- if [ "$CONTAINS_BRANCH" == "0" ]; then
- echo "There is no Tizen plugin for QtCreator: $QTCREATOR_TIZEN_PLUGIN_BRANCH"
- exit 1;
- fi
- git reset --hard origin/$QTCREATOR_TIZEN_PLUGIN_BRANCH
- ${QMAKE_PATH} -r
- make -j $(grep -c ^processor /proc/cpuinfo)
- echo "Done !!!"
- echo "Tizen Plugin built and deployed to Qt Creator plugins directory"
- cd "$CUR_DIR"
|