qt5: Use QT_SELECT for debian-based distros.

At least Debian/Ubuntu use 'qtchooser' for switching between qt4/qt5 binaries.
It is a wrapper for all qt tools, and calls the named tool of the default
version unless overridden by the -qt= option or QT_SELECT environment variable.
QT_SELECT is set by configure once the qt version has been chosen.

Take for example, moc.

$ which moc
    /usr/bin/moc

$ ls -go /usr/bin/moc
    lrwxrwxrwx 1 9 Jul  3 21:33 /usr/bin/moc -> qtchooser

$ qtchooser -print-env
    QT_SELECT="default"
    QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt4/bin"
    QTLIBDIR="/usr/lib/x86_64-linux-gnu"

$ QT_SELECT=qt5 qtchooser -print-env
    QT_SELECT="qt5"
    QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt5/bin"
    QTLIBDIR="/usr/lib/x86_64-linux-gnu"

$ moc -v
    Qt Meta Object Compiler version 63 (Qt 4.8.4)

$ QT_SELECT=qt5 moc -v
    Qt Meta Object Compiler version 67 (Qt 5.0.1)

This should be harmless elsewhere.
This commit is contained in:
Cory Fields 2013-12-02 16:55:37 -05:00
parent 60dc589477
commit 47ffb50533
2 changed files with 6 additions and 6 deletions

View File

@ -32,23 +32,23 @@ $(LIBBITCOINQT):
ui_%.h: %.ui ui_%.h: %.ui
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
@test -f $(UIC) && $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@ @test -f $(UIC) && QT_SELECT=$(QT_SELECT) $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@
$(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak $(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak $(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
%.moc: %.cpp %.moc: %.cpp
$(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
$(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
moc_%.cpp: %.h moc_%.cpp: %.h
$(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $< QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
$(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
%.qm: %.ts %.qm: %.ts
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D) @test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
@test -f $(LRELEASE) && $(LRELEASE) $(abs_srcdir)/$< -qm $(abs_builddir)/$@ || \ @test -f $(LRELEASE) && QT_SELECT=$(QT_SELECT) $(LRELEASE) $(abs_srcdir)/$< -qm $(abs_builddir)/$@ || \
echo error: could not build $(abs_builddir)/$@ echo error: could not build $(abs_builddir)/$@
%.pb.cc %.pb.h: %.proto %.pb.cc %.pb.h: %.proto

View File

@ -220,10 +220,10 @@ bitcoinstrings.cpp: FORCE
translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations" @test -n $(LUPDATE) || echo "lupdate is required for updating translations"
@$(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts @QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts
$(QT_QRC_CPP): $(QT_QRC) $(QT_QM) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H) $(QT_QRC_CPP): $(QT_QRC) $(QT_QM) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
@cd $(abs_srcdir); test -f $(RCC) && $(RCC) -name bitcoin -o $(abs_builddir)/$@ $< || \ @cd $(abs_srcdir); test -f $(RCC) && QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin -o $(abs_builddir)/$@ $< || \
echo error: could not build $@ echo error: could not build $@
$(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak