Skip to content

Conversation

@JanisErdmanis
Copy link

@JanisErdmanis JanisErdmanis commented Oct 23, 2025

This PR demonstrates the feasibility of bundling KomaMRI as a standalone installer using AppBundler. This required addressing relocation issues in multiple dependencies (Blink, Interact, InteractBase, Knockout, PlotlyJS, WebIO) that hardcode paths using @__DIR__. The solution uses Base.pkgdir(@__MODULE__) to make resource paths relocatable.

However, this approach has a limitation: when resource paths are set with global variables during module initialisation, Base.pkgdir(@__MODULE__) is not yet defined at __init__ time. This appears to be a Julia bug that would need to be addressed upstream.

So I added a @main entry point following https://docs.julialang.org/en/v1/manual/command-line-interface/#The-Main.main-entry-point. I did not find a proper way to wait for the Blink-based application, and there could be better ways to do that.

The build can be run with Build Release Assets under GitHub actions or locally with:

julia --project=meta meta/build.jl —build-dir=build

I tested the GitHub-generated builds for MacOS, Linux and Windows and can report that installation works and the installed applications are running on all platforms.

I temporarily added Manifest.toml and meta/Manifest.toml to this draft proposal to ensure the patches do not go out of sync until one upstreams them. This PR is not meant to be merged in the current form!

@cncastillo
Copy link
Member

Omg this is insane!!! thank you!!

I will try it out as soon as possible.

@JanisErdmanis
Copy link
Author

From the Slack discussion, Ian pointed out an issue (JuliaLang/julia#56077), which is also why pkgdir(@__MODULE__) in the __init__ is not defined. I tested it with Julia 1.12, and the issue is resolved, so we can eliminate the hairy bits from the patches to make them upstream-worthy. For backwards compatibility, one can use a pattern something like:

global some_dir::String

function __init__()
    global some_dir = isnothing(pkgdir(@__MODULE__)) ? (@__DIR__) : pkgdir(@__MODULE__)
end

Currently, I don't have the bandwidth to upstream the patches myself, as I am working on finishing AppBundler to claim the remaining funds from the NLNET before the end of this year.

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.

2 participants