[archiver] Use Brotli implementation that allows static building.

This commit is contained in:
Ciprian Dorin Craciun 2021-11-17 20:40:04 +02:00
parent a53d4be6e7
commit 1622a7516c
4 changed files with 9 additions and 4 deletions

View file

@ -134,7 +134,7 @@
build \ build \
-v \ -v \
-mod readonly \ -mod readonly \
-tags 'netgo nobrotli' \ -tags 'netgo brotli' \
-ldflags 'all=-s -extld=gcc -extldflags=-static' \ -ldflags 'all=-s -extld=gcc -extldflags=-static' \
-gcflags 'all=-l=4' \ -gcflags 'all=-l=4' \
-o "${_outputs}/binaries/release/kawipiko-archiver" \ -o "${_outputs}/binaries/release/kawipiko-archiver" \
@ -186,7 +186,7 @@
build \ build \
-v \ -v \
-mod readonly \ -mod readonly \
-tags 'netgo nobrotli' \ -tags 'netgo brotli' \
-ldflags 'all=-s -extld=gcc -extldflags=-static' \ -ldflags 'all=-s -extld=gcc -extldflags=-static' \
-gcflags 'all=-l=4' \ -gcflags 'all=-l=4' \
-o "${_outputs}/binaries/release/kawipiko" \ -o "${_outputs}/binaries/release/kawipiko" \

View file

@ -8,6 +8,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2 // indirect github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2 // indirect
github.com/google/brotli v1.0.7 github.com/google/brotli v1.0.7
github.com/itchio/go-brotli v0.0.0-20190702114328-3f28d645a45c // indirect
github.com/klauspost/compress v1.7.6 // indirect github.com/klauspost/compress v1.7.6 // indirect
github.com/klauspost/cpuid v1.2.1 // indirect github.com/klauspost/cpuid v1.2.1 // indirect
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect

View file

@ -12,6 +12,8 @@ github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2 h1:VA6jElpcJ+wkwE
github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2/go.mod h1:Yi95+RbwKz7uGndSuUhoq7LJKh8qH8DT9fnL4ewU30k= github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2/go.mod h1:Yi95+RbwKz7uGndSuUhoq7LJKh8qH8DT9fnL4ewU30k=
github.com/google/brotli v1.0.7 h1:fxwwohNEPaVS6qvtnjwgzRR62Upa70pkw0f9qarjrQs= github.com/google/brotli v1.0.7 h1:fxwwohNEPaVS6qvtnjwgzRR62Upa70pkw0f9qarjrQs=
github.com/google/brotli v1.0.7/go.mod h1:XpGqLY1HgMKTQI5TU8iAKE/okaKqS9h1e6KRlRztlOU= github.com/google/brotli v1.0.7/go.mod h1:XpGqLY1HgMKTQI5TU8iAKE/okaKqS9h1e6KRlRztlOU=
github.com/itchio/go-brotli v0.0.0-20190702114328-3f28d645a45c h1:Jf20xV/yR/O6eSUqLTuXhka/+54YR59sGwN7b3MkxYk=
github.com/itchio/go-brotli v0.0.0-20190702114328-3f28d645a45c/go.mod h1:oRXh43p/JW9kWosasd+2kHfDpb1ec4m7YrZ5E39s1iI=
github.com/klauspost/compress v1.4.0 h1:8nsMz3tWa9SWWPL60G1V6CUsf4lLjWLTNEtibhe8gh8= github.com/klauspost/compress v1.4.0 h1:8nsMz3tWa9SWWPL60G1V6CUsf4lLjWLTNEtibhe8gh8=
github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.7.6 h1:GH2karLOcuZtA5a3+KuzSU33A2cvcHGbtEWM6K4t7oU= github.com/klauspost/compress v1.7.6 h1:GH2karLOcuZtA5a3+KuzSU33A2cvcHGbtEWM6K4t7oU=

View file

@ -7,7 +7,7 @@ package archiver
import "bytes" import "bytes"
import "github.com/google/brotli/go/cbrotli" import brotli "github.com/itchio/go-brotli/enc"
@ -16,7 +16,9 @@ func CompressBrotli (_data []byte) ([]byte, string, error) {
_buffer := & bytes.Buffer {} _buffer := & bytes.Buffer {}
_encoder := cbrotli.NewWriter (_buffer, cbrotli.WriterOptions { Quality : 11, LGWin : 24}) _options := brotli.BrotliWriterOptions { Quality : 11, LGWin : 24}
_encoder := brotli.NewBrotliWriter (_buffer, &_options)
if _, _error := _encoder.Write (_data); _error != nil { if _, _error := _encoder.Write (_data); _error != nil {
return nil, "", _error return nil, "", _error