File indexing completed on 2024-04-28 04:48:05

0001 #!/bin/bash
0002 
0003 # This will pull the latest version of qtscriptgenerator
0004 # and build it against the first version of QT found
0005 # (either specified by $QTDIR or by qmake)
0006 
0007 # Based on the AUR script (http://aur.archlinux.org) by
0008 # deltaecho
0009 
0010 # whether to install the qtscript bindings documentation
0011 INSTALL_DOCS="true"
0012 # whether to remove the build directory after installing
0013 # (the downloaded source directory will be kept regardless)
0014 CLEANUP="false"
0015 
0016 _gitroot="git://labs.trolltech.com/qtscriptgenerator"
0017 _gitname="qtscriptgenerator-git"
0018 
0019 _scriptdir="$(dirname "$0")"
0020 
0021 qmake="qmake"
0022 if [ -n "$QTDIR" ]; then
0023         if [ -x "$QTDIR/bin/qmake" ]; then
0024                 qmake="$QTDIR/bin/qmake"
0025         fi
0026 fi
0027 
0028 # Export the include dir
0029 if [ -z "$QTDIR" ]; then
0030         export QTDIR="$($qmake -query QT_INSTALL_PREFIX)"
0031 fi
0032 export INCLUDE="$($qmake -query QT_INSTALL_HEADERS)"
0033 PLUGINS_INST="$($qmake -query QT_INSTALL_PLUGINS)"
0034 DOCS_INST="$($qmake -query QT_INSTALL_DOCS)"
0035 
0036 if [ -d ${_gitname}/.git ]; then
0037         echo ">>> Updating GIT working copy..."
0038         ( cd ${_gitname} && git pull ) || echo ">>> WARNING: failed to update GIT working copy"
0039 else
0040         echo ">>> Pulling qtscriptgenerator from GIT repository..."
0041         git clone ${_gitroot} ${_gitname} || exit 1
0042 fi
0043 
0044 echo ">>> Creating the build directory..."
0045 rm -rf ${_gitname}-build
0046 cp -a ${_gitname} ${_gitname}-build
0047 cd ${_gitname}-build
0048 
0049 echo ">>> Patching the generator..."
0050 patch -Np1 -i "${_scriptdir}/qtscriptgenerator-includefix.patch" || exit 1
0051 # this disables phonon and xmlpatterns
0052 patch -Np1 -i "${_scriptdir}/qtscriptgenerator-qtcopy.patch" || exit 1
0053 
0054 
0055 #  Compile and run the generator
0056 # to "generate" the source and
0057 # header files for the bindings
0058 cd generator
0059 echo ">>> Building the generator..."
0060 qmake && make || exit 1
0061 echo ">>> Generating bindings sources..."
0062 ./generator || exit 1
0063 cd ..
0064 
0065 echo ">>> Compiling bindings..."
0066 #  Compile the bindings
0067 cd qtbindings
0068 qmake && make || exit 1
0069 cd ..
0070 
0071 echo ">>> Installing bindings..."
0072 #  Install the qtscript bindings
0073 mkdir -p "${PLUGINS_INST}/script" || exit 1
0074 cp -a plugins/script/* "${PLUGINS_INST}/script" || exit 1
0075 
0076 #  Determine whether to install the documentation
0077 if [ "${INSTALL_DOCS}" == "true" ]; then
0078         echo ">>> Installing documentation..."
0079         mkdir -p "${DOCS_INST}/qtscript" || exit 1
0080         cp -a doc/* "${DOCS_INST}/qtscript" || exit 1
0081 fi
0082 
0083 if [ "${CLEANUP}" == "true" ]; then
0084         echo ">>> Cleaning up build directory..."
0085         cd ..
0086         rm -rf ${_gitname}-build
0087 fi
0088