refaktor / rye-fyne

Fyne GUI library with Rye language.
https://ryelang.org
Apache License 2.0
14 stars 2 forks source link

DEPLOY: About releases... #38

Open xplshn opened 1 month ago

xplshn commented 1 month ago

Hi! Awesome project, been wanting to test this but I was not able to build the fyne-binded rye for Musl... It'd be great if releases were made by a bot, and also, releasing static binaries would be appreciated, specially for my project, dbin (I want to add rye and rye-fyne to the repos, currently only rye has been added since we could not get rye-fyne to build, not even as dynamic nor static).

Is creating a GH Action workflow that builds the tagged version of rye + the main branch of it after every commit considered? Would simplify a lot of things, and would mean that all rye binaries could be added to Toolpacks (the repo that dbin uses, the requirement is that all binaries be static, (work on musl&glibc and even mlibc,etc))

refaktor commented 1 month ago

Hi, thank you. I was just watching and reading about dbin before, when I noticed your follow, liking it's minimalistic static approach. I just now saw what leve of "static" you are talking about.

I have no experience with Musl. I read just now about it. How did you try to build rye-fyne with musl and how did it fail? Please provide some more information so I can try to find a solution.

Did you also try building just normal rye, without fyne?

I was just adding automatic builds with github workflows. You can see the latest result here: https://github.com/refaktor/rye-fyne/releases/tag/26 I'm not sure if you meant something like these , let me know.

xplshn commented 1 month ago

Hi, sorry for the late response

Did you also try building just normal rye, without fyne?

Yes, it builds statically, and it works well, just like most Go programs, no issues on that front

I have no experience with Musl. I read just now about it. How did you try to build rye-fyne with musl and how did it fail? Please provide some more information so I can try to find a solution.

I don't think it has to do with Musl, (the failure I mean), I was not able to build rye-fyne neither statically linked nor dynamically linked, I'm trying to build it again

xplshn commented 1 month ago

UPDATE: I was able to build it on Alpine But I was not able to build it statically. Maybe .dwfs.AppBundle releases could be provided? Or using any other portable format such as AppImages?

Btw, using a Musl system as the host that builds Rye, either Rye or Rye-fyne would result in much smaller binaries.

refaktor commented 1 month ago

The problem with your initial build was that it expected rye in a neighboring folder. I commented the temporary replace line in go.mod and it should work now. I changed it to local/relative folder when I was making a rye-fyne android app demo this weekend.

I will have to educate myself more on this ... I'm not sure what is dwfs.AppBundle ... google didn't really help. I see AppImages but I also will need to do some reading.

I will look into building it on Musl based system.

Are you able to statically build Fyne's hello world program (without rye)?

xplshn commented 1 month ago

The problem with your initial build was that it expected rye in a neighboring folder. I commented the temporary replace line in go.mod and it should work now. I changed it to local/relative folder when I was making a rye-fyne android app demo this weekend.

I will have to educate myself more on this ... I'm not sure what is dwfs.AppBundle ... google didn't really help. I see AppImages but I also will need to do some reading.

heh, its my own format, it can be found at github.com/xplshn/pelf, I was so frustrated by the AppImage ecosystem that I wound up making my own format, tho converting AppImages to AppBundles is a matter of just decompressing the AppImage and using pelf to repackage it as an appbundle

I will look into building it on Musl based system.

Are you able to statically build Fyne's hello world program (without rye)?

No, I realized that fyne itself looks for the libgl libraries and others, which means that it cannot be made static via simply passing -static to the linker, so we have to use a format such as AppImages, or AppBundles, or any other alternatives that provide a way to launch programs on all ABIs of the same arch&kernel.

For now, I've made a basic AppDir of rye-fyne, which should work in both glibc and musl. I'll package it as an AppBundle and provide a link for it if you'd like to take a look.

image

xplshn commented 1 month ago

Here it is, just do gunzip <./fyne.dwfs.AppBundle.gz, then chmod +x ./fyne.dwfs.AppBundle and run! :)

If you'd like to inspect the AppBundle, the pelf repo has pelf_extract, which lets you extract the AppDir from the AppBundle

rye-fyne.dwfs.AppBundle.gz

refaktor commented 1 month ago

I downloaded it gunzipped and it ran. I haven't yet delved deeper. So something like rye-fyne would be more portable in this format. I read a little about appImage, I will more. So you think the build process that you made could be automated via a github workflow?

xplshn commented 1 month ago

I downloaded it gunzipped and it ran. I haven't yet delved deeper. So something like rye-fyne would be more portable in this format. I read a little about appImage, I will more. So you think the build process that you made could be automated via a github workflow?

Yeah, absolutely, I can provide a script that does this for you if you want :) Could even generate various formats at once if you'd want that

xplshn commented 1 month ago

I made a script that uses an alpine container to build rye & rye-fyne, it then packs rye-fyne into a dwfs.AppBundle

image

You can read the gen.sh script, which starts the build process, the initial script (gen.sh) creates an Alpine container, and it then enters the container to start the actual build process (Rye_multibuild.sh)

NOTEs: The generated ./rye-fyne will run on Musl-only, but the ./ryeFyne.dwfs.AppBundle should work on all systems NOTE 2: The ./rye binary is truly statically linked, it should work on all Linux systems of the same architecture NOTE 3: The binaries are unstripped

ryeBuildScript.tar.gz ryeFyne.dwfs.AppBundle.gz

refaktor commented 1 month ago

Wow, thanks a lot! I will try to integrate these into git workflows and generate additional binaries / appbundles. Thank you!

xplshn commented 1 month ago

I expect great things from this project! Keep up the good work! And feel free to reach out to me if you want me to write more of these for other rye-related tools and repos, such as the rye-gio one, once that is more stable :)