From 30aaccc155555b8c6d7f7a02f2fb96adb1398854 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 27 May 2026 21:23:29 +0300 Subject: [PATCH] Fix build for Windows --- .github/workflows/build-watcom.yml | 13 ++++++++++++- .github/workflows/build-win32.yml | 13 ++++++++++++- .github/workflows/build-win64.yml | 14 ++++++++++++-- .github/workflows/build-winarm64.yml | 13 ++++++++++++- Makefile.Solaris | 2 ++ Makefile.msvc | 2 ++ Makefile.watcom | 2 ++ Makefile.win | 2 ++ 8 files changed, 56 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-watcom.yml b/.github/workflows/build-watcom.yml index 2db9af6..dd395f6 100644 --- a/.github/workflows/build-watcom.yml +++ b/.github/workflows/build-watcom.yml @@ -31,6 +31,17 @@ jobs: run: | echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c nmake /F Makefile.watcom + - name: Decode Certificate + shell: pwsh + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") + [System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte) + - name: Sign + shell: pwsh + run: | + $signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy.exe" + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy_crypt.exe" - name: make dist dir shell: cmd run: | @@ -48,7 +59,7 @@ jobs: mkdir dist\3proxy\doc\devel copy bin\3proxy.exe dist\3proxy\bin\ copy bin\*.dll dist\3proxy\bin\ - copy bin\mycrypt.exe dist\3proxy\bin\ + copy bin\3proxy_crypt.exe dist\3proxy\bin\ copy cfg\*.* dist\3proxy\cfg\ copy cfg\sql\*.* dist\3proxy\cfg\sql\ copy doc\ru\*.* dist\3proxy\doc\ru\ diff --git a/.github/workflows/build-win32.yml b/.github/workflows/build-win32.yml index 5c4e176..3fe6a7f 100644 --- a/.github/workflows/build-win32.yml +++ b/.github/workflows/build-win32.yml @@ -37,6 +37,17 @@ jobs: set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x86-windows-static/include" echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c nmake /F Makefile.msvc + - name: Decode Certificate + shell: pwsh + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") + [System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte) + - name: Sign + shell: pwsh + run: | + $signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy.exe" + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy_crypt.exe" - name: make dist dir shell: cmd run: | @@ -54,7 +65,7 @@ jobs: mkdir dist\3proxy\doc\devel copy bin\3proxy.exe dist\3proxy\bin\ copy bin\*.dll dist\3proxy\bin\ - copy bin\mycrypt.exe dist\3proxy\bin\ + copy bin\3proxy_crypt.exe dist\3proxy\bin\ copy cfg\*.* dist\3proxy\cfg\ copy cfg\sql\*.* dist\3proxy\cfg\sql\ copy doc\ru\*.* dist\3proxy\doc\ru\ diff --git a/.github/workflows/build-win64.yml b/.github/workflows/build-win64.yml index 2ba2669..d9aca65 100644 --- a/.github/workflows/build-win64.yml +++ b/.github/workflows/build-win64.yml @@ -28,7 +28,6 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v3 - name: make Windows MSVC - if: ${{ startsWith(matrix.target, 'windows') }} shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" @@ -39,6 +38,17 @@ jobs: echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c echo %NOW% / %RELEASE% / %BUILDDATE% / %VERSION% nmake /F Makefile.msvc + - name: Decode Certificate + shell: pwsh + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") + [System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte) + - name: Sign + shell: pwsh + run: | + $signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy.exe" + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy_crypt.exe" - name: make dist dir shell: cmd run: | @@ -56,7 +66,7 @@ jobs: mkdir dist\3proxy\doc\devel copy bin\3proxy.exe dist\3proxy\bin64\ copy bin\*.dll dist\3proxy\bin64\ - copy bin\mycrypt.exe dist\3proxy\bin64\ + copy bin\3proxy_crypt.exe dist\3proxy\bin64\ copy cfg\*.* dist\3proxy\cfg\ copy cfg\sql\*.* dist\3proxy\cfg\sql\ copy doc\ru\*.* dist\3proxy\doc\ru\ diff --git a/.github/workflows/build-winarm64.yml b/.github/workflows/build-winarm64.yml index 3ebcb06..83680b5 100644 --- a/.github/workflows/build-winarm64.yml +++ b/.github/workflows/build-winarm64.yml @@ -37,6 +37,17 @@ jobs: set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/arm64-windows-static/include" echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c nmake /F Makefile.msvc + - name: Decode Certificate + shell: pwsh + run: | + $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") + [System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte) + - name: Sign + shell: pwsh + run: | + $signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy.exe" + & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy_crypt.exe" - name: make dist dir shell: cmd run: | @@ -54,7 +65,7 @@ jobs: mkdir dist\3proxy\doc\devel copy bin\3proxy.exe dist\3proxy\bin64\ copy bin\*.dll dist\3proxy\bin64\ - copy bin\mycrypt.exe dist\3proxy\bin64\ + copy bin\3proxy_crypt.exe dist\3proxy\bin64\ copy cfg\*.* dist\3proxy\cfg\ copy cfg\sql\*.* dist\3proxy\cfg\sql\ copy doc\ru\*.* dist\3proxy\doc\ru\ diff --git a/Makefile.Solaris b/Makefile.Solaris index 1b73953..bbb611b 100644 --- a/Makefile.Solaris +++ b/Makefile.Solaris @@ -6,6 +6,8 @@ # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ +PREFIX ?= 3proxy_ +CRYPT_PREFIX ?= $(PREFIX) CC ?= cc CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL COUT = -o ./ diff --git a/Makefile.msvc b/Makefile.msvc index aad015b..f88d3e6 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -6,6 +6,8 @@ # Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver BUILDDIR = ../bin/ +PREFIX = 3proxy_ +CRYPT_PREFIX = 3proxy_ CC = cl VERSION = $(VERSION) BUILDDATE = $(BUILDDATE) diff --git a/Makefile.watcom b/Makefile.watcom index f9b199c..1ea8141 100644 --- a/Makefile.watcom +++ b/Makefile.watcom @@ -5,6 +5,8 @@ # Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver BUILDDIR = ../bin/ +PREFIX = 3proxy_ +CRYPT_PREFIX = 3proxy_ CC = cl CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE) COUT = /Fo diff --git a/Makefile.win b/Makefile.win index c2d4414..c603ac8 100644 --- a/Makefile.win +++ b/Makefile.win @@ -6,6 +6,8 @@ BUILDDIR = ../bin/ +PREFIX ?= 3proxy_ +CRYPT_PREFIX ?= $(PREFIX) CC ?= gcc CFLAGS ?= -O3 -flto CFLAGS += -fno-strict-aliasing -c -mthreads -DWITH_WSAPOLL -DWITH_ODBC