mirror of
https://github.com/Neo-Desktop/WindowsXPKg
synced 2025-12-27 03:46:50 +02:00
236 lines
9.5 KiB
YAML
236 lines
9.5 KiB
YAML
# This file is a part of the UMSKT Project
|
|
#
|
|
# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.)
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
# @FileCreated by TheTank20 on 07/08/2025
|
|
# @Maintainer Neo
|
|
|
|
name: Windows x86+64
|
|
|
|
on:
|
|
push:
|
|
branches: [ "*" ]
|
|
paths-ignore: [ '**.md', 'doc/**', '.idea/**']
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x86
|
|
msystem: MINGW
|
|
cmake_flag: -m32
|
|
- arch: x64
|
|
msystem: MINGW64
|
|
cmake_flag: -m64
|
|
|
|
steps:
|
|
- name: Setup TDM-GCC
|
|
run: |
|
|
Write-Host Downloading TDM-GCC v10.3.0...
|
|
Invoke-WebRequest -Uri 'https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe' -OutFile 'C:\Windows\temp\TDM-GCC-64.exe'
|
|
Write-Host Creating directory...
|
|
New-Item -ItemType Directory -Path 'C:\TDM-GCC-64'
|
|
Write-Host Copying files [Set 1/3]...
|
|
Start-Process '7z' -ArgumentList 'e C:\Windows\temp\TDM-GCC-64.exe -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Copying files [Set 2/3]...
|
|
Start-Process '7z' -ArgumentList 'e C:\TDM-GCC-64\*.tar.xz -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Copying files [Set 3/3]...
|
|
Start-Process '7z' -ArgumentList 'x C:\TDM-GCC-64\*.tar -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Adding environment variables...
|
|
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
|
|
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
|
|
|
|
- name: Checkout Source Tree
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache OpenSSL 1.1.1
|
|
uses: actions/cache/restore@v4
|
|
id: cache-openssl
|
|
with:
|
|
path: |
|
|
${{ github.workspace }}/OpenSSL-TDM-${{ matrix.arch }}
|
|
key: openssl-1.1.1-${{ matrix.arch }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
|
|
- name: Setup MSYS2
|
|
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.arch == 'x86' && 'MINGW32' || 'MINGW64' }}
|
|
update: true
|
|
install: >-
|
|
mingw-w64-${{ matrix.arch == 'x86' && 'i686' || 'x86_64' }}-gcc
|
|
mingw-w64-${{ matrix.arch == 'x86' && 'i686' || 'x86_64' }}-make
|
|
mingw-w64-x86_64-perl
|
|
perl
|
|
git
|
|
|
|
- name: Checkout and Compile OpenSSL 1.1.1
|
|
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
|
shell: msys2 {0}
|
|
run: |
|
|
# Clone UMSKT's OpenSSL fork
|
|
echo "Cloning UMSKT OpenSSL fork..."
|
|
git clone https://github.com/UMSKT/openssl.git --branch OpenSSL_1_1_1-stable --depth 1 openssl-1.1.1
|
|
# Set up proper MSYS2 environment
|
|
export MSYS=winsymlinks:nativestrict
|
|
export MSYS2_PATH_TYPE=strict
|
|
export LANG=en_US.UTF-8
|
|
export PATH="/usr/bin:/mingw64/bin:$PATH"
|
|
export PATH="/c/TDM-GCC-64/bin:$PATH"
|
|
export MSYSTEM=${{ matrix.msystem }}
|
|
cd openssl-1.1.1
|
|
|
|
if [[ ${{ matrix.arch }} == "x86" ]]; then
|
|
/usr/bin/perl Configure mingw --prefix=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-${{ matrix.arch }} --openssldir=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-32 no-tests no-sse2 no-asm no-threads -DOPENSSL_DEV_NO_ATOMICS -mno-mmx -mno-sse -mno-sse2 -march=i686 -mtune=generic -Os -s -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fno-stack-protector
|
|
else
|
|
/usr/bin/perl Configure mingw64 --prefix=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-${{ matrix.arch }} --openssldir=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-64 no-tests no-asm -DOPENSSL_DEV_NO_ATOMICS -mno-mmx -Os -s -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fno-stack-protector
|
|
fi
|
|
mingw32-make -j
|
|
mingw32-make install_sw
|
|
cd ..
|
|
|
|
- name: Save OpenSSL 1.1.1
|
|
if: steps.cache-openssl.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
${{ github.workspace }}/OpenSSL-TDM-${{ matrix.arch }}
|
|
key: openssl-1.1.1-${{ matrix.arch }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
|
|
- name: Set OpenSSL Environment
|
|
shell: pwsh
|
|
run: |
|
|
echo "OPENSSL_ROOT=$env:GITHUB_WORKSPACE/OpenSSL-TDM-${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
echo "OPENSSL_LIBDIR=lib" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
echo "CMAKE_FLAGS=${{ matrix.cmake_flag }}" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
|
|
- name: Configure UMSKT
|
|
shell: pwsh
|
|
run: |
|
|
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
|
|
$OPENSSL_ROOT = "$env:OPENSSL_ROOT"
|
|
$OPENSSL_LIB = "$OPENSSL_ROOT/$env:OPENSSL_LIBDIR"
|
|
$OPENSSL_INC = "$OPENSSL_ROOT/include"
|
|
cmake -G "MinGW Makefiles" `
|
|
-DCMAKE_C_COMPILER="gcc" `
|
|
-DCMAKE_CXX_COMPILER="g++" `
|
|
-DOPENSSL_ROOT_DIR="$OPENSSL_ROOT" `
|
|
-DOPENSSL_INCLUDE_DIR="$OPENSSL_INC" `
|
|
-DOPENSSL_CRYPTO_LIBRARY="$OPENSSL_LIB/libcrypto.a" `
|
|
-DOPENSSL_SSL_LIBRARY="$OPENSSL_LIB/libssl.a" `
|
|
-DCMAKE_C_FLAGS="$env:CMAKE_FLAGS" `
|
|
-DCMAKE_CXX_FLAGS="$env:CMAKE_FLAGS" `
|
|
.
|
|
|
|
- name: Build UMSKT
|
|
shell: pwsh
|
|
run: |
|
|
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
|
|
mingw32-make
|
|
|
|
- name: Run tests
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host Test 1 - generating key
|
|
.\umskt.exe -b 2C -c 365 -s 069420 -v
|
|
Write-Host Test 2 - generatng confid
|
|
.\umskt.exe -i 253286028742154311079061239762245184619981623171292574
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: UMSKT-WinNT-${{ matrix.arch }}
|
|
path: umskt.exe
|
|
|
|
compress:
|
|
needs: build
|
|
if: success()
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x86
|
|
- arch: x64
|
|
steps:
|
|
- name: Setup TDM-GCC
|
|
run: |
|
|
Write-Host Downloading TDM-GCC v10.3.0...
|
|
Invoke-WebRequest -Uri 'https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe' -OutFile 'C:\Windows\temp\TDM-GCC-64.exe'
|
|
Write-Host Creating directory...
|
|
New-Item -ItemType Directory -Path 'C:\TDM-GCC-64'
|
|
Write-Host Copying files [Set 1/3]...
|
|
Start-Process '7z' -ArgumentList 'e C:\Windows\temp\TDM-GCC-64.exe -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Copying files [Set 2/3]...
|
|
Start-Process '7z' -ArgumentList 'e C:\TDM-GCC-64\*.tar.xz -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Copying files [Set 3/3]...
|
|
Start-Process '7z' -ArgumentList 'x C:\TDM-GCC-64\*.tar -oC:\TDM-GCC-64 -y' -Wait
|
|
Write-Host Adding environment variables...
|
|
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
|
|
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
|
|
|
|
- name: Setup UPX
|
|
run: |
|
|
Invoke-WebRequest -Uri 'https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-win64.zip' -OutFile 'C:\Windows\temp\upx.zip'
|
|
Write-Host Creating directory...
|
|
New-Item -ItemType Directory -Path 'C:\UPX'
|
|
Write-Host Copying files...
|
|
Expand-Archive -Path 'C:\Windows\temp\upx.zip' -DestinationPath 'C:\UPX'
|
|
Write-Host Adding environment variables...
|
|
$env:PATH = 'C:\UPX\upx-5.0.2-win64;' + $env:PATH
|
|
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
|
|
|
|
- name: Download ${{matrix.arch}} artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: UMSKT-WinNT-${{ matrix.arch }}
|
|
path: .
|
|
- name: Compress binaries
|
|
shell: pwsh
|
|
run: |
|
|
# Strip symbols
|
|
strip .\umskt.exe
|
|
|
|
# Remove resources
|
|
llvm-objcopy --remove-section .rsrc umskt.exe umskt_comp.exe
|
|
|
|
# Compress with UPX
|
|
& "C:\UPX\upx-5.0.2-win64\upx.exe" --best --ultra-brute .\umskt_comp.exe
|
|
|
|
# Replace original EXE
|
|
Remove-Item .\umskt.exe
|
|
Rename-Item -Path .\umskt_comp.exe -NewName umskt.exe
|
|
|
|
|
|
|
|
- name: Run tests
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host Test 1 - generating key
|
|
.\umskt.exe -b 2C -c 365 -s 069420 -v
|
|
Write-Host Test 2 - generatng confid
|
|
.\umskt.exe -i 253286028742154311079061239762245184619981623171292574
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: UMSKT-WinNT-${{ matrix.arch }}-Compressed
|
|
path: umskt.exe
|