From 648578c5a4ffd99074e7211ec5c395b39d6c280a Mon Sep 17 00:00:00 2001 From: harukasan Date: Fri, 9 Jan 2015 14:49:51 +0900 Subject: [PATCH 1/4] Fix package name in .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f82aea2..baee10a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ go: before_install: - sudo apt-get update -qq - - sudo apt-get install -qq libwebp + - sudo apt-get install -qq libwebp-dev From 8628328a9e99edd7ecdc5c796832139ed0fde224 Mon Sep 17 00:00:00 2001 From: harukasan Date: Fri, 9 Jan 2015 16:53:11 +0900 Subject: [PATCH 2/4] Build libwebp instead of using apt package libwebp-dev package is too old, because travis-ci VMs are based on Ubuntu 12.04. go-libwebp supports libwebp 4.0 or later. --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index baee10a..59e16ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,14 @@ go: before_install: - sudo apt-get update -qq - - sudo apt-get install -qq libwebp-dev + - sudo apt-get install -qq libjpeg-dev libpng-dev libtiff-dev libgif-dev + - > + cd /tmp + && wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.2.tar.gz + && tar xf libwebp-0.4.2.tar.gz + && cd libwebp-0.4.2 + && ./configure + && make + && sudo make install + - cd $HOME/gopath/src/github.com/harukasan/go-libwebp + - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH From 0b88ea9dc720d206be75b3bcd8bcc0b48bac7537 Mon Sep 17 00:00:00 2001 From: harukasan Date: Fri, 9 Jan 2015 16:55:34 +0900 Subject: [PATCH 3/4] Try to find example files in multiple directories which contains $GOPATH. Bacause $GOPATH supports multiple directories splitted by ":" like $PATH. --- test/util/util.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/util/util.go b/test/util/util.go index 2dc2398..c284b75 100644 --- a/test/util/util.go +++ b/test/util/util.go @@ -3,22 +3,36 @@ package util import ( "bufio" + "fmt" "image" "image/png" "io" "io/ioutil" "os" "path/filepath" + "strings" ) // GetExFilePath returns the path of specified example file. func GetExFilePath(name string) string { - return filepath.Join(os.Getenv("GOPATH"), "src/github.com/harukasan/go-libwebp/examples/images", name) + for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") { + path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/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)) } // GetOutFilePath returns the path of specified out file. func GetOutFilePath(name string) string { - return filepath.Join(os.Getenv("GOPATH"), "src/github.com/harukasan/go-libwebp/examples/out", name) + for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") { + path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/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")) } // OpenFile opens specified example file From 786042c4d9dd92c18df17aa34ff73a4206c14cba Mon Sep 17 00:00:00 2001 From: harukasan Date: Fri, 9 Jan 2015 17:04:24 +0900 Subject: [PATCH 4/4] Run tests of each libwebp versions. --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59e16ce..8777fe2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,18 @@ go: - 1.3 - 1.4 +env: + - LIBWEBP_VERSION="0.4.1" + - LIBWEBP_VERSION="0.4.2" + before_install: - sudo apt-get update -qq - sudo apt-get install -qq libjpeg-dev libpng-dev libtiff-dev libgif-dev - > cd /tmp - && wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.2.tar.gz - && tar xf libwebp-0.4.2.tar.gz - && cd libwebp-0.4.2 + && wget http://downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz + && tar xf libwebp-${LIBWEBP_VERSION}.tar.gz + && cd libwebp-${LIBWEBP_VERSION} && ./configure && make && sudo make install