File indexing completed on 2024-03-24 15:23:37

0001 #!/bin/bash
0002 
0003 set -e
0004 
0005 function usage()
0006 {
0007   echo "Usage: switch <to>"
0008   echo -e "\t<to> can be either meego or plasma"
0009 }
0010 
0011 if [[ "${1}" == "meego" ]]
0012 then
0013   IMPORT_REPLACEMENT="s/org.kde.plasma.components 0.1/com.nokia.meego 1.0/g"
0014   PATH_REPLACEMENT="s@plasma/@harmattan/@g"
0015   CMAKE_REPLACEMENT="s/SET(MARBLE_PLASMA_COMPONENTS TRUE)/SET(MARBLE_PLASMA_COMPONENTS FALSE)/"
0016 elif [[ "${1}" == "plasma" ]]
0017 then
0018   IMPORT_REPLACEMENT="s/com.nokia.meego 1.0/org.kde.plasma.components 0.1/g"
0019   PATH_REPLACEMENT="s@harmattan/@plasma/@g"
0020   CMAKE_REPLACEMENT="s/SET(MARBLE_PLASMA_COMPONENTS FALSE)/SET(MARBLE_PLASMA_COMPONENTS TRUE)/"
0021 else
0022   usage
0023   exit 2
0024 fi
0025 
0026 BASE="$(dirname ${0})/../.."
0027 PLUGIN="${BASE}/src/plugins/qt-components"
0028 APP="${BASE}/src/qt-components/marble-touch"
0029 
0030 test -e "${PLUGIN}/qmldir" || { echo "Unexpected path or file missing"; usage; exit 1; }
0031 test -f "${APP}/meego.qrc"
0032 
0033 # Platform specific .qml files in the application
0034 sed -i "${PATH_REPLACEMENT}" "${APP}/meego.qrc"
0035 
0036 # Platform specific .qml files in the plugin
0037 find "${PLUGIN}" "${APP}" -name "*.qml" -exec sed -i "${IMPORT_REPLACEMENT}" {} \;
0038 
0039 # Platform specific build option in the plugin
0040 sed -i "${CMAKE_REPLACEMENT}" "${PLUGIN}/CMakeLists.txt"