LibUI icon indicating copy to clipboard operation
LibUI copied to clipboard

How to build?

Open josephschito opened this issue 1 year ago • 8 comments

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

josephschito avatar Mar 22 '24 11:03 josephschito

Check out the packaging section under Glimmer DSL for LibUI: https://github.com/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://github.com/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.

AndyObtiva avatar Mar 22 '24 11:03 AndyObtiva

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.)

kojix2 avatar Mar 22 '24 13:03 kojix2

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.

rubyFeedback avatar Apr 08 '24 17:04 rubyFeedback

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

josephschito avatar Apr 10 '24 16:04 josephschito

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

AndyObtiva avatar Apr 11 '24 01:04 AndyObtiva

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://github.com/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task.rb

And, delegate work to this file: https://github.com/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://github.com/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.

AndyObtiva avatar Apr 12 '24 20:04 AndyObtiva

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

kojix2 avatar Apr 13 '24 07:04 kojix2

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://github.com/AndyObtiva/glimmer-dsl-libui/blob/master/lib/glimmer/rake_task.rb

And, delegate work to this file: https://github.com/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://github.com/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

josephschito avatar Apr 16 '24 09:04 josephschito