Skip to content

Commit

Permalink
Automating version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Isarhamster committed Sep 5, 2024
1 parent 000e746 commit 6fdd4f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
12 changes: 7 additions & 5 deletions mac_osx/mac_deploy_dyn
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
#!/bin/sh
[ $# -eq 0 ] && { echo "Usage: $0 QT_INSTALL_PREFIX // Creator: %{Qt:QT_INSTALL_PREFIX} in %{buildDir}/release"; exit 1; }

DIR=${0%/*}
RELEASEDIR=`pwd`
BUILDDIR=$RELEASEDIR/..
DIR="/Users/jens/Documents/Programmieren/Projects/chessx-git/mac_osx"

VERSION=$(awk '
BEGIN { major="0"; minor="0"; patch="0" }
/#define VERSION_MAJOR/ {gsub(/[^0-9]/, "", $3); major=$3; print "Major found: " major > "/dev/stderr"}
/#define VERSION_MINOR/ {gsub(/[^0-9]/, "", $3); minor=$3; print "Minor found: " minor > "/dev/stderr"}
/#define REVISION/ {gsub(/[^0-9]/, "", $3); patch=$3; print "Patch found: " patch > "/dev/stderr"}
/#define VERSION_MAJOR/ {gsub(/[^0-9]/, "", $3); major=$3; }
/#define VERSION_MINOR/ {gsub(/[^0-9]/, "", $3); minor=$3; }
/#define REVISION/ {gsub(/[^0-9]/, "", $3); patch=$3; }
END {
print major "." minor "." patch
}' ${DIR}/../src/database/version.h)

echo "Updating ${DIR}/info.plist to version ${VERSION}"

/usr/libexec/PlistBuddy -c "delete :CFBundleVersion" ${DIR}/info.plist
/usr/libexec/PlistBuddy -c "delete :CFBundleShortVersionString" ${DIR}/info.plist
/usr/libexec/PlistBuddy -c "add :CFBundleVersion string ${VERSION}" ${DIR}/info.plist
/usr/libexec/PlistBuddy -c "add :CFBundleShortVersionString string ${VERSION}" ${DIR}/info.plist

echo "Build image for chessx-${VERSION} in ${RELEASEDIR}"
QTBASE=$1
QTBIN=$1/bin
Expand Down
20 changes: 18 additions & 2 deletions unix/make_tarball
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
CNAME=chessx-1.6.0
#!/bin/sh
DIR=${0%/*}
echo "Build archive from ${DIR} in ${DIR}/../Packages/"

VERSION=$(awk '
BEGIN { major="0"; minor="0"; patch="0" }
/#define VERSION_MAJOR/ {gsub(/[^0-9]/, "", $3); major=$3; }
/#define VERSION_MINOR/ {gsub(/[^0-9]/, "", $3); minor=$3; }
/#define REVISION/ {gsub(/[^0-9]/, "", $3); patch=$3; }
END {
print major "." minor "." patch
}' ${DIR}/../src/database/version.h)

echo "Building archive for version ${VERSION}"

CNAME=chessx-${VERSION}
__SCRIPTDIR="${0%/*}"

if [ -d "$CNAME" ]; then
gtar -czf "${CNAME}.tgz" --exclude-from=$__SCRIPTDIR/tar_exclude.txt ./${CNAME}
gtar -czf "${CNAME}.tgz" --exclude-from=$__SCRIPTDIR/tar_exclude.txt ./chessx
mv "${CNAME}.tgz" ${DIR}/../Packages/
echo "Ready"
else
echo "Directory not found"
Expand Down

0 comments on commit 6fdd4f3

Please sign in to comment.