diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-22 14:54:19 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-22 14:54:19 +0200 |
commit | df0fd496fbc7dfcf468f72881e81ef6424fe39fd (patch) | |
tree | 24fb915bb70e01ddf7146eb83f5910538e80c1df /scripts/get_latest_amalgamation.sh | |
parent | f12586c0fa5c8a877b4a6538d9ebb0c0a1a33745 (diff) | |
parent | f472f1a6382abc698f74a1afbb07b2274b3a3d45 (diff) |
merge master
Diffstat (limited to 'scripts/get_latest_amalgamation.sh')
-rwxr-xr-x | scripts/get_latest_amalgamation.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/get_latest_amalgamation.sh b/scripts/get_latest_amalgamation.sh new file mode 100755 index 0000000..8ec9047 --- /dev/null +++ b/scripts/get_latest_amalgamation.sh @@ -0,0 +1,41 @@ +#!/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 ${AMALGAMATION_DIR}/ +cp ${REPO_DIR}/sqlite3.h ${AMALGAMATION_DIR}/ + +# remove leftovers +rm -rf ${TEMP_DIR} |