From 5067c64c2356196f2086a97304f1a99309c09d69 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Nov 2009 18:43:38 +0100 Subject: make qm file creation a regular build step this is mostly a revert of the revert of the previous attempt, only that this time we have a bootstrapped lrelease which won't blow up for cross-compilations. Reviewed-By: Jason McDonald Task-Id: QTBUG-4939 --- configure | 4 ++++ projects.pro | 7 ++++++- translations/translations.pri | 35 +++-------------------------------- translations/translations.pro | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 33 deletions(-) create mode 100644 translations/translations.pro diff --git a/configure b/configure index e5bc013..123e146 100755 --- a/configure +++ b/configure @@ -7577,6 +7577,9 @@ FNR == 1 { if ( \$3 == "moc" || \$3 ~ /^Qt/ ) { target_file = first matched_target = 1 + } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) { + target_file = second + matched_target = 1 } } @@ -7661,6 +7664,7 @@ for part in $CFG_BUILD_PARTS; do case "$part" in tools) PART_ROOTS="$PART_ROOTS tools" ;; libs) PART_ROOTS="$PART_ROOTS src" ;; + translations) PART_ROOTS="$PART_ROOTS tools/linguist/lrelease translations" ;; examples) PART_ROOTS="$PART_ROOTS examples demos" ;; *) ;; esac diff --git a/projects.pro b/projects.pro index aa1eb71..497acd0 100644 --- a/projects.pro +++ b/projects.pro @@ -45,7 +45,12 @@ for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) { } else:isEqual(PROJECT, docs) { contains(QT_BUILD_PARTS, tools):include(doc/doc.pri) } else:isEqual(PROJECT, translations) { - contains(QT_BUILD_PARTS, tools):include(translations/translations.pri) + contains(QT_BUILD_PARTS, tools) { + include(translations/translations.pri) # ts targets + } else { + SUBDIRS += tools/linguist/lrelease + } + SUBDIRS += translations # qm build step } else:isEqual(PROJECT, qmake) { # SUBDIRS += qmake } else { diff --git a/translations/translations.pri b/translations/translations.pri index c77876a..c423809 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -8,13 +8,8 @@ defineReplace(prependAll) { return ($$result) } -defineReplace(fixPath) { - win32:1 ~= s|/|\\| - return ($$1) -} - -LUPDATE = $$fixPath($$QT_BUILD_TREE/bin/lupdate) -locations relative -no-ui-lines -LRELEASE = $$fixPath($$QT_BUILD_TREE/bin/lrelease) +LUPDATE = $$QT_BUILD_TREE/bin/lupdate -locations relative -no-ui-lines +win32:LUPDATE ~= s|/|\\|g ###### Qt Libraries @@ -41,27 +36,18 @@ ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ -ts $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts)) ts-qt.depends = sub-tools -qm-qt.commands = $$LRELEASE $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts) -qm-qt.depends = sub-tools - ###### Designer ts-designer.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/designer/translations/translations.pro) ts-designer.depends = sub-tools -qm-designer.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/designer/translations/translations.pro -qm-designer.depends = sub-tools - ###### Linguist ts-linguist.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/linguist/linguist/linguist.pro) ts-linguist.depends = sub-tools -qm-linguist.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/linguist/linguist/linguist.pro -qm-linguist.depends = sub-tools - ###### Assistant ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ @@ -72,36 +58,21 @@ ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/assistant/translations/translations_adp.pro) ts-assistant.depends = sub-tools -qm-assistant.commands = ($$LRELEASE $$QT_SOURCE_TREE/tools/assistant/translations/translations.pro \ - && $$LRELEASE \ - $$QT_SOURCE_TREE/tools/assistant/translations/qt_help.pro \ - && $$LRELEASE \ - $$QT_SOURCE_TREE/tools/assistant/translations/translations_adp.pro) -qm-assistant.depends = sub-tools - ###### Qtconfig ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/qtconfig/translations/translations.pro) ts-qtconfig.depends = sub-tools -qm-qtconfig.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/qtconfig/translations/translations.pro -qm-qtconfig.depends = sub-tools - ###### Qvfp ts-qvfb.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/qvfb/translations/translations.pro) ts-qvfb.depends = sub-tools -qm-qvfb.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/qvfb/translations/translations.pro -qm-qvfb.depends = sub-tools - ###### Overall Rules ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb -qm.depends = qm-qt qm-designer qm-linguist qm-assistant qm-qtconfig qm-qvfb QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb \ - qm-qt qm-designer qm-linguist qm-assistant qm-qtconfig qm-qvfb \ - ts qm + ts diff --git a/translations/translations.pro b/translations/translations.pro new file mode 100644 index 0000000..22f0ace --- /dev/null +++ b/translations/translations.pro @@ -0,0 +1,42 @@ +TRANSLATIONS = $$files(*.ts) + +LRELEASE = $$QT_BUILD_TREE/bin/lrelease +win32:LRELEASE ~= s|/|\\|g + +contains(TEMPLATE_PREFIX, vc):vcproj = 1 + +TEMPLATE = app +TARGET = qm_phony_target +CONFIG -= qt separate_debug_info +QT = +LIBS = + +updateqm.input = TRANSLATIONS +updateqm.output = ${QMAKE_FILE_BASE}.qm +isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS +updateqm.commands = @echo lrelease ${QMAKE_FILE_IN}; $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +updateqm.name = LRELEASE ${QMAKE_FILE_IN} +updateqm.CONFIG += no_link +QMAKE_EXTRA_COMPILERS += updateqm + +isEmpty(vcproj) { + QMAKE_LINK = @: IGNORE THIS LINE + OBJECTS_DIR = + win32:CONFIG -= embed_manifest_exe +} else { + CONFIG += console + PHONY_DEPS = . + phony_src.input = PHONY_DEPS + phony_src.output = phony.c + phony_src.variable_out = GENERATED_SOURCES + phony_src.commands = echo int main() { return 0; } > phony.c + phony_src.name = CREATE phony.c + phony_src.CONFIG += combine + QMAKE_EXTRA_COMPILERS += phony_src +} + +translations.path = $$[QT_INSTALL_TRANSLATIONS] +translations.files = $$TRANSLATIONS +translations.files ~= s,\\.ts$,.qm,g +translations.CONFIG += no_check_exist +INSTALLS += translations -- cgit v0.12