Skip to content

Commit

Permalink
Apply the InternalVersion patch too #94
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Apr 14, 2023
1 parent ed5b3d0 commit d1162e6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
17 changes: 17 additions & 0 deletions build.sh
Expand Up @@ -49,6 +49,23 @@ require cp curl mkdir patch sed tar
}

# Patch the source with our hook code.
for patchName in qnetworkaccessmanager winmakefile; do
patchFile="$(canonicalDirName "${BASH_SOURCE[0]}")/$patchName.patch"
targetFile="$(sed -Ene '1s/^---[[:blank:]]+([^[:blank:]]+)[[:blank:]].*$/\1/p' "$patchFile")"
[[ -e "$OUTPUT_DIR/$QT_NAME/${targetFile%.*}.ori" ]] || {
echo "Backing up ${targetFile##*/}"
"$CP" -a \
"$OUTPUT_DIR/$QT_NAME/$targetFile" \
"$OUTPUT_DIR/$QT_NAME/${targetFile%.*}.ori"
echo "Applying ${patchFile##*/}"
"$PATCH" --directory "$OUTPUT_DIR/$QT_NAME" --forward --strip 0 < "$patchFile" || {
rc=$?
[[ "$rc" -eq 1 ]] || exit "$rc"
echo 'Assuming patch is already applied and continuing'
}
}
done

networkAccessDir="$OUTPUT_DIR/$QT_NAME/qtbase/src/network/access/"
[[ -e "$networkAccessDir/qnetworkaccessmanager.ori" ]] || {
echo 'Backing up qnetworkaccessmanager.cpp'
Expand Down
25 changes: 16 additions & 9 deletions update-diff.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -o errexit -o noclobber -o nounset -o pipefail # or set -Ceuo pipefail
set -o errexit -o noclobber -o nounset -o pipefail
shopt -s inherit_errexit

: "${QT_VERSION:=5.15.2}" # The version used by Polar FlowSync.
Expand All @@ -20,11 +20,18 @@ function require {

require diff

echo "Updating $SCRIPT_DIR/qnetworkaccessmanager.patch"
pushd "$OUTPUT_DIR/$QT_NAME"
mv ./qtbase/src/network/access/qnetworkaccessmanager.cpp ./qtbase/src/network/access/qnetworkaccessmanager.new
mv ./qtbase/src/network/access/qnetworkaccessmanager.ori ./qtbase/src/network/access/qnetworkaccessmanager.cpp
"$DIFF" -u './qtbase/src/network/access/qnetworkaccessmanager'.{cpp,new} >| "$SCRIPT_DIR/qnetworkaccessmanager.patch" || true
mv ./qtbase/src/network/access/qnetworkaccessmanager.cpp ./qtbase/src/network/access/qnetworkaccessmanager.ori
mv ./qtbase/src/network/access/qnetworkaccessmanager.new ./qtbase/src/network/access/qnetworkaccessmanager.cpp
popd
for patchName in qnetworkaccessmanager winmakefile; do
patchFile="$SCRIPT_DIR/$patchName.patch"
echo "Updating $patchFile"
pushd "$OUTPUT_DIR/$QT_NAME" > /dev/null
targetFile="$(sed -Ene '1s/^---[[:blank:]]+([^[:blank:]]+)[[:blank:]].*$/\1/p' "$patchFile")"
for fileName in "$targetFile" "${targetFile%.*}.ori"; do
[[ -s "$fileName" ]] || { echo "File does not exist, or is empty: $fileName" >&2; exit 1; }
done
mv "$targetFile" "${targetFile%.*}.new"
mv "${targetFile%.*}.ori" "$targetFile"
"$DIFF" -u "${targetFile%.*}".{cpp,new} >| "$patchFile" || true
mv "$targetFile" "${targetFile%.*}.ori"
mv "${targetFile%.*}.new" "$targetFile"
popd > /dev/null
done
8 changes: 4 additions & 4 deletions winmakefile.patch
@@ -1,10 +1,10 @@
--- qtbase\qmake\generators\win32\winmakefile.cpp Mon Aug 26 04:04:06 2013
+++ qtbase\qmake\generators\win32\winmakefile.new Wed Oct 8 17:41:01 2014
@@ -465,6 +465,7 @@
--- ./qtbase/qmake/generators/win32/winmakefile.cpp 2020-10-27 19:02:11.000000000 +1100
+++ ./qtbase/qmake/generators/win32/winmakefile.new 2023-04-14 12:17:30.671308371 +1000
@@ -385,6 +385,7 @@
ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"\n";
ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"\n";
ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"\n";
+ ts << "\t\t\t\tVALUE \"InternalName\", \"Bipolar Hook 2\\0\"\n";
+ ts << "\t\t\t\tVALUE \"InternalName\", \"Bipolar Hook 3\\0\"\n";
ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"\n";
ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"\n";
ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"\n";

0 comments on commit d1162e6

Please sign in to comment.