CKAN icon indicating copy to clipboard operation
CKAN copied to clipboard

[Feature]: Remove the Mono dependency on macOS

Open lewisfm opened this issue 1 year ago • 1 comments

Problem

Right now users on macOS need to install Mono independently of CKAN to use it. This is undesirable because it complicates the install process and doesn't support newer ARM devices without a translation layer (i.e. Rosetta 2).

Suggestion

CKAN could switch to a self-contained .NET 8 build for Mac because it doesn't need the WinForms feature of Mono. This seems to be as simple as using dotnet build with the right flags:

dotnet publish -r osx-arm64 -f net8.0 --self-contained Cmdline/CKAN-Cmdline.csproj
dotnet publish -r osx-x64 -f net8.0 --self-contained Cmdline/CKAN-Cmdline.csproj

file ./_build/out/CKAN-CmdLine/Release/bin/net8.0/osx-arm64/publish/CKAN-CmdLine
# --> "Mach-O 64-bit executable arm64"

./_build/out/CKAN-CmdLine/Release/bin/net8.0/osx-arm64/publish/CKAN-CmdLine consoleui

I needed to add this to each csproj to prevent the duplicate log4net.xml files being an issue:

<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>

The entire publish directory would have to be shipped because the output isn't single file, but that's probably okay because Mac apps are folders anyways.

There might be some differences between Mono and .NET 8 that could cause bugs, so it'd likely be worth making sure everything is working first.

Alternatives

No response

Additional context

No response

lewisfm avatar Apr 19 '25 07:04 lewisfm

Interesting. The .dmg is built here, if you want to try a PR:

https://github.com/KSP-CKAN/CKAN/blob/4fc8117ccc0688837369a8bfb800ef408f64b9d3/macosx/Makefile#L1-L46

I guess you'd also need to add new targets to Cake to run those publish commands. Or update the existing ones?

https://github.com/KSP-CKAN/CKAN/blob/a3053c4f1619d6f60f97e38fd67208d7ff680a05/build/MakeTasks.cs#L10-L17

And the startup script would need to be updated to run without Mono:

https://github.com/KSP-CKAN/CKAN/blob/4fc8117ccc0688837369a8bfb800ef408f64b9d3/macosx/CKAN#L1-L78

HebaruSan avatar Apr 19 '25 16:04 HebaruSan

If and when this is fixed, the KSPBurst Compiler description should be updated. (and possibly Harmony?)

Requires Mono on Linux and macOS (you have it if you're running CKAN).

Clayell avatar Aug 03 '25 05:08 Clayell