From 1c7d9e3b320ab0a6852e2714cd45fe9559831c6a Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 1 Dec 2025 15:02:40 +0900 Subject: [PATCH] Remove tessdata submodules and update install scripts Deleted tessdata, tessdata_best, and tessdata_fast submodules. Updated DownloadUrls.psd1 to fix Python x86 URL and set gtk3runtime arm64 to null. Improved architecture detection in postInstall.ps1 and cleaned up component selection logic. Modified setup.iss to remove exclusions for tessdata assets and cleaned up run/uninstall sections. --- app/assets/tessdata | 1 - app/assets/tessdata_best | 1 - app/assets/tessdata_fast | 1 - data/DownloadUrls.psd1 | 4 ++-- postInstall.ps1 | 46 +++++++++++++++++++++++++++++----------- setup.iss | 8 +------ 6 files changed, 37 insertions(+), 24 deletions(-) delete mode 160000 app/assets/tessdata delete mode 160000 app/assets/tessdata_best delete mode 160000 app/assets/tessdata_fast diff --git a/app/assets/tessdata b/app/assets/tessdata deleted file mode 160000 index ced7875..0000000 --- a/app/assets/tessdata +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ced78752cc61322fb554c280d13360b35b8684e4 diff --git a/app/assets/tessdata_best b/app/assets/tessdata_best deleted file mode 160000 index e12c65a..0000000 --- a/app/assets/tessdata_best +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e12c65a915945e4c28e237a9b52bc4a8f39a0cec diff --git a/app/assets/tessdata_fast b/app/assets/tessdata_fast deleted file mode 160000 index 8741641..0000000 --- a/app/assets/tessdata_fast +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 87416418657359cb625c412a48b6e1d6d41c29bd diff --git a/data/DownloadUrls.psd1 b/data/DownloadUrls.psd1 index 78f6e51..9e69ecc 100644 --- a/data/DownloadUrls.psd1 +++ b/data/DownloadUrls.psd1 @@ -5,7 +5,7 @@ python = @{ x64 = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-embed-amd64.zip" arm64 = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-embed-arm64.zip" - x86 = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-embed-arm64.zip" + x86 = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embed-win32.zip" } # =========================== @@ -58,7 +58,7 @@ # =========================== gtk3runtime = @{ x64 = "https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2022-01-04/gtk3-runtime-3.24.31-2022-01-04-ts-win64.exe" - arm64 = # no official ARM64 build + arm64 = $null # no official ARM64 build x86 = "https://downloads.sourceforge.net/project/gtk-win/files/GTK%2B%20Runtime%20Environment/GTK%2B%202.24/gtk2-runtime-2.24.10-2012-10-10-ash.exe/download" } diff --git a/postInstall.ps1 b/postInstall.ps1 index b3c1f42..3a16ca4 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -25,7 +25,7 @@ else { } # ================================ -# LOAD DOWNLOAD URL TABLE (DownloadUrls.psd1) +# LOAD DOWNLOAD URL TABLE (DownloadUrls.psd1 in /data folder) # ================================ $DownloadUrls = @{} $urlsFilePath = Join-Path $ScriptRoot "data/DownloadUrls.psd1" @@ -150,9 +150,8 @@ $AllComponentsSelected = $true if ($Components -and $Components.Trim() -ne "") { $SelectedComponents = - $Components - .Split(",") - | ForEach-Object { $_.Trim().ToLowerInvariant() } + $Components.Split(",") | + ForEach-Object { $_.Trim().ToLowerInvariant() } $AllComponentsSelected = $false } @@ -181,13 +180,36 @@ Write-Host "" # ================================ # ARCHITECTURE DETECTION # ================================ -$arch = $env:PROCESSOR_ARCHITECTURE +function Get-NativeArchitecture { + # 0 = x86, 5 = ARM, 9 = x64 + # https://learn.microsoft.com/windows/win32/cimwin32prov/win32-processor + $arch = $null -if ($arch -eq "AMD64") { $arch = "x64" } -elseif ($arch -eq "ARM64") { $arch = "arm64" } -elseif ($arch -eq "x86") { $arch = "x86" } -elseif ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { $arch = "x64" } -elseif ($env:PROCESSOR_ARCHITEW6432 -eq "ARM64") { $arch = "arm64" } + try { + $proc = Get-CimInstance -ClassName Win32_Processor -ErrorAction Stop | + Select-Object -First 1 + + switch ($proc.Architecture) { + 0 { $arch = "x86" } # 32-bit Intel/AMD + 5 { $arch = "arm64" } # treat ARM as arm64 target + 9 { $arch = "x64" } # 64-bit Intel/AMD + default { $arch = "x86" } # fallback + } + } + catch { + # Fallback: only 32/64 bit detection if WMI/CIM is not available + if ([System.Environment]::Is64BitOperatingSystem) { + $arch = "x64" + } + else { + $arch = "x86" + } + } + + return $arch +} + +$arch = Get-NativeArchitecture Write-Host "[*] Detected architecture: $arch" Write-Host "" @@ -727,8 +749,8 @@ try { # Find and run VC_redist.x86.exe inside Nmap installation directory $searchDirs = @() - if ($env:"ProgramFiles(x86)") { - $searchDirs += (Join-Path $env:"ProgramFiles(x86)" "Nmap") + if (${env:ProgramFiles(x86)}) { + $searchDirs += (Join-Path ${env:ProgramFiles(x86)} "Nmap") } if ($env:ProgramFiles) { $searchDirs += (Join-Path $env:ProgramFiles "Nmap") diff --git a/setup.iss b/setup.iss index a24d439..48282cd 100644 --- a/setup.iss +++ b/setup.iss @@ -70,7 +70,7 @@ Source: "installService.bat"; DestDir: "{app}"; Source: "uninstallService.bat"; DestDir: "{app}"; Source: "postInstall.ps1"; DestDir: "{app}"; Source: "helloworld.*"; DestDir: "{app}"; -Source: "app\*"; Excludes: "assets\img\_templates,assets\tessdata\*,assets\tessdata_best\*,assets\tessdata_fast\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs; +Source: "app\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs; Source: "lib\*"; DestDir: "{app}/lib"; Flags: ignoreversion recursesubdirs; ; Source: "bin\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; Flags: ignoreversion recursesubdirs; Source: "data\*"; Excludes: "*-apikey.txt"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs; @@ -90,18 +90,12 @@ Name: "{group}\Test {cm:AppName}"; Filename: "{app}\bootstrap.bat"; AfterInstall Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall: SetElevationBit('{group}\Uninstall {cm:AppName}.lnk'); [Run] -; Filename: {app}\bin\gtk2-runtime-2.24.33-2021-01-30-ts-win64.exe; -; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe; -; Filename: {app}\bin\nmap-7.92\npcap-1.50.exe; Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\postInstall.ps1"" -TelemetryProvider posthog -TelemetryApiKey ""{cm:PostHogApiKey}"" -Version ""{cm:AppVersion}"" -DistinctId ""{computername}"" -Components ""{code:GetSelectedComponents}"""; WorkingDir: "{app}"; Components: artifacts; Flags: waituntilterminated Filename: {app}\installService.bat; Components: artifacts; Flags: nowait Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Components: artifacts; Flags: nowait [UninstallRun] Filename: {app}\uninstallService.bat; Components: artifacts; Flags: waituntilterminated -; Filename: {code:GetProgramFiles}\GTK2-Runtime Win64\gtk2_runtime_uninst.exe; -; Filename: {code:GetProgramFiles}\Npcap\Uninstall.exe; -; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe; [CustomMessages] AppName=WelsonJS