|
| 1 | +name: Build Windows ARM64 (experimental) |
| 2 | + |
| 3 | +# Experimental native Windows ARM64 build. |
| 4 | +# - Runner: windows-11-arm (GitHub-hosted, public preview). |
| 5 | +# - Harbour libs and Scintilla DLLs are built from source for ARM64. |
| 6 | +# - Trigger is manual only until the pipeline stabilises; it is NOT |
| 7 | +# wired to "release: published" to avoid breaking the release flow. |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + upload_to_release: |
| 13 | + description: 'Upload artifact to a release tag (leave blank to skip)' |
| 14 | + required: false |
| 15 | + default: '' |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +env: |
| 21 | + ASSET: HbBuilder-1.0.0-windows-arm64.zip |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + name: Build (arm64, experimental) |
| 26 | + runs-on: windows-11-arm |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Set up MSVC (arm64) |
| 31 | + uses: ilammy/msvc-dev-cmd@v1 |
| 32 | + with: |
| 33 | + arch: arm64 |
| 34 | + |
| 35 | + - name: Show toolchain |
| 36 | + shell: cmd |
| 37 | + run: | |
| 38 | + where cl.exe |
| 39 | + where link.exe |
| 40 | + where nmake.exe |
| 41 | + cl.exe 2>&1 | findstr /C:"Version" /C:"ARM" |
| 42 | +
|
| 43 | + - name: Cache Harbour (ARM64) |
| 44 | + id: cache-harbour |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: C:\harbour |
| 48 | + key: harbour-win-arm64-v1 |
| 49 | + |
| 50 | + - name: Build Harbour (ARM64) if cache miss |
| 51 | + if: steps.cache-harbour.outputs.cache-hit != 'true' |
| 52 | + shell: cmd |
| 53 | + run: | |
| 54 | + git clone --depth 1 https://github.com/harbour/core C:\harbour-src |
| 55 | + cd /d C:\harbour-src |
| 56 | + set HB_COMPILER=msvcarm64 |
| 57 | + set HB_PLATFORM=win |
| 58 | + set HB_BUILD_PARTS=lib |
| 59 | + set HB_INSTALL_PREFIX=C:\harbour |
| 60 | + win-make.bat install |
| 61 | + if errorlevel 1 ( |
| 62 | + echo Harbour build failed |
| 63 | + exit /b 1 |
| 64 | + ) |
| 65 | + dir C:\harbour\lib\win\msvcarm64 |
| 66 | + dir C:\harbour\bin\win\msvcarm64 |
| 67 | +
|
| 68 | + - name: Build Scintilla + Lexilla (ARM64) |
| 69 | + shell: cmd |
| 70 | + run: | |
| 71 | + mkdir resources\scintilla_src 2>nul |
| 72 | + cd resources\scintilla_src |
| 73 | + if not exist scintilla\cocoa\ScintillaView.h ( |
| 74 | + curl -L -o scintilla556.tgz https://www.scintilla.org/scintilla556.tgz |
| 75 | + curl -L -o lexilla520.tgz https://www.scintilla.org/lexilla520.tgz |
| 76 | + tar xzf scintilla556.tgz |
| 77 | + tar xzf lexilla520.tgz |
| 78 | + del scintilla556.tgz lexilla520.tgz |
| 79 | + ) |
| 80 | + REM Lexilla |
| 81 | + cd lexilla\src |
| 82 | + nmake -f lexilla.mak DIR_O=..\bin DIR_BIN=..\bin |
| 83 | + if errorlevel 1 ( echo Lexilla build failed & exit /b 1 ) |
| 84 | + cd ..\.. |
| 85 | + REM Scintilla |
| 86 | + cd scintilla\win32 |
| 87 | + nmake -f scintilla.mak DIR_O=..\bin DIR_BIN=..\bin |
| 88 | + if errorlevel 1 ( echo Scintilla build failed & exit /b 1 ) |
| 89 | + cd ..\.. |
| 90 | + dir scintilla\bin |
| 91 | + dir lexilla\bin |
| 92 | + REM Stage DLLs where the loader expects them |
| 93 | + mkdir ..\arm64 2>nul |
| 94 | + copy /Y scintilla\bin\Scintilla.dll ..\arm64\ |
| 95 | + copy /Y lexilla\bin\Lexilla.dll ..\arm64\ |
| 96 | +
|
| 97 | + - name: Build HbBuilder (ARM64) |
| 98 | + shell: cmd |
| 99 | + run: | |
| 100 | + set HBDIR=C:\harbour |
| 101 | + set HBBIN=%HBDIR%\bin\win\msvcarm64 |
| 102 | + if not exist "%HBBIN%\harbour.exe" set HBBIN=%HBDIR%\bin |
| 103 | + set HBLIB=%HBDIR%\lib\win\msvcarm64 |
| 104 | + set HBINC=%HBDIR%\include |
| 105 | + set SRCDIR=%CD%\source |
| 106 | + set CPPDIR=%CD%\source\cpp |
| 107 | + set INCDIR=%CD%\include |
| 108 | + set OUTDIR=%CD%\bin |
| 109 | + if not exist "%OUTDIR%" mkdir "%OUTDIR%" |
| 110 | +
|
| 111 | + echo === Step 1: Harbour PRG -> C === |
| 112 | + cd /d "%SRCDIR%" |
| 113 | + "%HBBIN%\harbour.exe" hbbuilder_win.prg -n -w -es2 -q -I%HBINC% -I%INCDIR% |
| 114 | + if errorlevel 1 ( echo HARBOUR FAILED & exit /b 1 ) |
| 115 | +
|
| 116 | + echo === Step 2: cl.exe (arm64 host already set up by msvc-dev-cmd) === |
| 117 | + set CL_BASE=/c /O2 /W0 /EHsc /I"%HBINC%" /I"%INCDIR%" |
| 118 | + cl.exe %CL_BASE% hbbuilder_win.c /Fohbbuilder_win.obj |
| 119 | + if not exist hbbuilder_win.obj ( echo CL FAILED hbbuilder_win.c & exit /b 1 ) |
| 120 | +
|
| 121 | + for %%f in (tform hbbridge tcontrol tcontrols hb_db_real) do ( |
| 122 | + if exist "%CPPDIR%\%%f.cpp" ( |
| 123 | + cl.exe %CL_BASE% "%CPPDIR%\%%f.cpp" /Fo%%f.obj |
| 124 | + if not exist %%f.obj ( echo CL FAILED %%f.cpp & exit /b 1 ) |
| 125 | + ) |
| 126 | + ) |
| 127 | +
|
| 128 | + echo === Step 2b: Resources === |
| 129 | + rc.exe /nologo /fohbbuilder_win.res hbbuilder_win.rc |
| 130 | + set RES_OBJ= |
| 131 | + if exist hbbuilder_win.res set RES_OBJ=hbbuilder_win.res |
| 132 | +
|
| 133 | + echo === Step 3: Link (arm64) === |
| 134 | + set OBJS=hbbuilder_win.obj tform.obj hbbridge.obj tcontrol.obj tcontrols.obj hb_db_real.obj %RES_OBJ% |
| 135 | + link.exe /NOLOGO /SUBSYSTEM:WINDOWS /MACHINE:ARM64 /NODEFAULTLIB:LIBCMT ^ |
| 136 | + /OUT:"%OUTDIR%\hbbuilder_win_arm64.exe" ^ |
| 137 | + /LIBPATH:"%HBLIB%" ^ |
| 138 | + %OBJS% ^ |
| 139 | + hbrtl.lib hbvm.lib hbcpage.lib hblang.lib hbrdd.lib hbmacro.lib hbpp.lib ^ |
| 140 | + hbcommon.lib hbcplr.lib hbct.lib hbhsx.lib hbsix.lib hbusrrdd.lib ^ |
| 141 | + rddntx.lib rddnsx.lib rddcdx.lib rddfpt.lib hbdebug.lib hbpcre.lib ^ |
| 142 | + hbzlib.lib hbsqlit3.lib sqlite3.lib ^ |
| 143 | + gtwin.lib gtwvt.lib gtgui.lib ^ |
| 144 | + user32.lib gdi32.lib comctl32.lib comdlg32.lib shell32.lib ole32.lib ^ |
| 145 | + oleaut32.lib advapi32.lib ws2_32.lib winmm.lib msimg32.lib gdiplus.lib ^ |
| 146 | + winspool.lib ucrt.lib vcruntime.lib msvcrt.lib |
| 147 | + if errorlevel 1 ( echo LINK FAILED & exit /b 1 ) |
| 148 | + dir "%OUTDIR%\hbbuilder_win_arm64.exe" |
| 149 | +
|
| 150 | + - name: Package |
| 151 | + shell: pwsh |
| 152 | + run: | |
| 153 | + $stage = "HbBuilder-1.0.0-windows-arm64" |
| 154 | + New-Item -ItemType Directory -Force -Path "$stage\bin","$stage\resources\arm64" | Out-Null |
| 155 | + Copy-Item "bin\hbbuilder_win_arm64.exe" "$stage\bin\" |
| 156 | + Copy-Item "resources\arm64\Scintilla.dll" "$stage\resources\arm64\" |
| 157 | + Copy-Item "resources\arm64\Lexilla.dll" "$stage\resources\arm64\" |
| 158 | + if (Test-Path "resources\icons") { Copy-Item -Recurse "resources\icons" "$stage\resources\" } |
| 159 | + if (Test-Path "resources\harbour_logo.png") { Copy-Item "resources\harbour_logo.png" "$stage\resources\" } |
| 160 | + @" |
| 161 | + HbBuilder v1.0.0 — Windows ARM64 (experimental) |
| 162 | + =============================================== |
| 163 | + Native Windows 11 ARM64 build. Requires an ARM64 PC |
| 164 | + (Surface Pro X / 9 / 11, Snapdragon X, etc). |
| 165 | + Run: bin\hbbuilder_win_arm64.exe |
| 166 | + DLLs in resources\arm64\ must remain alongside the exe. |
| 167 | + https://github.com/FiveTechSoft/HarbourBuilder |
| 168 | + "@ | Set-Content "$stage\README.txt" |
| 169 | + Compress-Archive -Path $stage -DestinationPath $env:ASSET -Force |
| 170 | + Get-Item $env:ASSET | Select-Object Name,Length |
| 171 | +
|
| 172 | + - uses: actions/upload-artifact@v4 |
| 173 | + with: |
| 174 | + name: ${{ env.ASSET }} |
| 175 | + path: ${{ env.ASSET }} |
| 176 | + |
| 177 | + - name: Upload to release |
| 178 | + if: github.event_name == 'workflow_dispatch' && inputs.upload_to_release != '' |
| 179 | + uses: softprops/action-gh-release@v2 |
| 180 | + with: |
| 181 | + tag_name: ${{ inputs.upload_to_release }} |
| 182 | + files: ${{ env.ASSET }} |
0 commit comments