[lxc-devel] [lxc-ci/master] Add new dqlite deps

freeekanayaka on Github lxc-bot at linuxcontainers.org
Sun Jun 23 09:35:52 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190623/9578effe/attachment.bin>
-------------- next part --------------
From 1a0d9f16f58ec6f4fd29d2e51d9c51ba237e0660 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Sun, 23 Jun 2019 10:24:20 +0200
Subject: [PATCH 1/2] Build libco and raft as new clustering dependencies

---
 bin/update-cache | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/bin/update-cache b/bin/update-cache
index 29fc078..9c896bf 100755
--- a/bin/update-cache
+++ b/bin/update-cache
@@ -29,9 +29,36 @@ git log -1 --format=format:%H > manifest.uuid
 make >/dev/null 2>&1
 cd - >/dev/null
 
+git clone -q https://github.com/freeekanayaka/libco "${TEMP_DIR}/libco"
+cd "${TEMP_DIR}/libco"
+gcc -c -Wall -fpic libco.c >/dev/null 2>&1
+gcc -shared -o libco.so libco.o >/dev/null 2>&1
+ar rcs libco.a libco.o >/dev/null 2>&1
+cat > libco.pc <<EOF
+prefix=/usr
+libdir=\${prefix}/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
+includedir=\${prefix}/include
+
+Name: libco
+Description: Cooperative multithreading library written in C89C
+Version: 18
+Libs: -L\${libdir} -lco
+Cflags: -I\${includedir}
+EOF
+cd - >/dev/null
+
+git clone -q https://github.com/CanonicalLtd/raft "${TEMP_DIR}/raft"
+cd "${TEMP_DIR}/raft"
+autoreconf -i >/dev/null 2>&1
+./configure --enable-debug >/dev/null 2>&1
+make >/dev/null 2>&1
+cd - >/dev/null
+
 git clone -q https://github.com/CanonicalLtd/dqlite "${TEMP_DIR}/dqlite"
 cd "${TEMP_DIR}/dqlite"
-export PKG_CONFIG_PATH="${TEMP_DIR}/sqlite"
+export PKG_CONFIG_PATH="${TEMP_DIR}/sqlite:${TEMP_DIR}/libco:${TEMP_DIR}/raft"
+export CFLAGS="-I${TEMP_DIR}/sqlite -I${TEMP_DIR}/libco -I${TEMP_DIR}/raft/include"
+export LDFLAGS="-L${TEMP_DIR}/sqlite/.libs -L${TEMP_DIR}/libco -L${TEMP_DIR}/raft/.libs"
 autoreconf -i >/dev/null 2>&1
 ./configure --enable-debug >/dev/null 2>&1
 make >/dev/null 2>&1
@@ -87,6 +114,8 @@ rm -Rf "${TEMP_DIR}/go/pkg" "${TEMP_DIR}/go/bin"
 mv "${TEMP_DIR}/gimme" /lxc-ci/build/cache.new/gimme
 mv "${TEMP_DIR}/go" /lxc-ci/build/cache.new/go
 mv "${TEMP_DIR}/sqlite" /lxc-ci/build/cache.new/sqlite
+mv "${TEMP_DIR}/libco" /lxc-ci/build/cache.new/libco
+mv "${TEMP_DIR}/raft" /lxc-ci/build/cache.new/raft
 mv "${TEMP_DIR}/dqlite" /lxc-ci/build/cache.new/dqlite
 [ -e "/lxc-ci/build/cache" ] && mv /lxc-ci/build/cache /lxc-ci/build/cache.old
 chmod -R o+rX /lxc-ci/build/cache.new

From df069897578c54572e08ff75de5d14a8f2a66558 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Sun, 23 Jun 2019 10:35:19 +0200
Subject: [PATCH 2/2] Add libco and libraft to build-related env variables

---
 bin/build-lxd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/build-lxd b/bin/build-lxd
index 8629cca..34b064b 100755
--- a/bin/build-lxd
+++ b/bin/build-lxd
@@ -87,9 +87,9 @@ echo "==> ENVIRONMENT BEGIN"
 # Clustering
 if [ -e "lxd/cluster" ]; then
     echo "===> Setting up for LXD clustering"
-    export CGO_CFLAGS="-I/lxc-ci/build/cache/sqlite/ -I/lxc-ci/build/cache/dqlite/include/"
-    export CGO_LDFLAGS="-L/lxc-ci/build/cache/sqlite/.libs/ -L/lxc-ci/build/cache/dqlite/.libs/"
-    export LD_LIBRARY_PATH="/lxc-ci/build/cache/sqlite/.libs/:/lxc-ci/build/cache/dqlite/.libs/"
+    export CGO_CFLAGS="-I/lxc-ci/build/cache/sqlite/ -I/lxc-ci/build/cache/libco/ -I/lxc-ci/build/cache/libraft/include/ -I/lxc-ci/build/cache/dqlite/include/"
+    export CGO_LDFLAGS="-L/lxc-ci/build/cache/sqlite/.libs/ -L/lxc-ci/build/cache/libco/ -L/lxc-ci/build/cache/raft/.libs/ -L/lxc-ci/build/cache/dqlite/.libs/"
+    export LD_LIBRARY_PATH="/lxc-ci/build/cache/sqlite/.libs/:/lxc-ci/build/cache/libco/:/lxc-ci/build/cache/raft/.libs/:/lxc-ci/build/cache/dqlite/.libs/"
 fi
 
 echo "===> Environment variables"


More information about the lxc-devel mailing list