From 8ff78a998a7ed2ba3f1931eebc43b77e5e0d3572 Mon Sep 17 00:00:00 2001 From: yihuang Date: Tue, 21 Feb 2023 09:59:31 +0800 Subject: [PATCH] Add `grocksdb_no_link` build flag to remove builtin link flags (#106) user can have full control through CGO_LDFLAGS environment variable. --- Makefile | 2 +- non_builtin.go | 4 +++- non_builtin_clean_link.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a301ccf..5bae4ad 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,4 @@ libs: .PHONY: test test: - go test -v -count=1 -tags testing + go test -v -count=1 -tags testing,grocksdb_no_link diff --git a/non_builtin.go b/non_builtin.go index 8d5e393..ba735d5 100644 --- a/non_builtin.go +++ b/non_builtin.go @@ -1,5 +1,7 @@ -//go:build !testing && !grocksdb_clean_link +//go:build !grocksdb_no_link && !grocksdb_clean_link +// The default link options, to customize it, you can try build tag `grocksdb_clean_link` for a cleaner set of flags, +// or `grocksdb_no_link` where you have full control through `CGO_LDFLAGS` environment variable. package grocksdb // #cgo LDFLAGS: -lrocksdb -pthread -lstdc++ -ldl -lm -lzstd -llz4 -lz -lsnappy diff --git a/non_builtin_clean_link.go b/non_builtin_clean_link.go index b582f3b..47221d3 100644 --- a/non_builtin_clean_link.go +++ b/non_builtin_clean_link.go @@ -1,4 +1,4 @@ -//go:build !testing && grocksdb_clean_link +//go:build !grocksdb_no_link && grocksdb_clean_link package grocksdb