The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7855

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
From b7c98a532b326b3ead755875afbff9fe316ca377 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanay...@canonical.com>
Date: Fri, 11 Sep 2020 18:19:32 +0200
Subject: [PATCH] Drop custom SQLite and libco

Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
---
 Makefile            | 48 +++++++--------------------------------------
 doc/index.md        |  8 ++++----
 doc/requirements.md |  7 ++++---
 3 files changed, 15 insertions(+), 48 deletions(-)

diff --git a/Makefile b/Makefile
index c4f605a6b2..abf7d2d46a 100644
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,13 @@ POTFILE=po/$(DOMAIN).pot
 VERSION=$(shell grep "var Version" shared/version/flex.go | cut -d'"' -f2)
 ARCHIVE=lxd-$(VERSION).tar
 HASH := \#
-TAG_SQLITE3=$(shell printf "$(HASH)include <sqlite3.h>\nvoid main(){int n = 
SQLITE_IOERR_NOT_LEADER;}" | $(CC) ${CGO_CFLAGS} -o /dev/null -xc - >/dev/null 
2>&1 && echo "libsqlite3")
+TAG_SQLITE3=$(shell printf "$(HASH)include <dqlite.h>\nvoid 
main(){dqlite_node_id n = 1;}" | $(CC) ${CGO_CFLAGS} -o /dev/null -xc - 
>/dev/null 2>&1 && echo "libsqlite3")
 GOPATH ?= $(HOME)/go
 
 .PHONY: default
 default:
 ifeq ($(TAG_SQLITE3),)
-       @echo "Missing custom libsqlite3, run \"make deps\" to setup."
+       @echo "Missing dqlite, run \"make deps\" to setup."
        exit 1
 endif
 
@@ -40,36 +40,6 @@ lxd-p2c:
 
 .PHONY: deps
 deps:
-       # sqlite
-       @if [ -d "$(GOPATH)/deps/sqlite" ]; then \
-               if [ -d "$(GOPATH)/deps/sqlite/.git" ]; then \
-                       cd "$(GOPATH)/deps/sqlite"; \
-                       git pull; \
-               fi; \
-       else \
-               git clone --depth=1 "https://github.com/canonical/sqlite"; 
"$(GOPATH)/deps/sqlite"; \
-               cd "$(GOPATH)/deps/sqlite"; \
-               git log -1 --format="format:%ci%n" | sed -e 's/ [-+].*$$//;s/ 
/T/;s/^/D /' > manifest; \
-               git log -1 --format="format:%H" > manifest.uuid; \
-       fi
-
-       cd "$(GOPATH)/deps/sqlite" && \
-               ./configure --enable-replication --disable-amalgamation 
--disable-tcl && \
-               make
-
-       # libco
-       @if [ -d "$(GOPATH)/deps/libco" ]; then \
-               if [ -d "$(GOPATH)/deps/libco/.git" ]; then \
-                       cd "$(GOPATH)/deps/libco"; \
-                       git pull; \
-               fi; \
-       else \
-               git clone --depth=1 "https://github.com/canonical/libco"; 
"$(GOPATH)/deps/libco"; \
-       fi
-
-       cd "$(GOPATH)/deps/libco" && \
-               make
-
        # raft
        @if [ -d "$(GOPATH)/deps/raft" ]; then \
                if [ -d "$(GOPATH)/deps/raft/.git" ]; then \
@@ -97,15 +67,15 @@ deps:
 
        cd "$(GOPATH)/deps/dqlite" && \
                autoreconf -i && \
-               
PKG_CONFIG_PATH="$(GOPATH)/deps/sqlite/:$(GOPATH)/deps/libco/:$(GOPATH)/deps/raft/"
 ./configure && \
-               make CFLAGS="-I$(GOPATH)/deps/sqlite/ -I$(GOPATH)/deps/libco/ 
-I$(GOPATH)/deps/raft/include/" LDFLAGS="-L$(GOPATH)/deps/sqlite/.libs/ 
-L$(GOPATH)/deps/libco/ -L$(GOPATH)/deps/raft/.libs/"
+               PKG_CONFIG_PATH="$(GOPATH)/deps/raft/" ./configure && \
+               make CFLAGS="-I$(GOPATH)/deps/raft/include/" 
LDFLAGS="-L$(GOPATH)/deps/raft/.libs/"
 
        # environment
        @echo ""
        @echo "Please set the following in your environment (possibly 
~/.bashrc)"
-       @echo "export CGO_CFLAGS=\"-I$(GOPATH)/deps/sqlite/ 
-I$(GOPATH)/deps/libco/ -I$(GOPATH)/deps/raft/include/ 
-I$(GOPATH)/deps/dqlite/include/\""
-       @echo "export CGO_LDFLAGS=\"-L$(GOPATH)/deps/sqlite/.libs/ 
-L$(GOPATH)/deps/libco/ -L$(GOPATH)/deps/raft/.libs 
-L$(GOPATH)/deps/dqlite/.libs/\""
-       @echo "export 
LD_LIBRARY_PATH=\"$(GOPATH)/deps/sqlite/.libs/:$(GOPATH)/deps/libco/:$(GOPATH)/deps/raft/.libs/:$(GOPATH)/deps/dqlite/.libs/\""
+       @echo "export CGO_CFLAGS=\"-I$(GOPATH)/deps/raft/include/ 
-I$(GOPATH)/deps/dqlite/include/\""
+       @echo "export CGO_LDFLAGS=\"-L$(GOPATH)/deps/raft/.libs 
-L$(GOPATH)/deps/dqlite/.libs/\""
+       @echo "export 
LD_LIBRARY_PATH=\"$(GOPATH)/deps/raft/.libs/:$(GOPATH)/deps/dqlite/.libs/\""
        @echo "export CGO_LDFLAGS_ALLOW=\"-Wl,-wrap,pthread_create\""
 
 
@@ -188,11 +158,7 @@ dist:
        # Download the cluster-enabled sqlite/dqlite
        mkdir $(TMP)/_dist/deps/
        git clone --depth=1 https://github.com/canonical/dqlite 
$(TMP)/_dist/deps/dqlite
-       git clone --depth=1 https://github.com/canonical/sqlite 
$(TMP)/_dist/deps/sqlite
-       git clone --depth=1 https://github.com/canonical/libco 
$(TMP)/_dist/deps/libco
        git clone --depth=1 https://github.com/canonical/raft 
$(TMP)/_dist/deps/raft
-       cd $(TMP)/_dist/deps/sqlite && git log -1 --format="format:%ci%n" | sed 
-e 's/ [-+].*$$//;s/ /T/;s/^/D /' > manifest
-       cd $(TMP)/_dist/deps/sqlite && git log -1 --format="format:%H" > 
manifest.uuid
 
        # Write a manifest
        cd $(TMP)/_dist && find . -type d -name .git | while read line; do 
GITDIR=$$(dirname $$line); echo "$${GITDIR}: $$(cd $${GITDIR} && git show-ref 
HEAD $${GITDIR} | cut -d' ' -f1)"; done | sort > $(TMP)/_dist/MANIFEST
diff --git a/doc/index.md b/doc/index.md
index bf6ccaea45..767f49cebf 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -116,9 +116,9 @@ below (shown for example purposes) may not exactly match 
what your version of LX
 ```bash
 make deps
 # Use the export statements printed in the output of 'make deps' -- these are 
examples: 
-export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ 
-I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ 
-I${GOPATH}/deps/libco/"
-export CGO_LDFLAGS="${CGO_LDFLAGS} -L${GOPATH}/deps/sqlite/.libs/ 
-L${GOPATH}/deps/dqlite/.libs/ -L${GOPATH}/deps/raft/.libs 
-L${GOPATH}/deps/libco/"
-export 
LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}"
+export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/dqlite/include/ 
-I${GOPATH}/deps/raft/include/"
+export CGO_LDFLAGS="${CGO_LDFLAGS} -L${GOPATH}/deps/dqlite/.libs/ 
-L${GOPATH}/deps/raft/.libs/"
+export 
LD_LIBRARY_PATH="${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs/:${LD_LIBRARY_PATH}"
 export CGO_LDFLAGS_ALLOW="-Wl,-wrap,pthread_create"
 make
 ```
@@ -134,7 +134,7 @@ something like this for a `~/.bashrc` file:
 GOPATH=~/go
 # But we need to export these:
 export PATH="$PATH:$GOPATH/bin"
-export 
LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}"
+export 
LD_LIBRARY_PATH="${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs/:${LD_LIBRARY_PATH}"
 ```
 
 Now, the `lxd` and `lxc` binaries will be available to you and can be used to 
set up LXD. The binaries will automatically find and use the dependencies built 
in `$GOPATH/deps` thanks to the `LD_LIBRARY_PATH` environment variable.
diff --git a/doc/requirements.md b/doc/requirements.md
index b32263351a..be05a5a344 100644
--- a/doc/requirements.md
+++ b/doc/requirements.md
@@ -35,14 +35,15 @@ properly, but support for those may accidentally regress in 
future LXD
 releases.
 
 ## Additional libraries (and development headers)
-LXD uses `dqlite` for its database, to build and setup the custom
-`sqlite3` and `dqlite` needed for it, you can run `make deps`.
+LXD uses `dqlite` for its database, to build and setup it, you can
+run `make deps`.
 
 LXD itself also uses a number of (usually packaged) C libraries:
 
  - libacl1
  - libcap2
  - libuv1 (for `dqlite`)
+ - libsqlite3 >= 3.25.0 (for `dqlite`)
 
-Make sure you have both the libraries themselves and their development
+Make sure you have all these libraries themselves and their development
 headers (-dev packages) installed.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to