Update the build script to put the Orca extension into place.

Still need to do the symlinking yourself though.
This commit is contained in:
hjozwiak committed 2026-10-31 10:03:30 -04:00
1 parent 044c1063d7
commit e920543dcb
4 files changed
+213 -11

No files matched your search

+66 -5
View File
@@ -5,7 +5,7 @@ set -euo pipefail
usage() {
echo "Usage: $0 [-r] [build-directory [install-prefix]]"
echo "Build and install locally as a user, or system wide as root."
echo " -r Remove the installed helper instead of building."
echo " -r Remove the installed helper and Orca extension instead of building."
echo " -h Show this help."
}
@@ -35,6 +35,9 @@ prefix=${2:-"$defaultPrefix"}
installDir="${prefix%/}/libexec/wine-access"
installedFiles=(wine-access.exe wine-access.exe.so wine-access-menu.dll
wine-access-menu32.dll wine-access-menu-host32.exe)
orcaSourceDir="$projectDir/orca/wine_access"
orcaInstallDir="${prefix%/}/share/wine-access/orca/wine_access"
systemOrcaInstallDir="$systemPrefix/share/wine-access/orca/wine_access"
has_installation() {
local candidateDir=$1
@@ -47,16 +50,40 @@ has_installation() {
return 1
}
has_orca_extension() {
local candidateDir=$1
local extensionFile
for extensionFile in "$orcaSourceDir/"*.py; do
if [[ -e $extensionFile ]] && [[ -e "$candidateDir/${extensionFile##*/}" || -L "$candidateDir/${extensionFile##*/}" ]]; then
return 0
fi
done
return 1
}
if "$removeInstalled"; then
removedAny=false
if has_installation "$installDir"; then
for installedFile in "${installedFiles[@]}"; do
rm -f -- "$installDir/$installedFile"
done
echo "Removed Wine Access from $installDir"
elif (( EUID != 0 && $# < 2 )) && has_installation "$systemPrefix/libexec/wine-access"; then
echo "Only a system-wide installation was found. Run: sudo ./build.sh -r" >&2
exit 1
else
removedAny=true
fi
if has_orca_extension "$orcaInstallDir"; then
for extensionFile in "$orcaSourceDir/"*.py; do
if [[ -e $extensionFile ]]; then
rm -f -- "$orcaInstallDir/${extensionFile##*/}"
fi
done
echo "Removed Wine Access Orca extension from $orcaInstallDir"
removedAny=true
fi
if ! "$removedAny"; then
if (( EUID != 0 && $# < 2 )) && { has_installation "$systemPrefix/libexec/wine-access" || has_orca_extension "$systemOrcaInstallDir"; }; then
echo "Only a system-wide installation was found. Run: sudo ./build.sh -r" >&2
exit 1
fi
echo "No Wine Access installation found in $installDir"
fi
exit 0
@@ -103,6 +130,39 @@ check_prerequisites() {
fi
}
install_orca_extension() {
if ! command -v orca >/dev/null 2>&1; then
return 0
fi
local versionOutput majorVersion=""
versionOutput=$(orca --version 2>/dev/null || true)
if [[ $versionOutput =~ [Vv]ersion[[:space:]]+([0-9]+) ]]; then
majorVersion=${BASH_REMATCH[1]}
fi
if [[ -z $majorVersion ]]; then
echo "Orca was found, but its version could not be determined." >&2
echo "Skipping the Wine Access Orca extension, which requires Orca 51 or later." >&2
return 0
fi
if (( 10#$majorVersion < 51 )); then
echo "Orca $majorVersion was found, but the Wine Access Orca extension requires Orca 51 or later; skipping it."
return 0
fi
local extensionFile
for extensionFile in "$orcaSourceDir/"*.py; do
install -Dm644 "$extensionFile" "$orcaInstallDir/${extensionFile##*/}"
done
echo "Installed the Wine Access Orca extension to $orcaInstallDir"
echo "Orca discovers extensions only in each user's extension directory."
echo "To enable it, run as your normal user:"
echo " mkdir -p \"\${XDG_DATA_HOME:-\$HOME/.local/share}/orca/extensions\""
echo " ln -sT $orcaInstallDir \"\${XDG_DATA_HOME:-\$HOME/.local/share}/orca/extensions/wine_access\""
echo " orca --approve-extension wine_access"
echo "Then restart Orca. If wine_access already exists in that directory,"
echo "move it aside first, and approve again after each Wine Access update."
}
check_prerequisites
cmake \
@@ -115,3 +175,4 @@ cmake \
-DWINE_ACCESS_INSTALL_DIR:PATH=libexec/wine-access
cmake --build "$buildDir" --parallel
cmake --install "$buildDir"
install_orca_extension