Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build? #84

Open
josephschito opened this issue Mar 22, 2024 · 8 comments
Open

How to build? #84

josephschito opened this issue Mar 22, 2024 · 8 comments

Comments

@josephschito
Copy link

josephschito commented Mar 22, 2024

I didn't get if there is any way to build it to be a macos or windows program...

@AndyObtiva
Copy link
Collaborator

AndyObtiva commented Mar 22, 2024

Check out the packaging section under Glimmer DSL for LibUI:
https:/AndyObtiva/glimmer-dsl-libui#packaging

LibUI is a low-level C-style binding. It is not meant to be used directly. Glimmer DSL for LibUI enables using this LibUI binding the Ruby way with about half the code or less using a Ruby DSL + Data-Binding support.

OCRAN is the most up-to-date library for packaging on Windows:
https:/Largo/ocran

Mac and Linux packaging are not officially supported yet. They're in the future plan of the project, but lower in priority compared to other things. That said, one approach that could be attempted is WASI packaging and then WASI to Native package conversion. You can read about that in the packaging instructions I shared above. If you get it working, please contribute a README update via a PR about it.

@kojix2
Copy link
Owner

kojix2 commented Mar 22, 2024

Hi Joseph Schito

If you mean "compile libui source code," you generally do not need to build it, because each gem contains binary files for each OS. However, this does not always work. If you find any problems, please report them to us.

As for building an executable application, Andy answered.

I always use Glimmer DSL when I create personal tools, but there may be opportunities to use LibUI directly in cases where I want to reduce dependencies as much as possible. (For example, when using it as part of a library.)

@rubyFeedback
Copy link
Collaborator

rubyFeedback commented Apr 8, 2024

I didn't get if there is any way to build it to be a macos or windows program.

You can, on windows, just install the libui gem. The same code you write on Linux works on
Windows too (for libui-ng). I tested that on windows too and it works. Try the rubio gem
from kojix2 to test on windows or just a hello world example - it should work fine after
having installed kojix2' gem. That is the big advantage of libui-ng overall - it is really
simple for simple GUIs. (Unfortunately libui-ng itself could need quite some extensions
and additions to make it really neat, but for simple things it is really great, super-fast
development for prototyping things, and it works on windows.)

If you mean for re-distribution and packaging for other folks, you could try to use the
method described by kojix2 somewhere on the README. This should work too, although
I last tried in some months ago.

@josephschito
Copy link
Author

josephschito commented Apr 10, 2024

Thanks everybody!

Perhaps I have found a solution for MacOS, I used Traveling Ruby and Platypus together (I'm writing an article about it).
At the moment, I have written a very minimalistic tutorial to do it: https://dev.to/josephschito/create-macos-application-desktop-with-pure-ruby-tutorial-36io

Let me know what you think about it! 🙏

The application:
MyApp.zip

@AndyObtiva
Copy link
Collaborator

Thanks for sharing the article. It’s very interesting. I’ll have to spend some time trying out the instructions, hopefully sometime tomorrow.

@AndyObtiva
Copy link
Collaborator

AndyObtiva commented Apr 12, 2024

Sorry for the delay. I finally got a chance to test the instructions, and they worked with a Glimmer DSL for LibUI desktop application!

Thank you @josephschito

The next step would be to automate all of the work under a glimmer command rake task (Platypus is scriptable I believe).

If you're up for it, you can contribute it to this file:
https:/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task.rb

And, delegate work to this file:
https:/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task/package.rb

Then submit a Pull Request to Glimmer DSL for LibUI so that people can package Mac apps by simply running:

glimmer package

That's what's currently already 100% supported by Glimmer DSL for SWT, albeit with JRuby:
https:/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md

It would be great to have that automatic packaging support for the Mac under standard Ruby (MRI/CRuby) too.

@kojix2
Copy link
Owner

kojix2 commented Apr 13, 2024

I'm not familiar with Platypus, so I'll give it a try next time I have time.

@josephschito
Copy link
Author

josephschito commented Apr 16, 2024

Sorry for the delay. I finally got a chance to test the instructions, and they worked with a Glimmer DSL for LibUI desktop application!

Thank you @josephschito

The next step would be to automate all of the work under a glimmer command rake task (Platypus is scriptable I believe).

If you're up for it, you can contribute it to this file: https:/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task.rb

And, delegate work to this file: https:/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task/package.rb

Then submit a Pull Request to Glimmer DSL for LibUI so that people can package Mac apps by simply running:

glimmer package

That's what's currently already 100% supported by Glimmer DSL for SWT, albeit with JRuby: https:/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md

It would be great to have that automatic packaging support for the Mac under standard Ruby (MRI/CRuby) too.

I'll take a look on that definitively!
I found this to write the Platypus script: https://sveinbjorn.org/files/manpages/platypus.man.html

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

No branches or pull requests

4 participants