* How to create a package written in Go
@ 2023-10-24 18:26 jean franco osvarcha
2023-11-05 19:28 ` Csepp
0 siblings, 1 reply; 2+ messages in thread
From: jean franco osvarcha @ 2023-10-24 18:26 UTC (permalink / raw)
To: help-guix@gnu.org
Hello guix users.
I wanted to package the program nwg-look to edit my theme icons and others through a graphical interface because I am currently using Tiling Window Manager.
nwg-look is written in GO and its repository is at [[https://github.com/nwg-piotr/nwg-look]], theoretically its compilation is simple because you only have to do one:
-make build
-sudo make install
and reading the Makefile I can also do this manually:
build:
go build -v -o bin/nwg-look .
install
mkdir -p $(DESTDIR)/usr/share/nwg-look
mkdir -p $(DESTDIR)/usr/share/nwg-look/langs
mkdir -p $(DESTDIR)/usr/bin
mkdir -p $(DESTDIR)/usr/share/applications
mkdir -p $(DESTDIR)/usr/share/pixmaps
cp stuff/main.glade $(DESTDIR)/usr/share/nwg-look/
cp langs/* $(DESTDIR)/usr/share/nwg-look/langs/
cp stuff/nwg-look.desktop $(DESTDIR)/usr/share/applications/
cp stuff/nwgg-look.svg $(DESTDIR)/usr/share/pixmaps/
cp bin/nwg-look $(DESTDIR)/usr/bin
Which you could do this manually but it is not suitable in SDGuix.
Reading the documentation in the Manual and the Cookbook I could only rely on small sample examples to which I could come up with this ~nwg-look-osv.scm~ file.
(use-modules (guix licenses)
(guix utils)
(guix packages)
(guix download)
(guix build-system go)
(gnu packages golang)
(gnu packages xorg)
(gnu packages gtk)
(gnu packages pkg-config))
(package
(name "nwg-look-osv")
(version "0.2.4")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/nwg-piotr/nwg-look/releases/download/" "v" version "/nwg-look-v" version "_x86_64"
".tar.gz"))
(sha256
(base32
"1iphamazdsvl1cp59y8sxa3iswradna6z6rmm25nmpy3nxxbkapc"))))
(build-system go-build-system)
(synopsis "This application is a part of the nwg-shell project")
(description
"GTK3 settings editor adapted to work in the wlroots environment")
(home-page "https://github.com/nwg-piotr/nwg-look/")
(arguments
'(#:import-path "https://github.com/nwg-piotr/nwg-look/"))
(inputs
(list go
gtk+
xcur2png
pkg-config))
(license gpl3+))
But I can't get it to compile and install, if I do it manually in a ~guix shell go gtk+ xcur2png pkg-config~ and compile it on my own it does but I don't know how to install it and create the manifest.
I don't have much notion in Go and packaging in Guix, but I guide from all the examples of others packages, I tried to do it with trivial-build-system but it was messing me up, if anyone has a help or comment I'm happy to answer.
Sorry for my english I'm using a translator DeepL
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to create a package written in Go
2023-10-24 18:26 How to create a package written in Go jean franco osvarcha
@ 2023-11-05 19:28 ` Csepp
0 siblings, 0 replies; 2+ messages in thread
From: Csepp @ 2023-11-05 19:28 UTC (permalink / raw)
To: jean franco osvarcha; +Cc: help-guix
jean franco osvarcha <talkme@osvarcha.website> writes:
> Hello guix users.
>
> I wanted to package the program nwg-look to edit my theme icons and
> others through a graphical interface because I am currently using
> Tiling Window Manager.
> nwg-look is written in GO and its repository is at
> [[https://github.com/nwg-piotr/nwg-look]], theoretically its
> compilation is simple because you only have to do one:
>
> -make build
> -sudo make install
Yggdrasil is similar, I suggest using that as a template.
Sadly the Go importer doesn't handle Go module files on the CLI
interface, but you can:
a) use sed/grep/etc to get the package names from the go.mod files and
feed them into guix import go -r (xargs can help)
b) look into how the importer is implemented, it might have a go.mod
parser in there that you could use.
> and reading the Makefile I can also do this manually:
>
> build:
> go build -v -o bin/nwg-look .
>
> install
> mkdir -p $(DESTDIR)/usr/share/nwg-look
> mkdir -p $(DESTDIR)/usr/share/nwg-look/langs
> mkdir -p $(DESTDIR)/usr/bin
> mkdir -p $(DESTDIR)/usr/share/applications
> mkdir -p $(DESTDIR)/usr/share/pixmaps
> cp stuff/main.glade $(DESTDIR)/usr/share/nwg-look/
> cp langs/* $(DESTDIR)/usr/share/nwg-look/langs/
> cp stuff/nwg-look.desktop $(DESTDIR)/usr/share/applications/
> cp stuff/nwgg-look.svg $(DESTDIR)/usr/share/pixmaps/
> cp bin/nwg-look $(DESTDIR)/usr/bin
>
> Which you could do this manually but it is not suitable in SDGuix.
> Reading the documentation in the Manual and the Cookbook I could only
> rely on small sample examples to which I could come up with this
> ~nwg-look-osv.scm~ file.
Just call make DESTDIR=$output install, you don't need to replicate the
install steps. Sudo is not necessary.
> (use-modules (guix licenses)
> (guix utils)
> (guix packages)
> (guix download)
> (guix build-system go)
> (gnu packages golang)
> (gnu packages xorg)
> (gnu packages gtk)
> (gnu packages pkg-config))
>
> (package
> (name "nwg-look-osv")
> (version "0.2.4")
> (source (origin
> (method url-fetch)
> (uri (string-append "https://github.com/nwg-piotr/nwg-look/releases/download/" "v" version "/nwg-look-v" version "_x86_64"
> ".tar.gz"))
> (sha256
> (base32
> "1iphamazdsvl1cp59y8sxa3iswradna6z6rmm25nmpy3nxxbkapc"))))
> (build-system go-build-system)
> (synopsis "This application is a part of the nwg-shell project")
> (description
> "GTK3 settings editor adapted to work in the wlroots environment")
> (home-page "https://github.com/nwg-piotr/nwg-look/")
> (arguments
> '(#:import-path "https://github.com/nwg-piotr/nwg-look/"))
> (inputs
> (list go
> gtk+
> xcur2png
> pkg-config))
> (license gpl3+))
You need to put all the Go dependencies into the propagated-inputs
field. Or just putting them in inputs might also be fine.
Remember, Guix packages don't have access to the network during builds,
so Go can't automatically download dependencies.
> But I can't get it to compile and install, if I do it manually in a
> ~guix shell go gtk+ xcur2png pkg-config~ and compile it on my own it
> does but I don't know how to install it and create the manifest.
> I don't have much notion in Go and packaging in Guix, but I guide from
> all the examples of others packages, I tried to do it with
> trivial-build-system but it was messing me up, if anyone has a help or
> comment I'm happy to answer.
Yes, it works in guix shell because you have network access and Go
circumvents the distro packages.
> Sorry for my english I'm using a translator DeepL
It's quite alright, although I can't make any guarantees about how well
my message will get translated.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-05 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24 18:26 How to create a package written in Go jean franco osvarcha
2023-11-05 19:28 ` Csepp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).