Add script to patch Debian's NSIS with i486-capable binaries

This commit is contained in:
Adam Demasi 2024-09-16 12:55:50 +09:30
parent 12648d0fbd
commit cff8713162
No known key found for this signature in database
GPG key ID: 5D3B26B3D58C7D91
2 changed files with 36 additions and 0 deletions

View file

@ -38,6 +38,7 @@ jobs:
run: |
sudo apt-get update -q
sudo apt-get install -qy make nsis nsis-pluginapi mingw-w64-i686-dev cabextract
./build/fix-nsis.sh
- name: Install MinGW toolchain
run: |

35
build/fix-nsis.sh Normal file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# Fixes NSIS binaries so they run on Pentium/486. Debian's build of NSIS is compiled with MinGW,
# but they lack any -mcpu flag, so the binaries receive a default of i686. To fix this, we'll
# download the official Windows build of NSIS and extract its binaries. We only handle stubs though,
# because we provide our own plugin builds in this repo.
set -e
if [[ $UID != 0 ]]; then
echo "This script needs to be run as root (sorry)" >&2
exit 1
fi
if [[ ! -d /usr/share/nsis/Stubs ]]; then
echo "NSIS not installed, or Stubs directory is broken" >&2
exit 1
fi
if [[ -d /usr/share/nsis/Stubs_old ]]; then
echo "NSIS stubs are already fixed" >&2
exit 0
fi
apt-get install -qy curl p7zip-full
mkdir /tmp/nsis
cd /tmp/nsis
curl -fSL https://prdownloads.sourceforge.net/nsis/NSIS%203/3.10/nsis-3.10-setup.exe -o nsis.exe
7z x nsis.exe
mv /usr/share/nsis/Stubs{,_old}
cp -ra Stubs /usr/share/nsis/Stubs
rm -rf /tmp/nsis