forked from wal-g/wal-g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
link_brotli.sh
executable file
·25 lines (16 loc) · 718 Bytes
/
link_brotli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
test -d tmp/brotli || mkdir -p tmp/brotli
cp -rf vendor/github.com/google/brotli/* tmp/brotli/
cp -rf submodules/brotli/* vendor/github.com/google/brotli/
readonly CWD=$PWD
cd vendor/github.com/google/brotli/go/cbrotli
readonly LIB_DIR=../../dist # dist will contain binaries and it is in the google/brotli/.gitignore
# patch cgo.go to force usage of static libraries for linking
sed -i -e "s|#cgo LDFLAGS: -lbrotlicommon|#cgo CFLAGS: -I../../c/include|" cgo.go
sed -i -e "s|\(#cgo LDFLAGS:\) \(-lbrotli.*\)|\1 -L$LIB_DIR \2-static -lbrotlicommon-static|" cgo.go
sed -i -e "/ -lm$/ n; /brotlienc/ s|$| -lm|" cgo.go
mkdir -p ${LIB_DIR}
cd ${LIB_DIR}
../configure-cmake --disable-debug
make
cd ${CWD}