From bc948b9b943df847557e740e98ea74044b993702 Mon Sep 17 00:00:00 2001 From: Florin9doi Date: Thu, 30 Apr 2020 20:06:03 +0300 Subject: [PATCH] iOS/macOS : set bundle version --- CMakeLists.txt | 1 + Qt/macbundle.sh | 11 +++++++++++ SDL/macbundle.sh | 11 +++++++++++ ios/macbundle.sh | 20 ++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 ios/macbundle.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 50cd7b5356..7e695825b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2065,6 +2065,7 @@ if(IOS) add_custom_command(TARGET PPSSPP POST_BUILD COMMAND mkdir -p \"${APP_DIR_NAME}\" COMMAND tar -c -C ${CMAKE_CURRENT_BINARY_DIR} --exclude .DS_Store --exclude .git assets *.png | tar -x -C \"${APP_DIR_NAME}\" + COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/ios/macbundle.sh" \"${APP_DIR_NAME}\" ) set(MACOSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}) set_target_properties(${TargetBin} PROPERTIES diff --git a/Qt/macbundle.sh b/Qt/macbundle.sh index f906e0d77f..989cde3d17 100644 --- a/Qt/macbundle.sh +++ b/Qt/macbundle.sh @@ -15,4 +15,15 @@ plutil -replace NSLocationWhenInUseUsageDescription -string "Your location may b plutil -replace NSCameraUsageDescription -string "Your camera may be used to emulate Go!Cam, a camera accessory" ${PPSSPP}/Contents/Info.plist plutil -replace NSMicrophoneUsageDescription -string "Your microphone may be used to emulate Go!Cam/Talkman, a microphone accessory" ${PPSSPP}/Contents/Info.plist +GIT_VERSION_LINE=$(grep "PPSSPP_GIT_VERSION = " "$(dirname "${0}")/../git-version.cpp") +SHORT_VERSION_MATCH='.*"v([0-9\.]+(-[0-9]+)?).*";' +LONG_VERSION_MATCH='.*"v(.*)";' +if [[ "${GIT_VERSION_LINE}" =~ ^${SHORT_VERSION_MATCH}$ ]]; then + plutil -replace CFBundleShortVersionString -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${SHORT_VERSION_MATCH}/\$1/g") ${PPSSPP}/Contents/Info.plist + plutil -replace CFBundleVersion -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${LONG_VERSION_MATCH}/\$1/g") ${PPSSPP}/Contents/Info.plist +else + plutil -replace CFBundleShortVersionString -string "" ${PPSSPP}/Contents/Info.plist + plutil -replace CFBundleVersion -string "" ${PPSSPP}/Contents/Info.plist +fi + # TODO: install SDL and Qt frameworks diff --git a/SDL/macbundle.sh b/SDL/macbundle.sh index efe190c1ce..423c9b09c7 100755 --- a/SDL/macbundle.sh +++ b/SDL/macbundle.sh @@ -25,3 +25,14 @@ SDLNAME=$(basename "${SDL}") mkdir -p "${PPSSPP}/Contents/Frameworks" || exit 0 cp -r "$SDL" "${PPSSPP}/Contents/Frameworks" || exit 0 install_name_tool -change "${SDL}" "@executable_path/../Frameworks/${SDLNAME}" "${PPSSPPSDL}" || exit 0 + +GIT_VERSION_LINE=$(grep "PPSSPP_GIT_VERSION = " "$(dirname "${0}")/../git-version.cpp") +SHORT_VERSION_MATCH='.*"v([0-9\.]+(-[0-9]+)?).*";' +LONG_VERSION_MATCH='.*"v(.*)";' +if [[ "${GIT_VERSION_LINE}" =~ ^${SHORT_VERSION_MATCH}$ ]]; then + plutil -replace CFBundleShortVersionString -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${SHORT_VERSION_MATCH}/\$1/g") ${PPSSPP}/Contents/Info.plist + plutil -replace CFBundleVersion -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${LONG_VERSION_MATCH}/\$1/g") ${PPSSPP}/Contents/Info.plist +else + plutil -replace CFBundleShortVersionString -string "" ${PPSSPP}/Contents/Info.plist + plutil -replace CFBundleVersion -string "" ${PPSSPP}/Contents/Info.plist +fi diff --git a/ios/macbundle.sh b/ios/macbundle.sh new file mode 100644 index 0000000000..eed70114e9 --- /dev/null +++ b/ios/macbundle.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PPSSPP="${1}" +PPSSPPiOS="${PPSSPP}/PPSSPP" + +if [ ! -f "${PPSSPPiOS}" ]; then + echo "No such file: ${PPSSPPiOS}!" + exit 0 +fi + +GIT_VERSION_LINE=$(grep "PPSSPP_GIT_VERSION = " "$(dirname "${0}")/../git-version.cpp") +SHORT_VERSION_MATCH='.*"v([0-9\.]+(-[0-9]+)?).*";' +LONG_VERSION_MATCH='.*"v(.*)";' +if [[ "${GIT_VERSION_LINE}" =~ ^${SHORT_VERSION_MATCH}$ ]]; then + plutil -replace CFBundleShortVersionString -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${SHORT_VERSION_MATCH}/\$1/g") ${PPSSPP}/Info.plist + plutil -replace CFBundleVersion -string $(echo ${GIT_VERSION_LINE} | perl -pe "s/${LONG_VERSION_MATCH}/\$1/g") ${PPSSPP}/Info.plist +else + plutil -replace CFBundleShortVersionString -string "" ${PPSSPP}/Info.plist + plutil -replace CFBundleVersion -string "" ${PPSSPP}/Info.plist +fi