From c7ae348ded9ea2afcd25697ab247266efb3f9a24 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 4 Oct 2024 16:33:44 +0100 Subject: [PATCH] Experimental 32-bit Windows workflow --- .github/workflows/windows-x86.yml | 53 +++++++++++++++++++++++++++++++ installer/mosquitto.nsi | 40 ++++++++++++++++------- 2 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/windows-x86.yml diff --git a/.github/workflows/windows-x86.yml b/.github/workflows/windows-x86.yml new file mode 100644 index 0000000000..c84586b649 --- /dev/null +++ b/.github/workflows/windows-x86.yml @@ -0,0 +1,53 @@ +name: Windows x86 build + +on: + workflow_dispatch: + push: + branches: [ "master", "fixes", "develop" ] + tags: [ "v[0-9]+.*" ] + pull_request: + branches: [ "master", "fixes", "develop" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + mosquitto: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + + - name: vcpkg build + uses: johnwason/vcpkg-action@v6 + id: vcpkg + with: + manifest-dir: ${{ github.workspace }} + triplet: x86-windows + token: ${{ github.token }} + github-binarycache: true + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_LIBWEBSOCKETS=ON -DWITH_TESTS=OFF -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows -DVCPKG_MANIFEST_MODE=ON + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - uses: suisei-cn/actions-download-file@v1.6.0 + id: vcredist + name: Download VC redistributable + with: + url: https://aka.ms/vs/17/release/vc_redist.x86.exe + target: ${{github.workspace}}/installer/ + + - name: Installer + uses: joncloud/makensis-action@v4 + with: + script-file: ${{github.workspace}}/installer/mosquitto.nsi + + - name: Upload installer to artifacts + uses: actions/upload-artifact@v4 + with: + name: installer + path: ${{ github.workspace }}/installer/mosquitto*.exe diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 40d8e4295f..d42aa0527f 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -47,8 +47,8 @@ Section "Files" SecInstall SetOutPath "$INSTDIR" File "..\logo\mosquitto.ico" File "..\build\src\Release\mosquitto.exe" - File "..\build\apps\mosquitto_passwd\Release\mosquitto_passwd.exe" File "..\build\apps\mosquitto_ctrl\Release\mosquitto_ctrl.exe" + File "..\build\apps\mosquitto_passwd\Release\mosquitto_passwd.exe" File "..\build\client\Release\mosquitto_pub.exe" File "..\build\client\Release\mosquitto_sub.exe" File "..\build\client\Release\mosquitto_rr.exe" @@ -63,12 +63,17 @@ Section "Files" SecInstall File "..\README.md" File "..\README-windows.txt" File "..\README-letsencrypt.md" - ;File "C:\pthreads\Pre-built.2\dll\x86\pthreadVC2.dll" - File "C:\OpenSSL-Win32\bin\libssl-1_1.dll" - File "C:\OpenSSL-Win32\bin\libcrypto-1_1.dll" + File "..\SECURITY.md" File "..\edl-v10" File "..\epl-v20" + File "..\build\vcpkg_installed\x86-windows-release\bin\cjson.dll" + File "..\build\vcpkg_installed\x86-windows-release\bin\libcrypto-3.dll" + File "..\build\vcpkg_installed\x86-windows-release\bin\libssl-3.dll" + File "..\build\vcpkg_installed\x86-windows-release\bin\pthreadVC3.dll" + File "..\build\vcpkg_installed\x86-windows-release\bin\uv.dll" + File "..\build\vcpkg_installed\x86-windows-release\bin\websockets.dll" + SetOutPath "$INSTDIR\devel" File "..\build\lib\Release\mosquitto.lib" File "..\build\lib\cpp\Release\mosquittopp.lib" @@ -93,6 +98,13 @@ Section "Files" SecInstall SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SectionEnd +Section "Visual Studio Runtime" + SetOutPath "$INSTDIR" + File "VC_redist.x86.exe" + ExecWait '"$INSTDIR\VC_redist.x86.exe" /quiet /norestart' + Delete "$INSTDIR\VC_redist.x86.exe" +SectionEnd + Section "Service" SecService ExecWait '"$INSTDIR\mosquitto.exe" install' ExecWait 'sc start mosquitto' @@ -104,36 +116,41 @@ Section "Uninstall" ExecWait '"$INSTDIR\mosquitto.exe" uninstall' Sleep 1000 + Delete "$INSTDIR\mosquitto.dll" Delete "$INSTDIR\mosquitto.exe" Delete "$INSTDIR\mosquitto_ctrl.exe" Delete "$INSTDIR\mosquitto_passwd.exe" Delete "$INSTDIR\mosquitto_pub.exe" - Delete "$INSTDIR\mosquitto_sub.exe" Delete "$INSTDIR\mosquitto_rr.exe" - Delete "$INSTDIR\mosquitto.dll" + Delete "$INSTDIR\mosquitto_sub.exe" Delete "$INSTDIR\mosquittopp.dll" Delete "$INSTDIR\mosquitto_dynamic_security.dll" Delete "$INSTDIR\aclfile.example" Delete "$INSTDIR\ChangeLog.txt" Delete "$INSTDIR\mosquitto.conf" Delete "$INSTDIR\pwfile.example" + Delete "$INSTDIR\NOTICE.md" Delete "$INSTDIR\README.md" Delete "$INSTDIR\README-windows.txt" Delete "$INSTDIR\README-letsencrypt.md" - ;Delete "$INSTDIR\pthreadVC2.dll" - Delete "$INSTDIR\libssl-1_1.dll" - Delete "$INSTDIR\libcrypto-1_1.dll" + Delete "$INSTDIR\SECURITY.md" Delete "$INSTDIR\edl-v10" Delete "$INSTDIR\epl-v20" Delete "$INSTDIR\mosquitto.ico" + Delete "$INSTDIR\cjson.dll" + Delete "$INSTDIR\libcrypto-3.dll" + Delete "$INSTDIR\libssl-3.dll" + Delete "$INSTDIR\pthreadVC3.dll" + Delete "$INSTDIR\uv.dll" + Delete "$INSTDIR\websockets.dll" + Delete "$INSTDIR\devel\mosquitto.h" - Delete "$INSTDIR\devel\mosquitto.lib" Delete "$INSTDIR\devel\mosquitto_broker.h" Delete "$INSTDIR\devel\mosquitto_plugin.h" Delete "$INSTDIR\devel\mosquittopp.h" - Delete "$INSTDIR\devel\mosquittopp.lib" Delete "$INSTDIR\devel\mqtt_protocol.h" + RMDir "$INSTDIR\devel\mosquitto" RMDir "$INSTDIR\devel" Delete "$INSTDIR\Uninstall.exe" @@ -151,4 +168,3 @@ LangString DESC_SecService ${LANG_ENGLISH} "Install mosquitto as a Windows servi !insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall) !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService) !insertmacro MUI_FUNCTION_DESCRIPTION_END -