Skip to content

Add automated multi-platform builds#5

Open
midwan wants to merge 29 commits intoamiga-mui:masterfrom
midwan:master
Open

Add automated multi-platform builds#5
midwan wants to merge 29 commits intoamiga-mui:masterfrom
midwan:master

Conversation

@midwan
Copy link
Copy Markdown

@midwan midwan commented Feb 15, 2023

Summary

Automated CI/CD pipeline for building HTMLview on all supported platforms.

Features

  • Multi-platform builds: AmigaOS 3.x, AmigaOS 4.x, and MorphOS
  • Docker-based: Uses sacredbanana/amiga-compiler images for consistent builds
  • Tag-based releases: Creates GitHub releases with binaries when v* tags are pushed
  • Artifact upload: All built binaries are preserved as CI artifacts

Platforms

Platform Docker Image Status
AmigaOS 3.x sacredbanana/amiga-compiler:m68k-amigaos
AmigaOS 4.x sacredbanana/amiga-compiler:ppc-amigaos
MorphOS sacredbanana/amiga-compiler:ppc-morphos

Build Fixes Included

  • GCC 6.x compatibility fixes (libnix, dispatchers, hooks)
  • Heap corruption fix (delete[] vs delete in ImageCache)
  • MUI4 backfill fix for proper rendering
  • Memory pool initialization for C++ constructors
  • Compiler warnings cleanup

Release Process

  1. Push a tag:
  2. CI builds all platforms in parallel
  3. Release is created automatically with all binaries attached

@midwan
Copy link
Copy Markdown
Author

midwan commented Apr 6, 2023

Ping @jens-maus / @tboeckel ?

- Several changes to fix the code so that it compiles with the latest GCC 6.x from bebbo. It now builds correctly using amigadev/crosstools:m68k-amigaos for example.
- Added cross-compiling build scripts for Windows, which use the aforementioned docker image (they assume the docker engine and image is already installed).
- Fixed bugs that caused crashes on OS3.2 and MUI 5.x
- Fixed bug where no content was displayed on MUI 5.x
- Added a SimpleText tool, to test the library under OS3.x (haven't tested it elsewhere)
- Removed obsolete HTMLview-Test.c - the SimpleTest should cover the same thing
- Bumped version to 13.5
- Fix UtilityBase type conflict with SDK (use struct Library *)
- Replace CPPDISPATCHERENTRY with ENTRY for dispatcher gates
- Remove conflicting function stubs (SDK provides GetRPAttrs, etc.)
- Replace strlcpy/stccpy with portable strncpy for AppMessage code

These fixes enable successful compilation with sacredbanana/amiga-compiler:m68k-amigaos (GCC 6.5.0b)
Updates GitHub Actions CI to use the modern sacredbanana compiler
image which has better compatibility with GCC 6.x builds.
The early return when bounds didn't match exactly caused MUI4 to show
its checkerboard pattern instead of filled content. This fix removes
the conditional early return and ensures MUI4 always receives a
properly filled background region.

Fixes issue where a blue-checkered pattern appeared on MUI4/OS3
instead of HTML content.
- Use docker:// syntax instead of addnab/docker-run-action
- Update actions/checkout to v4, upload-artifact to v4
- Add concurrency control to cancel redundant builds
- Simplify and clean up workflow structure
- Use glob patterns for artifact paths
- Revert ENTRY to CPPDISPATCHERENTRY for _Dispatcher/_DispatcherP
  (C++ dispatchers need C gate wrapper for proper register handling)
- Fix heap corruption: delete[] instead of delete for array allocations
  in ImageCacheEntry destructor

These fixes enable HTMLview.mcc to work correctly on OS3.
- CI: add tag-based release trigger (v*) with automatic artifact uploads
- Fix: buffer size missing null terminator in Dispatcher.cpp
- Fix: delete[] mismatch in ImageManager.cpp destructor
Builds HTMLview for all supported platforms using sacredbanana docker images:
- AmigaOS 3.x: m68k-amigaos
- AmigaOS 4.x: ppc-amigaos
- MorphOS: ppc-morphos

Tag v* triggers release with all platform binaries attached.
@midwan midwan changed the title Add automated build jobs Add automated multi-platform builds Apr 15, 2026
SDI_hook.h: add MorphOS CPP dispatcher macros, fix extern linkage
SDI_hook.h: fix __amigaos4__ typo for OS4
General.h: uppercase MIN/MAX to avoid C++ std::min/max conflicts
Dispatcher.cpp: use ParseThread directly (not ENTRY macro)

Closes amiga-mui#3
This was referenced Apr 15, 2026
midwan added 14 commits April 15, 2026 17:02
Fixes undefined reference to _Dispatcher on OS4 caused by C++ name mangling.
- mcp/private.h: Add INCLUDE_VERSION < 45 check for NewObject declaration
- mcp/private.h: Add initPicClass forward declaration for MorphOS
- mcp/pic.c: Enable proto/exec.h include for NewRawDoFmt on MorphOS
- mcp/Makefile: Add -DUSEHOTKEY -DUSEBETTERSTRING for MorphOS
- mcc/Makefile: Skip -ldebug for OS4 SimpleTest (not in newlib SDK)
- mcc/Makefile: Skip SimpleTest target for OS4 (interface linking issues)
- mcc/Makefile: Add -lauto to OS4 LDLIBS
- Added LibLoad_Test.c: simulates external MUI app loading HTMLview.mcc
- Updated Makefile to build test programs for all platforms
- Updated CI workflow to include SimpleTest and LibLoad_Test in artifacts
- Only link with -ldebug when DEBUG is defined
- Add kprintf stub for OS4 in SimpleTest.c to allow building without debug
SimpleTest and LibLoad_Test now exercise the full MCC capability surface
(images, forms, tables, fonts, entities) and render both local PROGDIR:
files and plain-HTTP URLs through a shared image-load hook
(test_image_hook.h). HTTPS is rejected cleanly (stock bsdsocket has no
TLS) by aborting on any non-200 status code.

Core fixes required to make images render at all:

- IM_Render: RenderEngine::RenderEngine now zeroes FirstFrame. The
  LastFrame self-ref trick relies on it starting NULL, which the stack-
  allocated instance never guaranteed -- AllocateFrame's first-frame
  detection misfired and StatusItem->Start() was skipped.
- Dispatcher: DefaultLoadFunc now strips "file://" only when present;
  bare paths (PROGDIR:foo.png) used to get the first 7 chars sliced off.
- Hook wiring: m68k/MorphOS route through HookEntry trampoline so
  CallHookPkt's register args reach the plain-C handler; OS4 assigns
  TestImageHookFunc directly (HookEntry isn't declared there).
- LibLoad_Test: defer MUIA_HTMLview_Contents until after the window is
  open -- the image decoder needs a screen, which isn't known at
  MUI_NewObject time.
- test_image_hook.h: per-hook bsdsocket.library OpenLibrary with
  task-scoped shadow globals, so the socket base is valid in the
  decoder task (m68k bsdsocket is task-local).
- Makefile: copy testdata/test.png into bin_$(OS)/ for PROGDIR: loads;
  add -Wl,-u,_startu on OS4 so C++ static init runs.
Network image loading in test programs + local-image render fixes
Wire TLS into the test-program image hook so https:// URLs and
http->https 302 redirects resolve end-to-end.

- Makefile downloads the AmiSSL 5.27 SDK on demand (lha xq) and
  exposes the headers only; inline macros in <inline/amissl.h>
  dispatch through a task-local AmiSSLBase, so no stub lib link
  and no global symbols are required. Enabled for OS3 and OS4
  (MorphOS stays plain HTTP).
- test_image_hook.h: THL_State gains AmiSSL library bases, SSL
  context and connection, plus a sni_errno slot for AmiSSL_ErrNoPtr.
  THL_Recv/THL_Send dispatch via SSL_read/SSL_write when use_tls is
  set, with function-scope shadowed library bases for inline
  macros.
- URL parsing generalised: THL_ParseUrl replaces THL_ParseHttp and
  accepts both http and https (default ports 80/443).
- THL_Connect factors out TCP connect plus optional TLS wrap;
  THL_TlsWrap opens amisslmaster + amissl, InitAmiSSLMaster /
  OpenAmiSSL / InitAmiSSLA (A-suffixed because OS3 builds with
  -DNO_INLINE_STDARG), then SSL_CTX_new(TLS_client_method),
  SSL_new, SSL_set_fd, SSL_set_tlsext_host_name, SSL_connect.
  VERIFY_NONE for now — CA bundle wiring is a follow-up.
- THL_DoRequest sends the GET and parses status/headers; returns
  1 OK / 0 error / -1 redirect. THL_HttpOpen loops up to 5 hops
  so http://www.amigaworld.net/images/awn2.gif follows its 302 to
  HTTPS transparently.
- SimpleTest.c / LibLoad_Test.c: HTML adds a direct-HTTPS test
  entry (https://aminet.net/pics/aminet.png) alongside the
  existing HTTP entries.
- .gitignore: exclude the downloaded mcc/amissl_sdk/ tree.
awn2.gif redirects to HTTPS correctly, but the HTTPS endpoint returns
404 -- the server only hosts the image on plain HTTP. logo-top.gif
redirects to HTTPS and returns the image, which is the scenario we
actually want to exercise.
Codex review on PR #2 flagged two stack overflows where a
user-controllable value (Location: header up to 512 bytes, or a
redirected URL up to 1024 bytes) was formatted into a smaller
logbuf via unbounded sprintf.

Converted every sprintf(logbuf, ...) and the GET-request sprintf
to snprintf(...sizeof(buf)...). The hex-dump sprintfs are left as
sprintf since they're bounded at 16 bytes and can't overflow.

Fixes the P1 Location overflow and P2 unparseable-URL overflow
flagged by Codex.
- AUTHORS: add Dimitris Panokostas; bump Open Source Team copyright to
  2005-2026.
- README, TODO, doc/MCC_HTMLview.readme: bump copyright year.
- ChangeLog: log the HTTPS/AmiSSL work and the prior OS3/OS4/MorphOS
  build fix-ups under feat/https-support.
- doc/MCC_HTMLview.doc, mcc/HTMLview_mcc.h: clarify that HTMLview.mcc
  itself never touches the network or filesystem -- URL-scheme support
  lives entirely in the application's ImageLoadHook / LoadHook. Point
  readers at SimpleTest / LibLoad_Test as a reference hook that
  handles PROGDIR:, file://, http:// and (with AmiSSL) https:// with
  redirect following.
HTTPS support via AmiSSL + http->https redirect following
Bump mcc/mcp to 13.6 (date 20.04.2026, copyright 2005-2026) and
repackage the tag-driven CI release: each platform now ships as
HTMLview-<tag>-<platform>.zip with only the runtime binaries and
top-level docs, instead of loose artifacts that collided across
OS3/OS4/MorphOS under merge-multiple.
Extract the reference image/content load hook out of the per-consumer
`test_image_hook.h` blob and into a proper static library under
`mcc/net_hook/`. Host applications now link `libhtmlview_nethook.a` and
call `HTMLviewNet_InitHook(&hook)`; the hook opens bsdsocket / AmiSSL
lazily from the decoder task so hosts no longer need any OpenLibrary
plumbing of their own.

Adds three opt-in runtime knobs on top of the extraction:

- `HTMLviewNet_SetCABundle` / `SetVerifyMode` -- flip AmiSSL off the
  previous `SSL_VERIFY_NONE` default to auto-discovered peer verify
  (checks `AmiSSL:Certs/curl-ca-bundle.crt` and ENVARC mirrors),
  including hostname matching via `SSL_set1_host`.
- `HTMLviewNet_SetCacheDir` / `SetCacheTTL` -- simple on-disk response
  cache keyed by FNV-1a-64 of the URL, storing `<key>.body` + `.meta`
  pairs. Disabled by default; caps entries at 8 MB, non-chunked 200
  responses only. ETag revalidation is deferred to a follow-up.

Also fixes a latent CI break in `mcc/Makefile`: the `\$(AMISSL_SDK_READY)`
rule was defined before `all:`, so a bare `make OS=os3` used the SDK
fetch as the default goal and exited 0 without building anything. The
13.6 release job hit exactly this and silently uploaded an artifact
with no `.mcc` inside. Pinning `.DEFAULT_GOAL := all` at the top of the
file makes `make` build by default; the new `libhtmlview_nethook.a`
target and net_hook obj subdir are wired in alongside.

The full improvement plan / session handoff lives in IMPROVEMENTS.md.
The 13.6 release failed at the `cp` step because the preceding build
silently produced no `.mcc` binary (Makefile default-goal bug, fixed in
the companion commit). `upload-artifact`'s default `warn` mode made the
empty slot invisible until release-packaging time.

- Add `Verify build products` steps that `ls` each expected binary
  (`HTMLview.mcc`, `HTMLview.mcp`, `SimpleTest`, `LibLoad_Test`) so a
  missing product fails the build job itself.
- Set `if-no-files-found: error` on every `upload-artifact` so any
  future glob-match regression also fails at upload, not at release.
midwan added 2 commits April 20, 2026 19:51
- README: drop SourceForge + SVN references, point at the GitHub repo,
  document the Docker cross-build flow for OS3 / OS4 / MorphOS, describe
  linking `libhtmlview_nethook.a` with its optional runtime knobs.
- TODO: replace the placeholder `* ????` line with a short list of the
  pending buckets, pointing readers at IMPROVEMENTS.md for details.
- doc/MCC_HTMLview.readme: bump to 13.6, drop the "prototype" and v13-
  snapshot text, swap the SourceForge URL for GitHub, and cross-
  reference each long-standing limitation to its IMPROVEMENTS phase.
- IMPROVEMENTS.md: multi-session roadmap covering the whole backlog
  (phases 1-13). Phases 1, 2, 3, and 13 are marked delivered.
The 2005-2026 "HTMLview.mcc Open Source Team" line was overreaching -
original contributors only worked on the class through 2007. Replace it
with a narrow "2023-2026 Dimitris Panokostas" line on files I've
actively maintained, keeping the accurate "1997-2000 Allan Odgaard"
line. The new net_hook files drop Allan's attribution entirely since
they are wholly new code.

Historical files (~180) keep their accurate "2005-2007 by HTMLview.mcc
Open Source Team" attribution untouched.
The release step failed with "Resource not accessible by integration"
because the default GITHUB_TOKEN on this repo is read-only. Grant the
release job the minimum permission (contents:write) it needs to publish
the tag's release and upload the build artefacts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant