Re: First example of g-golf (hello world) not working

Zelphir Kaltstahl <[email protected]> Mon, 5 May 2025 13:18:30 +0000
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
On 16.04.25 13:11, Zelphir Kaltstahl wrote:
> On 14.04.25 22:26, pelzflorian (Florian Pelz) wrote:
>> Hello Zelphir.
>>
>> Zelphir Kaltstahl<[email protected]> writes:
>>> I have many questions now.
>>>
>>> (1) So, if I understand correctly G-Golf applications can only be run
>>> with the help of Guix tooling like `wrap-program`? Unless I somehow
>>> set all the environment variables, that are in the wrapper script, by
>>> myself to run my own code, instead of examples?
>> The quick and dirty --no-grafts way should not be complicated. You
>> already did everything, except in your Makefile setup, I presume it is
>> enough to add gtk to guix-env/manifest.scm.
>>
>> By David’s recommendation, as an alternative to pure GTK, imitate the
>> G-Golf adw-1 examples instead of gtk-4 examples.  Then you additionally
>> add libadwaita.  (David wrote adw, but the Guix package is called
>> libadwaita.)  Or perhaps you also need more dependencies like
>> guile-cairo-next in the gtk-4 animated-paintable example.
>>
>>
>>> (2) How do other people develop apps with G-Golf? Everyone using Guix
>>> and immediately defining packages in the same way as the gtk 4
>>> examples?
>> If do not go the quick and dirty route, make a proper GNU Autotools
>> build system.  guile-hall can set up these GNU Autotools project files
>> automatically.  Then write a normal Guix package, but with inputs and a
>> phase wrap-binaries like g-golf-adw-1-examples or g-golf-gtk-4-examples,
>> but without inheriting or the other phases that just patch file paths
>> and Makefiles specific to G-Golf.  Only then you need not use
>> --no-grafts.
>>
>> This is a proper non-Guix-specific build system and a Guix package.  Do
>> not use Guix’ computed-file.  But for personal not security-sensitive
>> use (e.g. the app does *not* deal with networking or user files), no
>> need to do this, your --no-grafts Makefile is fine.
>>
>>
>>> (3) Can I somehow easily run the wrapper script, but then run my own
>>> code, instead of the example?
>> You can probably alternatively copy the g-golf-gtk-4-examples’ generated
>> wrapper script and adapt it, so you do not need --no-grafts, but this
>> would be the most complicated way and likely to break.  Best stick with
>> your Makefile with gtk in the manifest, or do the guile-hall setup.
>>
>> Hope it helps.
>>
>> Regards,
>> Florian
>
> Hi!
>
> I hope to re-read and try what you both describe soon!
>
> I think I still got questions, but maybe those will become obsolete/cleared 
> when I get to try things.
>
> Thank you both for your input and responses!
>
> Best regards,
> Zelphir

Hi!

I've gotten it working!

I still had some confusion, as I didn't understand, that the example code is run 
as a script, but when I realized that it is run as a script, it became clear to 
me, why one could run it using "./main.scm" instead of calling Guile directly 
"guile main.scm" or similar. I have now a working Makefile to easily run the code.

The project I am envisioning relies heavily on a GTKTreeView. Is there any 
example of that anywhere? (I hope it really is supported/available in G-Golf!)

I guess otherwise I have to rewrite some example like 
https://docs.gtk.org/gtk3/treeview-tutorial.html into Guile code?

That's another thing I still need to grasp: From where to import what and to 
learn the naming conventions of G-Golf.

But so far things seem to be working!

Best regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl, https://codeberg.org/ZelphirKaltstahl