diff options
author | Holger Schroeder <holger.schroeder.ext@basyskom.de> | 2010-02-18 14:19:35 +0100 |
---|---|---|
committer | Holger Schroeder <holger.schroeder.ext@basyskom.de> | 2010-02-18 14:48:36 +0100 |
commit | c013b2ab2c64b5659771e2fb26f918eaddcf90b6 (patch) | |
tree | 1400e0fdf42ce65eb27e466c617db539ab3abed2 /configure | |
parent | dc7a85d90d8881c0948becc31b35923b9bf95781 (diff) |
Changes: make configure script work better
RevBy: TrustMe, Tomas Junnonen
Details: This patch changes the following things:
* make out-of-source builds work.
the problem here was that ther was still a config file
generated in-source. and the move of that file to the
build dir was quite tricky. because the relativity of
pathes in include() statements in .pro files is a bit
strange, we had to have a way to reference the build
dir as an absolute path. this leads to:
* create a .qmake.cache in build dir
this change creates a .qmake.cache dir in the build
tree root. this file is created from the configure
script. and it is read by qmake. then the variable
DUI_BUILD_TREE in there contains the absolute path
to the build tree. now we cna use that variable to
be able to include() files in the build tree. this
leads to:
* generate dui_defines.prf in build dir
before the DUI_PREFIX variable in dui_defines.prf
was hardcoded. and in the end we want the DUI_PREFIX
to be the path that was given as parameter to the
configure script. so we moved the dui_defines.prf
to dui_defines.prf.in and added a marker that is
then replaced by the real install path by the configure
script.
also done:
- fix translation include pathes
- add check for minimum qt version
- change translations.prf to dui_translations.prf
Changes: include dui_defines.prf
RevBy: TrustMe
Details: The original problem this patch fixes is:
when we create the .deb packages with dpkg-buildpackage,
the creation of the i18n packages failed. The reason
was that the created Makefile's for the translations
were missing the install targets for the .qm files.
we tracked this problem down to:
qmake without "-r" recursive parameter can find the
dui_defines.prf in the build dir, although it was referenced
relatively from the source directory.
qmake with "-r" recursive parameter can not find the
dui_defines.prf file in the build dir.
and in debian/rules we were calling "configure" first,
which then calls qmake without "-r", and afterwards
we call qmake with "-r" directly.
so we applied two fixes: we reference the dui_defines.prf
in the build dir with $${DUI_BUILD_TREE}/... and we also
removed the now superfluous call to qmake in debian/rules.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 119 |
1 files changed, 107 insertions, 12 deletions
@@ -12,9 +12,9 @@ #------------------------------------------------------------------------------- # the name of this script -relconf=`basename $0` +relconf=`basename "$0"` # the directory of this script is the "source tree" -relpath=`dirname $0` +relpath=`dirname "$0"` relpath=`(cd "$relpath"; /bin/pwd)` # the current directory is the "build tree" or "object tree" outpath=`/bin/pwd` @@ -32,9 +32,10 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown #----------------------------------------------------------------------------- # Dui version detection #----------------------------------------------------------------------------- -DUI_MAJOR_VERSION=`grep -m1 DUI_MAJOR_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'` -DUI_MINOR_VERSION=`grep -m1 DUI_MINOR_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'` -DUI_PATCH_VERSION=`grep -m1 DUI_PATCH_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'` +cd "$relpath" +DUI_MAJOR_VERSION=`grep -m1 DUI_MAJOR_VERSION mkspecs/features/dui_defines.prf.in |cut -f2 -d'='|sed 's/ //g'` +DUI_MINOR_VERSION=`grep -m1 DUI_MINOR_VERSION mkspecs/features/dui_defines.prf.in |cut -f2 -d'='|sed 's/ //g'` +DUI_PATCH_VERSION=`grep -m1 DUI_PATCH_VERSION mkspecs/features/dui_defines.prf.in |cut -f2 -d'='|sed 's/ //g'` DUI_VERSION=$DUI_MAJOR_VERSION.$DUI_MINOR_VERSION.$DUI_PATCH_VERSION if [ -z "$DUI_MAJOR_VERSION" ]; then @@ -66,6 +67,8 @@ HAVE_GCONF=no HAVE_GSTREAMER=no HAVE_DBUS=no +OPT_SHADOW=maybe + # initalize variables used for installation DUI_INSTALL_PREFIX=/usr/local @@ -252,6 +255,18 @@ if [ "$CFG_DEV" = "yes" ]; then CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests benchmarks plainqt" fi +# is this a shadow build? +if [ "$OPT_SHADOW" = "maybe" ]; then + OPT_SHADOW=no + if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then + if [ -h "$outpath" ]; then + [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes + else + OPT_SHADOW=yes + fi + fi +fi + # Test for ICU which icu-config > /dev/null if [ $? -eq 0 ]; then @@ -335,6 +350,18 @@ fi # save configuration into duiconfig.pri #------------------------------------------------------------------------------- +if [ "$OPT_SHADOW" = "yes" ]; then + if [ -f "$relpath/mkspecs/duiconfig.pri" ]; then + echo >&2 "You cannot make a shadow build from a source tree containing a previous build." + echo >&2 "Cannot proceed." + exit 1 + fi + + # create mkspecs/features dir in build tree + mkdir -p "$outpath/mkspecs/features" +fi + + DUICONFIG="$outpath/mkspecs/duiconfig.pri" [ -f "$DUICONFIG.tmp" ] && rm -f "$DUICONFIG.tmp" @@ -409,6 +436,38 @@ else mv -f "$DUICONFIG.tmp" "$DUICONFIG" fi +# now try to create a .qmake.cache file to be able to find the dui build root +DUI_QMAKE_CACHE="$outpath/.qmake.cache" +[ -f "$DUI_QMAKE_CACHE.tmp" ] && rm -f "$DUI_QMAKE_CACHE.tmp" + +cat >>"$DUI_QMAKE_CACHE.tmp" <<EOF +# Autogenerated by configure script +DUI_BUILD_TREE = \$\$quote($outpath) + +EOF + +# replace .qmake.cache if it differs from the newly created temp file +if cmp -s "$DUI_QMAKE_CACHE.tmp" "$DUI_QMAKE_CACHE"; then + rm -f "$DUI_QMAKE_CACHE.tmp" +else + mv -f "$DUI_QMAKE_CACHE.tmp" "$DUI_QMAKE_CACHE" +fi + + +DUI_DEFINES_PRF="$outpath/mkspecs/features/dui_defines.prf" + +# and now we generate a dui_defines.prf that will contain the right +# install prefix +cat "$relpath/mkspecs/features/dui_defines.prf.in" \ +| sed -e "s,@@DUI_UNIX_INSTALL_PREFIX@@,$DUI_INSTALL_PREFIX,g" > "$DUI_DEFINES_PRF.tmp" + +# replace dui_defines.prf if it differs from the newly created temp file +if cmp -s "$DUI_DEFINES_PRF.tmp" "$DUI_DEFINES_PRF"; then + rm -f "$DUI_DEFINES_PRF.tmp" +else + mv -f "$DUI_DEFINES_PRF.tmp" "$DUI_DEFINES_PRF" +fi + #------------------------------------------------------------------------------- # build makefiles based on the configuration #------------------------------------------------------------------------------- @@ -439,14 +498,50 @@ if [ -z "$QMAKE_BIN" ]; then exit 1 fi +# now check for qt version +QT_MAJOR_VERSION_NEEDED=4 +QT_MINOR_VERSION_NEEDED=6 + +QT_VERSION=`$QMAKE_BIN -version | tail -1` + +QT_MAJOR_VERSION=0 +QT_MINOR_VERSION=0 +QT_PATCH_VERSION=0 +if [ -n "$QT_VERSION" ]; then + QT_VERSION=`echo $QT_VERSION | sed 's,^ *Using *Qt *version *\([^ ]*\) *in .*$,\1,'` + MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'` + if [ -n "$MAJOR" ]; then + MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'` + PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'` + QT_MAJOR_VERSION="$MAJOR" + [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR" + [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH" + fi +fi + +if [ -z "$QT_MAJOR_VERSION" ]; then + echo "Cannot process version from qglobal.h: $QT_VERSION" + echo "Cannot proceed." + exit 1 +fi + +if [ "$QT_MAJOR_VERSION" -lt "$QT_MAJOR_VERSION_NEEDED" ] \ + || [ "$QT_MINOR_VERSION" -lt "$QT_MINOR_VERSION_NEEDED" ]; then + echo "Your Qt version is too old: $QT_VERSION" + echo "You need at least version $QT_MAJOR_VERSION_NEEDED.$QT_MINOR_VERSION_NEEDED.0" + echo "Cannot proceed." + exit 1 +fi + #Run qmake -$QMAKE_BIN $QMAKE_CONFIG $QMAKE_SWITCHES +cd "$outpath" +$QMAKE_BIN "$relpath/projects.pro" $QMAKE_CONFIG $QMAKE_SWITCHES #------------------------------------------------------------------------------- # give feedback on configuration #------------------------------------------------------------------------------- -echo "\n\nOptional build dependencies found:" +echo -e "\n\nOptional build dependencies found:" echo "ICU ...................... $HAVE_ICU" echo "Context Subscriber 1.0 ... $HAVE_CONTEXTSUBSCRIBER" @@ -456,15 +551,15 @@ echo "DBus (incl. QtDBus) ...... $HAVE_DBUS" if [ "$CFG_DEV" = "yes" ]; then - echo "\n\nEnabling DirectUI developer's build\n" + echo -e "\n\nEnabling DirectUI developer's build\n" else - echo "\n" + echo -e "\n" fi echo "DirectUI framework build configuration:" echo "Version ............. $DUI_VERSION" -echo "Build ...............$CFG_BUILD_PARTS" -echo "Extra features ......$DUICONFIG_FEATURES" +echo "Build ............... $CFG_BUILD_PARTS" +echo "Extra features ...... $DUICONFIG_FEATURES" echo "Release ............. $CFG_RELEASE" echo "Debug ............... $CFG_DEBUG" @@ -478,4 +573,4 @@ else echo libdui will be installed into $DUI_INSTALL_PREFIX fi -echo "\n" +echo -e "\n" |