Re: [xz-devel] Go/Golang bindings for xz

2021-04-15 Thread Lasse Collin
Hello!

On 2021-04-12 James Fennell wrote:
> Over the last couple of weeks I've been working on a project to add
> Go bindings for the xz format: https://github.com/jamespfennell/xz

:-)

> The project uses the Go technology cgo to compile the relevant
> liblzma C files automatically and link them in with the Go binary.

That made me wonder about config.h and the #defines. With a really
quick look I found

https://github.com/jamespfennell/xz/blob/main/lzma/lzma.go

which sets a few #defines but it's quite limited, for example, a
comment tells that only 64-bit systems are supported. I also don't see
TUKLIB_FAST_UNALIGNED_ACCESS which is good on 32/64-bit x86 and some
ARMs to get a little better encoder performance. Also

#define TUKLIB_SYMBOL_PREFIX lzma_

could be good to have to ensure that all symbols begin with "lzma_".

Of course these don't matter if the system liblzma is used instead. I
understood that it's an option too.

> Lasse, would you be interested in adding a link under the bindings
> section of the xz website?

I can. Since there are other bindings to use liblzma, I wonder if some
of those should be listed too. What do you think? I have no Go
experience so I have no idea which are good or already popular.

Thanks!

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode



[xz-devel] Go/Golang bindings for xz

2021-04-12 Thread James Fennell
Hello,

Over the last couple of weeks I've been working on a project to add Go bindings 
for the xz format: https://github.com/jamespfennell/xz

The project uses the Go technology cgo to compile the relevant liblzma C files 
automatically and link them in with the Go binary. From the Go user's 
perspective it looks like a regular Go package and can be used with a single 
`go build` or `go get` invocation, even though its built from the liblzma C 
source. There are existing projects to support xz in Go, but they either (1) 
have a system dependency on liblzma which breaks the typical Go dependency 
setup, or (2) are written from scratch in Go and not as mature as the C 
implementation.

Right now the Go package only supports the basic xz use case of compressing 
(with one of the 10 presets) and decompressing. But the basic architecture has 
been figured out so more liblzma features could be exposed.

Lasse, would you be interested in adding a link under the bindings section of 
the xz website?

Best,
James