1515APP_NAME=" heidisql"
1616BUNDLE_NAME=" ${APP_NAME} .app"
1717APP_DIR=" $( pwd) /${BUNDLE_NAME} "
18+ LPI_FILE=" $( pwd) /heidisql.lpi"
1819
1920# Path to the already built Lazarus executable
2021EXECUTABLE_SRC=" $( pwd) /out/heidisql"
@@ -32,6 +33,33 @@ NOTARY_PROFILE="notarytool-profile"
3233
3334LOCALES_ZIP_URL=" https://www.heidisql.com/downloads/locale/HeidiSQL-locale.zip"
3435
36+
37+ # ## FUNCTION: get release version string from Lazarus project file
38+
39+ get_version_from_lpi () {
40+ local lpi=" $1 "
41+ [[ -f " $lpi " ]] || return 1
42+
43+ local major minor release build
44+ major=$( xmllint --xpath ' string(//CONFIG/ProjectOptions/VersionInfo/MajorVersionNr/@Value)' " $lpi " 2> /dev/null || true)
45+ minor=$( xmllint --xpath ' string(//CONFIG/ProjectOptions/VersionInfo/MinorVersionNr/@Value)' " $lpi " 2> /dev/null || true)
46+ release=$( xmllint --xpath ' string(//CONFIG/ProjectOptions/VersionInfo/RevisionNr/@Value)' " $lpi " 2> /dev/null || true)
47+ build=$( xmllint --xpath ' string(//CONFIG/ProjectOptions/VersionInfo/BuildNr/@Value)' " $lpi " 2> /dev/null || true)
48+
49+ if [[ -n " $major " && -n " $minor " ]]; then
50+ if [[ -n " $release " && -n " $build " ]]; then
51+ echo " ${major} .${minor} .${release} .${build} "
52+ else
53+ echo " ${major} .${minor} "
54+ fi
55+ return 0
56+ fi
57+ return 1
58+ }
59+
60+ APP_VERSION=" $( get_version_from_lpi " $LPI_FILE " || echo " 1.0" ) "
61+
62+
3563# ## INSTALL REQUIRED LIBRARIES VIA HOMEBREW
3664
3765# MySQL client (libmysqlclient.dylib)
@@ -80,11 +108,11 @@ cat > "${APP_DIR}/Contents/Info.plist" <<EOF
80108 <key>CFBundleDisplayName</key>
81109 <string>${APP_NAME} </string>
82110 <key>CFBundleIdentifier</key>
83- <string>com.example .${APP_NAME} </string>
111+ <string>com.${APP_NAME} .${APP_NAME} </string>
84112 <key>CFBundleVersion</key>
85- <string>1.0 </string>
113+ <string>${APP_VERSION} </string>
86114 <key>CFBundleShortVersionString</key>
87- <string>1.0 </string>
115+ <string>${APP_VERSION} </string>
88116 <key>CFBundleExecutable</key>
89117 <string>${APP_NAME} </string>
90118 <key>CFBundlePackageType</key>
0 commit comments