[lxc-devel] [go-lxc/v2] Added static build support using -tags static_build
CajuM on Github
lxc-bot at linuxcontainers.org
Fri May 24 15:40:44 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 473 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190524/15ba87ca/attachment.bin>
-------------- next part --------------
From 44174ee97fd6657e24b4152acc40a923f6b1bbec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mihai-Drosi=20C=C3=A2ju?= <mcaju at cisco.com>
Date: Fri, 24 May 2019 18:36:36 +0300
Subject: [PATCH] Added static build support using -tags static_build
---
linking_dynamic.go | 10 ++++++++++
linking_static.go | 10 ++++++++++
lxc-binding.go | 1 -
3 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 linking_dynamic.go
create mode 100644 linking_static.go
diff --git a/linking_dynamic.go b/linking_dynamic.go
new file mode 100644
index 0000000..1197b81
--- /dev/null
+++ b/linking_dynamic.go
@@ -0,0 +1,10 @@
+// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
+// Use of this source code is governed by a LGPLv2.1
+// license that can be found in the LICENSE file.
+
+// +build linux,cgo,!static_build
+
+package lxc
+
+// #cgo LDFLAGS: -llxc -lutil
+import "C"
diff --git a/linking_static.go b/linking_static.go
new file mode 100644
index 0000000..89f06b4
--- /dev/null
+++ b/linking_static.go
@@ -0,0 +1,10 @@
+// Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
+// Use of this source code is governed by a LGPLv2.1
+// license that can be found in the LICENSE file.
+
+// +build linux,cgo,static_build
+
+package lxc
+
+// #cgo LDFLAGS: -static -llxc -lseccomp -lutil -lcap
+import "C"
diff --git a/lxc-binding.go b/lxc-binding.go
index a0e2bdc..61462a1 100644
--- a/lxc-binding.go
+++ b/lxc-binding.go
@@ -7,7 +7,6 @@
package lxc
// #cgo pkg-config: lxc
-// #cgo LDFLAGS: -llxc -lutil
// #include <lxc/lxccontainer.h>
// #include <lxc/version.h>
// #include "lxc-binding.h"
More information about the lxc-devel
mailing list