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 | |
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.
-rwxr-xr-x | configure | 119 | ||||
-rw-r--r-- | debian/libdui-dev.install | 1 | ||||
-rwxr-xr-x | debian/rules | 5 | ||||
-rw-r--r-- | demos/animatedlayout/translations/translations.pro | 4 | ||||
-rw-r--r-- | demos/widgetsgallery/translations/translations.pro | 4 | ||||
-rw-r--r-- | mkspecs/common.pri | 4 | ||||
-rw-r--r-- | mkspecs/features/dui.prf (renamed from src/dui.prf) | 2 | ||||
-rw-r--r-- | mkspecs/features/dui_defines.prf.in (renamed from src/dui_defines.prf) | 18 | ||||
-rw-r--r-- | mkspecs/features/dui_translations.prf (renamed from src/translations.prf) | 8 | ||||
-rw-r--r-- | mkspecs/features/translations.prf | 11 | ||||
-rw-r--r-- | projects.pro | 2 | ||||
-rw-r--r-- | src/src.pro | 6 | ||||
-rw-r--r-- | src/translations/translations.pro | 4 | ||||
-rw-r--r-- | tests/ut_translations/translations-qttrid/translations-qttrid.pro | 4 | ||||
-rw-r--r-- | tests/ut_translations/translations-tr/translations-tr.pro | 4 |
15 files changed, 156 insertions, 40 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" diff --git a/debian/libdui-dev.install b/debian/libdui-dev.install index 32b42ba8..83855de6 100644 --- a/debian/libdui-dev.install +++ b/debian/libdui-dev.install @@ -2,4 +2,5 @@ usr/include/* usr/lib/pkgconfig/* usr/share/qt4/mkspecs/features/dui.prf usr/share/qt4/mkspecs/features/dui_defines.prf +usr/share/qt4/mkspecs/features/dui_translations.prf usr/share/qt4/mkspecs/features/translations.prf diff --git a/debian/rules b/debian/rules index d74694b6..9c27f9f0 100755 --- a/debian/rules +++ b/debian/rules @@ -52,8 +52,6 @@ ifeq (,$(findstring notestability,$(DEB_BUILD_OPTIONS))) OPTIONS += -testable endif -QMAKE_OPTIONS += -r - BUILD_DIR=build-$(shell dpkg-architecture -qDEB_BUILD_ARCH) configure: configure-stamp @@ -61,8 +59,7 @@ configure-stamp: dh_testdir mkdir -p $(BUILD_DIR) - ./configure --prefix=/usr -release -make "tests plainqt benchmarks" $(OPTIONS) - cd $(BUILD_DIR) && qmake $(QMAKE_OPTIONS) ../projects.pro + cd $(BUILD_DIR) && ../configure --prefix=/usr -release -make "tests plainqt benchmarks" $(OPTIONS) touch configure-stamp diff --git a/demos/animatedlayout/translations/translations.pro b/demos/animatedlayout/translations/translations.pro index 424f3063..2f96b150 100644 --- a/demos/animatedlayout/translations/translations.pro +++ b/demos/animatedlayout/translations/translations.pro @@ -5,5 +5,5 @@ TRANSLATIONDIR = $$PWD DUIROOT = ../../.. # these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features # and included in the "libdui-dev" package: -include($$DUIROOT/src/dui_defines.prf) -include($$DUIROOT/src/translations.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) +include($${DUIROOT}/mkspecs/features/dui_translations.prf) diff --git a/demos/widgetsgallery/translations/translations.pro b/demos/widgetsgallery/translations/translations.pro index 68d236f7..760efb78 100644 --- a/demos/widgetsgallery/translations/translations.pro +++ b/demos/widgetsgallery/translations/translations.pro @@ -5,5 +5,5 @@ TRANSLATIONDIR = $$PWD DUIROOT = ../../.. # these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features # and included in the "libdui-dev" package: -include($$DUIROOT/src/dui_defines.prf) -include($$DUIROOT/src/translations.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) +include($${DUIROOT}/mkspecs/features/dui_translations.prf) diff --git a/mkspecs/common.pri b/mkspecs/common.pri index a029b5fa..39c33e2a 100644 --- a/mkspecs/common.pri +++ b/mkspecs/common.pri @@ -27,11 +27,11 @@ mac { # Load configure script results !win32:!macx { - include(duiconfig.pri) + include($${DUI_BUILD_TREE}/mkspecs/duiconfig.pri) } # Load global definitions -include(../src/dui_defines.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) # Defines for directories, for use in source code. { diff --git a/src/dui.prf b/mkspecs/features/dui.prf index 1a158922..0d3bbc0b 100644 --- a/src/dui.prf +++ b/mkspecs/features/dui.prf @@ -32,7 +32,7 @@ macx { isEmpty(DUIGEN_OUTDIR) { DUIGEN_OUTDIR = . } - + duigenerator_model.name = duigenerator model duigenerator_model.input = MODEL_HEADERS duigenerator_model.output = $$DUIGEN_OUTDIR/gen_${QMAKE_FILE_BASE}data.cpp diff --git a/src/dui_defines.prf b/mkspecs/features/dui_defines.prf.in index 8a846e67..a3c458a6 100644 --- a/src/dui_defines.prf +++ b/mkspecs/features/dui_defines.prf.in @@ -9,10 +9,20 @@ DUI_MINOR_VERSION = 19 DUI_PATCH_VERSION = 0 DUI_VERSION=$${DUI_MAJOR_VERSION}.$${DUI_MINOR_VERSION}.$${DUI_PATCH_VERSION} -# Directories +# first set default value for dui prefix +# the @@...@@ variable is filled from the libdui/configure script. unix { + DUI_PREFIX = @@DUI_UNIX_INSTALL_PREFIX@@ +} +mac { DUI_PREFIX = /usr +} +win32 { + DUI_PREFIX = +} +# Directories +unix { DUI_INSTALL_BIN = $$DUI_PREFIX/bin DUI_INSTALL_LIBS = $$DUI_PREFIX/lib DUI_INSTALL_DATA = $$DUI_PREFIX/share @@ -39,9 +49,8 @@ unix { DUI_SHADER_SOURCE_DIR = $$DUI_INSTALL_DATA/dui/shaders DUI_SHADER_BINARY_DIR = $$DUI_INSTALL_LOCALSTATE/cache/dui/shaders } -mac { - DUI_PREFIX = /usr +mac { DUI_INSTALL_BIN = $$DUI_PREFIX/bin DUI_INSTALL_LIBS = $$DUI_PREFIX/lib DUI_INSTALL_DATA = $$DUI_PREFIX/share @@ -65,9 +74,8 @@ mac { DUI_SHADER_SOURCE_DIR = $$DUI_INSTALL_DATA/dui/shaders DUI_SHADER_BINARY_DIR = $$DUI_INSTALL_LOCALSTATE/cache/dui/shaders } -win32 { - DUI_PREFIX = +win32 { DUI_INSTALL_BIN = /bin DUI_INSTALL_LIBS = /bin DUI_INSTALL_DATA = /share diff --git a/src/translations.prf b/mkspecs/features/dui_translations.prf index 6e488018..50fe4f1f 100644 --- a/src/translations.prf +++ b/mkspecs/features/dui_translations.prf @@ -5,7 +5,7 @@ # in the following example for “widgetsgallery”: # # Create a subdirectory “translations” in the source folder of the -# application which contains a translations.po file and the .ts +# application which contains a translations.pro file and the .ts # files, for example if the source dir is “libdui/demos/widgetsgallery”: # # libdui/demos/widgetsgallery/translations.pro @@ -21,7 +21,7 @@ # SOURCEDIR = $$PWD/.. # TRANSLATIONDIR = $$PWD # include($$[QT_INSTALL_DATA]/mkspecs/features/dui_defines.prf) -# include($$[QT_INSTALL_DATA]/mkspecs/features/translations.prf) +# include($$[QT_INSTALL_DATA]/mkspecs/features/dui_translations.prf) # # It is better to have an extra translations.pro file in the directory # where the translations are instead of adding the stuff for the translations @@ -107,7 +107,7 @@ isEmpty(vcproj) { updateeets.input = DUMMY_DEP updateeets.output = $$ENGINEERING_ENGLISH !isEmpty(vcproj):updateeets.variable_out = GENERATED_SOURCES - updateeets.commands = $$LUPDATE $$SOURCEDIR -ts $$ENGINEERING_ENGLISH + updateeets.commands = $$LUPDATE "$$SOURCEDIR" -ts \"$$ENGINEERING_ENGLISH\" updateeets.name = LUPDATE $$ENGINEERING_ENGLISH updateeets.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += updateeets @@ -141,7 +141,7 @@ isEmpty(vcproj) { # other .ts files besides the engineering English one should only be updated # on request, i.e. only when calling “make updatets” manually: -updatets.commands = $$LUPDATE $$SOURCEDIR -ts $$TRANSLATIONS +updatets.commands = $$LUPDATE "$$SOURCEDIR" -ts lala \"$$TRANSLATIONS\" updatets.target = updatets QMAKE_EXTRA_TARGETS += updatets diff --git a/mkspecs/features/translations.prf b/mkspecs/features/translations.prf new file mode 100644 index 00000000..bdad357b --- /dev/null +++ b/mkspecs/features/translations.prf @@ -0,0 +1,11 @@ +# this is only a temporary .prf file to keep old code working +# if you want to include translation features, use the +# dui_translations.prf file. + +# we want to phase out the translations.prf file to +# avoid possible name clashes in the future. + +message( WARNING: do not include translations.prf any more. ) +message( WARNING: do include dui_translations.prf instead. ) + +include(dui_translations.prf) diff --git a/projects.pro b/projects.pro index c36b483d..c25a1261 100644 --- a/projects.pro +++ b/projects.pro @@ -6,7 +6,7 @@ CONFIG += ordered TEMPLATE = subdirs !win32:!macx { - !exists(mkspecs/duiconfig.pri) { + !exists($${OUT_PWD}/mkspecs/duiconfig.pri) { error("Please run ./configure before proceeding") } } diff --git a/src/src.pro b/src/src.pro index 98205adc..e4d26d38 100644 --- a/src/src.pro +++ b/src/src.pro @@ -175,8 +175,12 @@ install_headers.files = \ install_pkgconfig.path = $$DUI_INSTALL_LIBS/pkgconfig install_pkgconfig.files = Dui.pc +### TODO API break: remove translations.prf install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features -install_prf.files = dui.prf dui_defines.prf translations.prf +install_prf.files = ../mkspecs/features/dui.prf \ + ../mkspecs/features/dui_translations.prf \ + ../mkspecs/features/translations.prf \ + $${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf INSTALLS += \ target \ diff --git a/src/translations/translations.pro b/src/translations/translations.pro index e11108db..0c673102 100644 --- a/src/translations/translations.pro +++ b/src/translations/translations.pro @@ -5,5 +5,5 @@ TRANSLATIONDIR = $$PWD DUIROOT = ../.. # these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features # and included in the "libdui-dev" package: -include($$DUIROOT/src/dui_defines.prf) -include($$DUIROOT/src/translations.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) +include($${DUIROOT}/mkspecs/features/dui_translations.prf) diff --git a/tests/ut_translations/translations-qttrid/translations-qttrid.pro b/tests/ut_translations/translations-qttrid/translations-qttrid.pro index c8d3fd56..5b108c63 100644 --- a/tests/ut_translations/translations-qttrid/translations-qttrid.pro +++ b/tests/ut_translations/translations-qttrid/translations-qttrid.pro @@ -14,5 +14,5 @@ TRANSLATION_INSTALLDIR = $$[QT_INSTALL_LIBS]/libdui-tests/translations-qttrid DUIROOT = ../../.. # these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features # and included in the "libdui-dev" package: -include($$DUIROOT/src/dui_defines.prf) -include($$DUIROOT/src/translations.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) +include($${DUIROOT}/mkspecs/features/dui_translations.prf) diff --git a/tests/ut_translations/translations-tr/translations-tr.pro b/tests/ut_translations/translations-tr/translations-tr.pro index c1c3f6a1..f07db26d 100644 --- a/tests/ut_translations/translations-tr/translations-tr.pro +++ b/tests/ut_translations/translations-tr/translations-tr.pro @@ -17,5 +17,5 @@ LRELEASE_OPTIONS = "-verbose" DUIROOT = ../../.. # these include files are installed to $$[QT_INSTALL_DATA]/mkspecs/features # and included in the "libdui-dev" package: -include($$DUIROOT/src/dui_defines.prf) -include($$DUIROOT/src/translations.prf) +include($${DUI_BUILD_TREE}/mkspecs/features/dui_defines.prf) +include($${DUIROOT}/mkspecs/features/dui_translations.prf) |