summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-09-30 16:16:14 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-30 16:16:14 -0400
commit9bcaa60cb1aea37d70148d8ca46b086ff5adaec0 (patch)
tree04c7b1e04d384c6e58035c9e45cced9933092a32
parent3fd5e3d5e9785a7e309c3021f174c3ff52bcc363 (diff)
add script to download latest amalgamation2.6.6
-rw-r--r--.gitignore1
-rw-r--r--Makefile3
-rwxr-xr-xscripts/get_latest_amalgamation.sh40
3 files changed, 44 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index c72b8f1..e259da9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ dist/
MANIFEST
debian/
*.egg-info
+amalgamation_latest
diff --git a/Makefile b/Makefile
index 127461d..3491456 100644
--- a/Makefile
+++ b/Makefile
@@ -4,5 +4,8 @@ install: clean
install_bundle: clean
python setup.py install --bundled
+get_amalgamation:
+ scripts/get_latest_amalgamation.sh amalgamation_latest
+
clean:
rm -rf build dist
diff --git a/scripts/get_latest_amalgamation.sh b/scripts/get_latest_amalgamation.sh
new file mode 100755
index 0000000..05c128c
--- /dev/null
+++ b/scripts/get_latest_amalgamation.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# author: drebs@leap.se
+
+# Get SQLCipher amalgamation files from latest tag from git repository.
+#
+# We want latest so we can build SQLCipher with JSON1 support:
+# https://www.sqlite.org/json1.html
+
+SQLCIPHER_REPO="https://github.com/sqlcipher/sqlcipher"
+
+if [ $# -ne 1 ]; then
+ echo "Usage: ${0} AMALGAMATION_ROOT"
+ exit 1
+fi
+
+TEMP_DIR=`mktemp -d`
+REPO_DIR="${TEMP_DIR}/sqlcipher"
+SCRIPT_DIR=`pwd`
+AMALGAMATION_ROOT=${1}
+AMALGAMATION_DIR="${SCRIPT_DIR}/${AMALGAMATION_ROOT}"
+
+# clone, checkout latest tag and build amalgamation
+git clone ${SQLCIPHER_REPO} ${REPO_DIR}
+(cd ${REPO_DIR} \
+ && git checkout `git tag | tail -n 1` \
+ && ./configure \
+ && make sqlite3.c)
+
+# make sure old files are wiped from amalgamation dir
+if [ -d ${AMALGAMATION_DIR} ]; then
+ rm -rf ${AMALGAMATION_DIR}/*
+else
+ mkdir -p ${AMALGAMATION_DIR}
+fi
+
+# copy amalgamation files
+cp ${REPO_DIR}/sqlite3.{c,h} ${AMALGAMATION_DIR}/
+
+# remove leftovers
+rm -rf ${TEMP_DIR}