Skip to content

Add automated multi-platform builds#5

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

Add automated multi-platform builds#5
midwan wants to merge 36 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 #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.
midwan added 8 commits April 20, 2026 21:32
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.
Commit 6e678e4 removed the long-standing "stuntzi" early-return guard in
the MUIM_Backfill handler so MUI 4/5 would stop rendering as a blue
checkerboard. That regressed MUI 3.8 / 3.9, which need the guard to
avoid painting outside the gadget bounds.

Restore the guard but only apply it when MUIMasterBase->lib_Version <= 20
(MUI 3.9 = v20, MUI 3.8 = v19). MUI 4+ (v21+) keeps the unguarded path
introduced for the checkerboard fix. Verified working on both MUI 3.8
and MUI 5.
fix(backfill): restore MUI 3.x equality guard, gated on lib_Version
  * mcc/library.c: register ScrollGroupClass and StringClass via
    CPPDISPATCHERENTRY() instead of bare ENTRY(). On AmigaOS 3 the
    bare form passes the raw C++ dispatcher pointer to MUI, which then
    calls it with cl/obj/msg in registers a0/a2/a1 -- a calling
    convention the C++ function does not have. The result was a
    register-convention mismatch that crashed inside intuition.library
    with PC=0x2C2 the moment any caller tried to instantiate either
    private class via NewObject(mcc_Class, ...). The main HTMLview
    class was unaffected because mccinit.c already uses
    CPPDISPATCHERENTRY for it.
  * mcc/Dispatcher.cpp: harden the OM_NEW failure path. When
    AllocSignal(-1) returns -1 we used to call CoerceMethod(cl, obj,
    OM_DISPOSE), which re-enters our class's OM_DISPOSE against an
    instance whose parse thread, message port and ParseThreadName are
    not yet initialised. That tour of uninitialised state was harmless-
    ish on MUI 3.x but rebooted MUI 4/5 reliably. We now free only
    what the partial OM_NEW actually allocated (the SharedData) and
    defer to cl->cl_Super OM_DISPOSE, mirroring the pattern already
    used a few lines earlier for the SharedData allocation failure.
    Surfaces as "Error creating MOAI object" instead of a hard reset
    on signal-saturated tasks.
  * mcc/Dispatcher.cpp: MUIA_HTMLview_Scrollbars no longer wraps the
    gadget in a private ScrollGroupClass instance. Class-introspecting
    callers (RapaGUI / Hollywood) treat the OM_NEW return as "the
    HTMLview" and only translate their "Contents"/"URL"/etc.
    properties to MUIA_HTMLview_* when the object actually looks like
    one. The wrapper broke that detection, silently dropping property
    writes. Returning the bare gadget always lets the caller's
    introspection succeed. Apps that previously relied on us auto-
    wrapping should now wrap externally with MUIC_Scrollgroup; see
    mcc/SimpleTest.c for the canonical pattern. ScrollGroupClass is
    still registered for callers that wire it up directly via
    NewObject(mcc_Class, ...).
  * mcc/Debug.cpp, mcc/Makefile: DEBUG=1 builds on OS3 used to fail to
    link with a "multiple definition of kprintf" error -- Debug.cpp
    defined its own kprintf and -ldebug pulled in another. Guard the
    Debug.cpp definition with #ifndef DEBUG so it only compiles into
    release builds, where -ldebug is not linked.
  * mcc/RapaguiPattern_Test.c: new self-contained test program that
    mimics the bare creation pattern used by MOAI / RapaGUI hosts
    (no LoadHook tags, optionally signal-saturated via -burn N, and
    optionally creating multiple gadgets via -many N). Used during
    triage to reproduce the AllocSignal-failure path independently of
    Hollywood. Wired into the OS3/OS4/MorphOS Makefile alongside
    SimpleTest and LibLoad_Test.
BetterString.mcc and HotkeyString.mcc were hard runtime dependencies
of the preferences editor (MCP). If either was absent, MUI_NewObject
returned NULL and the NULL was passed as a MUI Child tag, crashing the
system.

- ostring(): try BetterStringObject first, fall back to StringObject
- CreatePrefsGroup(): pre-create HotkeyString+snoop HGroup; fall back
  to built-in Keyadjust when HotkeyString.mcc is absent
- InputClass: guard SimpleButton(Value) against NULL Value on
  <input type="button"> without a VALUE attribute
- Refresh README with runtime requirements table and changelog
fix: graceful fallback for missing external MCCs
@midwan
Copy link
Copy Markdown
Author

midwan commented May 2, 2026

Should I assume that since 3 years have passed and there has been no reply here, that PRs are not going to be merged ever?

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