Improve porting to Qt/KF5 scripts

Improve the porting scripts in plasma-framework (maybe they should be in
kdesdk?).
- Add a script to remove the Qt module part of an include (<QtGui/QLabel>
becomes <QLabel>).
- Add more cases when porting cmake files, adding the Qt libraries as well.

REVIEW: 113300
This commit is contained in:
Aleix Pol 2013-10-19 00:29:22 +02:00
parent 391d6ea70b
commit d44b5684ce
2 changed files with 22 additions and 5 deletions

View File

@ -11,10 +11,12 @@
for FS in `find $PWD -type f -name 'CMakeLists.txt'`; do
perl -p -i -e 's/KF5\:\:plasma/KF5\:\:Plasma/g' $FS
# perl -p -i -e 's/kde4_add_plugin/plasma_add_plugin/g' $FS
# perl -p -i -e 's/kde4_add_ui_files/qt5_wrap_ui/g' $FS
# perl -p -i -e 's/kde4_add_kdeinit_executable/kf5_add_kdeinit_executable/g' $FS
perl -p -i -e 's/kde4_add_plugin/plasma_add_plugin/g' $FS
perl -p -i -e 's/kde4_add_ui_files/qt5_wrap_ui/g' $FS
perl -p -i -e 's/kde4_add_kdeinit_executable/kf5_add_kdeinit_executable/g' $FS
perl -p -i -e 's/kde4_add_library/add_library/g' $FS
perl -p -i -e 's/kde4_add_executable/add_executable/g' $FS
perl -p -i -e 's/qt4_add_resources/qt5_add_resources/g' $FS
perl -p -i -e 's/\$\{KDE4_KIDLETIME_LIBRARY\}/KF5::KIdleTime/g' $FS
perl -p -i -e 's/\$\{KDE4_PLASMA_LIBS\}/KF5::Plasma/g' $FS
@ -27,5 +29,13 @@ for FS in `find $PWD -type f -name 'CMakeLists.txt'`; do
perl -p -i -e 's/\$\{KCoreAddons_LIBRARIES\}/KF5\:\:KCoreAddons/g' $FS
perl -p -i -e 's/\$\{KI18n_LIBRARIES\}/KF5\:\:KI18n/g' $FS
perl -p -i -e 's/\$\{KArchive_LIBRARIES\}/KF5\:\:KArchive/g' $FS
perl -p -i -e 's/\$\{QT_QTXML_LIBRARY\}/Qt5\:\:Xml/g' $FS
perl -p -i -e 's/\$\{QT_QTGUI_LIBRARY\}/Qt5\:\:Gui/g' $FS
perl -p -i -e 's/\$\{QT_QTNETWORK_LIBRARY\}/Qt5\:\:Network/g' $FS
perl -p -i -e 's/\$\{QT_QTCORE_LIBRARY\}/Qt5\:\:Core/g' $FS
perl -p -i -e 's/\$\{QT_QTDECLARATIVE_LIBRARY\}/Qt5\:\:Declarative/g' $FS
perl -p -i -e 's/\$\{QT_QTTEST_LIBRARY\}/Qt5\:\:Test/g' $FS
perl -p -i -e 's/\$\{QT_QTSVG_LIBRARY\}/Qt5\:\:Svg/g' $FS
perl -p -i -e 's/\$\{QT_QTOPENGL_LIBRARY\}/Qt5\:\:OpenGL/g' $FS
done
#

7
tools/port-includes.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# it will remove the module prefix in Qt includes, it's usually a problem
# since many classes have changed module between Qt4 and Qt5
for FS in `find $PWD -type f -name '*.h' -or -name '*.cpp'`; do
perl -p -i -e 's/#include\s+<Qt\w+\/(\w*)>/#include <\1>/g' $FS
done