From 0c785954dc201d79703cc33bdec71d69f4437efe Mon Sep 17 00:00:00 2001 From: Mickael Kerjean Date: Mon, 13 Jan 2020 13:45:52 +1100 Subject: [PATCH] improve (gcc): static build --- server/plugin/plg_image_light/deps/README.md | 4 ++++ server/plugin/plg_image_light/deps/src/libresize.h | 1 - server/plugin/plg_image_light/deps/src/libtranscode.h | 1 - server/plugin/plg_image_light/install.sh | 7 ++----- server/plugin/plg_image_light/lib_resize.go | 1 + 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/plugin/plg_image_light/deps/README.md b/server/plugin/plg_image_light/deps/README.md index ffa03029..196eedde 100644 --- a/server/plugin/plg_image_light/deps/README.md +++ b/server/plugin/plg_image_light/deps/README.md @@ -13,8 +13,12 @@ To test the libraries are working fine: # libtranscode: gcc -Wall -c src/libtranscode_test.c gcc -o main_transcode.bin libtranscode_test.o -lm -lpthread -L. -l:libtranscode.a +curl -O https://archive.kerjean.me/public/2020/sample.CR2 +./main_transcode.bin ./sample.CR2 # libresize: gcc -Wall -c src/libresize_test.c `pkg-config --cflags glib-2.0` gcc -o main_resize.bin libresize_test.o -lm -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -L. -l:libresize.a +curl -O https://archive.kerjean.me/public/2020/sample.jpg +./main_resize.bin ./sample.jpg ``` diff --git a/server/plugin/plg_image_light/deps/src/libresize.h b/server/plugin/plg_image_light/deps/src/libresize.h index 0504a3b9..088e190e 100644 --- a/server/plugin/plg_image_light/deps/src/libresize.h +++ b/server/plugin/plg_image_light/deps/src/libresize.h @@ -1,4 +1,3 @@ #include -#include int image_resize(const char *filename, void **buf, size_t *len, int size, int crop, int quality, int exif); diff --git a/server/plugin/plg_image_light/deps/src/libtranscode.h b/server/plugin/plg_image_light/deps/src/libtranscode.h index 4a298d30..54a2cf93 100644 --- a/server/plugin/plg_image_light/deps/src/libtranscode.h +++ b/server/plugin/plg_image_light/deps/src/libtranscode.h @@ -1,4 +1,3 @@ #include -#include int image_transcode_compute(const char* filename, int min_width); diff --git a/server/plugin/plg_image_light/install.sh b/server/plugin/plg_image_light/install.sh index 9a512388..8bb01f70 100755 --- a/server/plugin/plg_image_light/install.sh +++ b/server/plugin/plg_image_light/install.sh @@ -4,8 +4,5 @@ set -e SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" cd "$(dirname "$0")"/deps echo `pwd` -curl -s https://downloads.filestash.app/upload/libresize-linux-x86-64.a > libresize.a -curl -Ls https://downloads.filestash.app/upload/libresize-linux-headers.tar.gz | tar zxf - -C /usr/local/include/ - -curl -s https://downloads.filestash.app/upload/libtranscode-linux-x86-64.a > libtranscode.a -curl -Ls https://downloads.filestash.app/upload/libtranscode-linux-headers.tar.gz | tar zxf - -C /usr/local/include/ +curl -s https://downloads.filestash.app/upload/libresize_`uname -s`-`uname -m`.a > libresize.a +curl -s https://downloads.filestash.app/upload/libtranscode_`uname -s`-`uname -m`.a > libtranscode.a diff --git a/server/plugin/plg_image_light/lib_resize.go b/server/plugin/plg_image_light/lib_resize.go index 44911057..0aa997bb 100644 --- a/server/plugin/plg_image_light/lib_resize.go +++ b/server/plugin/plg_image_light/lib_resize.go @@ -3,6 +3,7 @@ package plg_image_light // #cgo CFLAGS: -I./deps/src // #cgo LDFLAGS: -lm -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -ldl -L./deps -l:libresize.a // #include "libresize.h" +// #include "glib-2.0/glib.h" import "C" import (