mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-07 13:38:17 -08:00
Fork and add module
The upstream harukasan/go-libwebp hasn't been updated in almost three years, so we're officially forking this into tidbyt/go-libwebp and making it a Go module.
This commit is contained in:
parent
7718986fb5
commit
dd1cead28d
12 changed files with 29 additions and 133 deletions
24
.travis.yml
24
.travis.yml
|
|
@ -1,24 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.6
|
||||
- 1.7
|
||||
- 1.8
|
||||
- tip
|
||||
env:
|
||||
- LIBWEBP_VERSION="0.5.0"
|
||||
- LIBWEBP_VERSION="0.5.1"
|
||||
- LIBWEBP_VERSION="1.1.0"
|
||||
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/cache
|
||||
sudo: false
|
||||
|
||||
before_install:
|
||||
- LIBWEBP_PREFIX=$HOME/cache/libwebp-${LIBWEBP_VERSION} make libwebp
|
||||
- cd $HOME/gopath/src/github.com/harukasan/go-libwebp
|
||||
- export CGO_CFLAGS="-I $HOME/cache/libwebp-${LIBWEBP_VERSION}/include"
|
||||
- export CGO_LDFLAGS="-L $HOME/cache/libwebp-${LIBWEBP_VERSION}/lib"
|
||||
- export LD_LIBRARY_PATH=$HOME/cache/libwebp-${LIBWEBP_VERSION}/lib:$LD_LIBRARY_PATH
|
||||
23
Dockerfile
23
Dockerfile
|
|
@ -1,23 +0,0 @@
|
|||
FROM alpine:3.4
|
||||
|
||||
RUN apk add --no-cache g++ make go
|
||||
|
||||
RUN mkdir -p /tmp/go-libwebp
|
||||
COPY Makefile /tmp/go-libwebp/Makefile
|
||||
|
||||
ENV LIBWEBP_PREFIX="/usr/local" \
|
||||
LIBWEBP_VERSION="0.5.1"
|
||||
RUN cd /tmp/go-libwebp && make libwebp
|
||||
|
||||
ENV GOPATH="/go" \
|
||||
WORKDIR="/go/src/github.com/harukasan/go-libwebp" \
|
||||
PATH="/go/bin:/usr/local/go/bin:$PATH" \
|
||||
CGO_CFLAGS="-I /usr/local/include" \
|
||||
CGO_LDFLAGS="-L /usr/local/lib" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
RUN mkdir -p $WORKDIR
|
||||
VOLUME $WORKDIR
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
CMD ["make", "test"]
|
||||
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
|||
repo = github.com/harukasan/go-libwebp
|
||||
repo = github.com/tidbyt/go-libwebp
|
||||
build_dir = /tmp
|
||||
cur_dir = $(shell pwd)
|
||||
libwebp_so = ${LIBWEBP_PREFIX}/lib/libwebp.so
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -1,8 +1,7 @@
|
|||
go-libwebp
|
||||
==========
|
||||
|
||||
[](https://travis-ci.org/harukasan/go-libwebp)
|
||||
[](https://godoc.org/github.com/harukasan/go-libwebp/webp)
|
||||
[](https://godoc.org/github.com/tidbyt/go-libwebp/webp)
|
||||
|
||||
A implementation of Go binding for [libwebp](https://developers.google.com/speed/webp/docs/api).
|
||||
|
||||
|
|
@ -20,8 +19,8 @@ The [examples](./examples) directory contains example codes and images.
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -52,8 +51,8 @@ import (
|
|||
"bufio"
|
||||
"image"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -86,8 +85,8 @@ import (
|
|||
"image"
|
||||
"time"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import (
|
|||
"bufio"
|
||||
"image"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
3
go.mod
Normal file
3
go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module github.com/tidbyt/go-libwebp
|
||||
|
||||
go 1.16
|
||||
|
|
@ -10,29 +10,24 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetExFilePath returns the path of specified example file.
|
||||
func GetExFilePath(name string) string {
|
||||
for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") {
|
||||
path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/examples/images", name)
|
||||
path := filepath.Join("../examples/images", name)
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return path
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf("%v does not exist in any directory which contains in $GOPATH", name))
|
||||
panic(fmt.Errorf("%v does not exist", path))
|
||||
}
|
||||
|
||||
// GetOutFilePath returns the path of specified out file.
|
||||
func GetOutFilePath(name string) string {
|
||||
for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") {
|
||||
path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/examples/out")
|
||||
path := "../examples/out"
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return filepath.Join(path, name)
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf("out directory does not exist in any directory which contains in $GOPATH"))
|
||||
panic(fmt.Errorf("out directory does not exist"))
|
||||
}
|
||||
|
||||
// OpenFile opens specified example file
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
package util_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
)
|
||||
|
||||
var PNGFiles = []string{
|
||||
"butterfly.png",
|
||||
"cosmos.png",
|
||||
"fizyplankton.png",
|
||||
"kinkaku.png",
|
||||
"yellow-rose-3.png",
|
||||
}
|
||||
|
||||
var WebPFiles = []string{
|
||||
"butterfly.webp",
|
||||
"cosmos.webp",
|
||||
"fizyplankton.webp",
|
||||
"kinkaku.webp",
|
||||
"yellow-rose-3.webp",
|
||||
}
|
||||
|
||||
func TestOpenFile(t *testing.T) {
|
||||
for _, file := range PNGFiles {
|
||||
util.OpenFile(file)
|
||||
}
|
||||
for _, file := range WebPFiles {
|
||||
util.OpenFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadFile(t *testing.T) {
|
||||
for _, file := range PNGFiles {
|
||||
util.ReadFile(file)
|
||||
}
|
||||
for _, file := range WebPFiles {
|
||||
util.ReadFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateFile(t *testing.T) {
|
||||
f := util.CreateFile("util_test")
|
||||
f.Write([]byte{'o', 'k'})
|
||||
f.Close()
|
||||
}
|
||||
|
||||
func TestReadWritePNG(t *testing.T) {
|
||||
for _, file := range PNGFiles {
|
||||
png := util.ReadPNG(file)
|
||||
util.WritePNG(png, "util_test_"+file)
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func TestDecodeAnimationInfo(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func TestEncodeAnimation(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/harukasan/go-libwebp/test/util"
|
||||
"github.com/harukasan/go-libwebp/webp"
|
||||
"github.com/tidbyt/go-libwebp/test/util"
|
||||
"github.com/tidbyt/go-libwebp/webp"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue