Skip to content

Commit 19973f5

Browse files
committed
Vendor pre-built librdkafka (v0.11.3) under clib dir and use it when building
1 parent 7677013 commit 19973f5

8 files changed

+4228
-0
lines changed

kafka/build.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package kafka
2+
3+
// NOTE(griffy):
4+
// We are simplifying how this package is built in a few ways for our own purposes:
5+
// 1) Pre-built releases of librdkafka are vendored under the `clib` directory which we link against without the usage of pkg-config
6+
// 2) The build tags (`static` and `static_all`) are removed in favor of the following default behavior:
7+
// - For Linux, librdkafka is statically linked using the included pre-built package file while its (stripped down) dependencies are not (this corresponds to the previous `static` build tag)
8+
// - For Mac, librdkafka is dynamically linked using the pre-built package file
9+
// The goal with these changes is that a single `go get` will be all that is needed to get up and running.
10+
11+
// #cgo linux CFLAGS: -I${SRCDIR}/clib/include
12+
// #cgo linux LDFLAGS: -L${SRCDIR}/clib/lib -Wl,-Bstatic -lrdkafka -Wl,-Bdynamic -lpthread -lrt -ldl
13+
// #cgo darwin CFLAGS: -I${SRCDIR}/clib/include
14+
// #cgo darwin LDFLAGS: -L${SRCDIR}/clib/lib -Wl,-rpath,\$ORIGIN/vendor/github.com/nicheinc/confluent-kafka-go/kafka/clib/lib -lrdkafka
15+
import "C"

kafka/build_dynamic.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// +build ignore
12
// +build !static
23
// +build !static_all
34

kafka/build_static.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// +build ignore
12
// +build static
23
// +build !static_all
34

kafka/build_static_all.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// +build ignore
12
// +build !static
23
// +build static_all
34

0 commit comments

Comments
 (0)