mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
Add a little perl script to try to convert version numbers to Apple-compatible format.
This commit is contained in:
parent
9da5ab726d
commit
16dffaa92d
22
ios/iosbundle.sh
Normal file → Executable file
22
ios/iosbundle.sh
Normal file → Executable file
@ -1,14 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "iosbundle.sh params 0: ${0} 1: ${1} 2: ${2}"
|
||||
echo $(pwd)
|
||||
|
||||
PPSSPP="${1}"
|
||||
PPSSPPiOS="${PPSSPP}/PPSSPP"
|
||||
|
||||
if [ ! -f "${PPSSPPiOS}" ]; then
|
||||
echo "iosbundle.sh: No such file: ${PPSSPPiOS}!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GIT_VERSION_FILE="${2}/git-version.cpp"
|
||||
if [ ! -f "${GIT_VERSION_FILE}" ]; then
|
||||
@ -21,11 +16,20 @@ GIT_VERSION_LINE=$(grep "PPSSPP_GIT_VERSION = " $GIT_VERSION_FILE)
|
||||
|
||||
SHORT_VERSION_MATCH='.*"v([0-9\.]+(-[0-9]+)?).*";'
|
||||
LONG_VERSION_MATCH='.*"v(.*)";'
|
||||
FULL_VERSION=$(echo ${GIT_VERSION_LINE} | perl -pe "s/${LONG_VERSION_MATCH}/\$1/g")
|
||||
|
||||
SHORT_VERSION=$(echo ${GIT_VERSION_LINE} | perl -pe "s/${SHORT_VERSION_MATCH}/\$1/g")
|
||||
LONG_VERSION=$(echo ${GIT_VERSION_LINE} | perl -pe "s/${LONG_VERSION_MATCH}/\$1/g")
|
||||
echo "Full version string: $FULL_VERSION"
|
||||
|
||||
echo "Writing versions to Info.plist. Short, long: $SHORT_VERSION , $LONG_VERSION"
|
||||
# Crunches to version number to something that XCode will validate.
|
||||
SHORT_VERSION=$(perl $2/../ios/version-transform.pl $FULL_VERSION)
|
||||
#LONG_VERSION=$FULL_VERSION
|
||||
|
||||
# Turns out we can't have anything except numbers or dots, or XCode will crash
|
||||
# during validation. So for now, let's set them to the same thing. Not really sure
|
||||
# why you'd differentiate.
|
||||
LONG_VERSION=$SHORT_VERSION
|
||||
|
||||
echo "Writing versions to Info.plist. Short: $SHORT_VERSION Long: $LONG_VERSION"
|
||||
|
||||
if [[ "${GIT_VERSION_LINE}" =~ ^${SHORT_VERSION_MATCH}$ ]]; then
|
||||
plutil -replace CFBundleShortVersionString -string $SHORT_VERSION ${PPSSPP}/Info.plist
|
||||
|
36
ios/version-transform.pl
Normal file
36
ios/version-transform.pl
Normal file
@ -0,0 +1,36 @@
|
||||
# Used to convert git describe strings like 1.17.1-421-g0100c6b32b
|
||||
# to three dot-separated integers, as iOS wants for the short version.
|
||||
|
||||
$version = $ARGV[0];
|
||||
|
||||
# Strip a "v" if the version starts with it.
|
||||
$version =~ s/^v//;
|
||||
|
||||
# Use multiple regexes to parse the various formats we may encounter.
|
||||
# I don't know perl better than this.
|
||||
|
||||
if ($version =~ /^(\d+)\.(\d+)\.(\d+)-(\d+)/) {
|
||||
my $major = $1 * 10000 + $2;
|
||||
my $minor = $3;
|
||||
my $rev = $4;
|
||||
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.1.421
|
||||
exit
|
||||
}
|
||||
|
||||
if ($version =~ /^(\d+)\.(\d+)\.(\d+)/) {
|
||||
my $major = $1 * 10000 + $2;
|
||||
my $minor = $3;
|
||||
my $rev = "0";
|
||||
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.0.0
|
||||
exit
|
||||
}
|
||||
|
||||
if ($version =~ /^(\d+)\.(\d+)/) {
|
||||
my $major = $1 * 10000 + $2;
|
||||
my $minor = "0";
|
||||
my $rev = "0";
|
||||
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.0.0
|
||||
exit
|
||||
}
|
||||
|
||||
die($version)
|
Loading…
Reference in New Issue
Block a user