[tbb-commits] [tor-browser-build/master] Bug 40011: Add SQLCipher for application-services
sysrqb at torproject.org
sysrqb at torproject.org
Mon Aug 10 16:06:24 UTC 2020
commit 01cb89f0a1c6e46db7add953cfb63b1924ee8377
Author: Georg Koppen <gk at torproject.org>
Date: Wed Jul 1 14:32:40 2020 +0000
Bug 40011: Add SQLCipher for application-services
---
projects/sqlcipher/build | 131 ++++++++++++++++++++++++++++++++++++++++++++++
projects/sqlcipher/config | 21 ++++++++
2 files changed, 152 insertions(+)
diff --git a/projects/sqlcipher/build b/projects/sqlcipher/build
new file mode 100644
index 0000000..d364000
--- /dev/null
+++ b/projects/sqlcipher/build
@@ -0,0 +1,131 @@
+#!/bin/bash
+[% c("var/set_default_env") -%]
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+distdir=/var/tmp/dist/sqlcipher
+builddir=/var/tmp/build/[% project %]
+mkdir /var/tmp/build
+tar -C /var/tmp/dist -xf [% c('input_files_by_name/nss') %]
+
+# application-services uses a newer NDK, 21d, than all the other projects...
+export ANDROID_NDK_API_VERSION=[% pc("fenix-android-toolchain", "var/android_ndk_version") %][% pc('fenix-android-toolchain', 'var/android_ndk_revision') %]
+export ANDROID_NDK_HOME=/var/tmp/dist/[% c('var/compiler') %]/android-ndk/android-ndk-r$ANDROID_NDK_API_VERSION
+# We need to add the new path to our build tools to PATH
+export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
+export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME
+export NDK_HOST_TAG=linux-x86_64
+
+export AR="[% c('var/cross_prefix') %]-ar"
+# XXX: Mozilla really uses the NDK_API_VERSION here, which is weird.
+export CC="[% c('var/cross_prefix') %][% pc('fenix-android-toolchain', 'var/android_ndk_version') %]-clang"
+export CXX="[% c('var/cross_prefix') %][% pc('fenix-android-toolchain', 'var/android_ndk_version') %]-clang++"
+export LD="[% c('var/cross_prefix') %]-ld"
+export RANLIB="[% c('var/cross_prefix') %]-ranlib"
+
+host=""
+[% IF c("var/configure_host") == "arm-linux-androideabi" -%]
+ host="arm-linux"
+[% ELSIF c("var/configure_host") == "i686-linux-android" -%]
+ host="i686-linux"
+[% ELSIF c("var/configure_host") == "x86_64-linux-android" -%]
+ host="x86_64-linux"
+[% ELSIF c("var/configure_host") == "aarch64-linux-android" -%]
+ host="arm-linux"
+[% END -%]
+
+SQLCIPHER_CFLAGS=" \
+ -DSQLITE_HAS_CODEC \
+ -DSQLITE_SOUNDEX \
+ -DHAVE_USLEEP=1 \
+ -DSQLITE_MAX_VARIABLE_NUMBER=99999 \
+ -DSQLITE_THREADSAFE=1 \
+ -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \
+ -DNDEBUG=1 \
+ -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \
+ -DSQLITE_ENABLE_LOAD_EXTENSION \
+ -DSQLITE_ENABLE_COLUMN_METADATA \
+ -DSQLITE_ENABLE_UNLOCK_NOTIFY \
+ -DSQLITE_ENABLE_RTREE \
+ -DSQLITE_ENABLE_STAT3 \
+ -DSQLITE_ENABLE_STAT4 \
+ -DSQLITE_ENABLE_JSON1 \
+ -DSQLITE_ENABLE_FTS3_PARENTHESIS \
+ -DSQLITE_ENABLE_FTS4 \
+ -DSQLITE_ENABLE_FTS5 \
+ -DSQLCIPHER_CRYPTO_NSS \
+ -DSQLITE_ENABLE_DBSTAT_VTAB \
+ -DSQLITE_SECURE_DELETE \
+ -DSQLITE_DEFAULT_PAGE_SIZE=32768 \
+ -DSQLITE_MAX_DEFAULT_PAGE_SIZE=32768 \
+ -I/var/tmp/dist/nss/include \
+"
+
+LIBS="\
+ -lcertdb \
+ -lcerthi \
+ -lcryptohi \
+ -lfreebl_static \
+ -lnspr4 \
+ -lnss_static \
+ -lnssb \
+ -lnssdev \
+ -lnsspki \
+ -lnssutil \
+ -lpk11wrap_static \
+ -lplc4 \
+ -lplds4 \
+ -lsoftokn_static \
+"
+
+[% IF c("var/configure_host") == "i686-linux-android" || c("var/configure_host") == "x86_64-linux-android"-%]
+ LIBS="${LIBS} -lgcm-aes-x86_c_lib"
+[% END %]
+[% IF c("var/configure_host") == "arm-linux-android" || c("var/configure_host") == "aarch64-linux-android"-%]
+ LIBS="${LIBS} -larmv8_c_lib"
+[% END %]
+[% IF c("var/configure_host") == "aarch64-linux-android" -%]
+ LIBS="${LIBS} -lgcm-aes-aarch64_c_lib"
+[% END %]
+[% IF c("var/configure_host") == "arm-linux-androideabi" -%]
+ LIBS="${LIBS} -lgcm-aes-arm32-neon_c_lib"
+[% END %]
+[% IF c("var/configure_host") == "x86_64-linux-android"-%]
+ LIBS="${LIBS} -lintel-gcm-wrap_c_lib -lintel-gcm-s_lib -lhw-acc-crypto-avx -lhw-acc-crypto-avx2"
+[% END %]
+
+tar -C /var/tmp/build -xf [% c('input_files_by_name/sqlcipher') %]
+mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
+cd $builddir
+
+mkdir $builddir/build
+cd build
+../configure \
+ --host="$host" \
+ --with-pic \
+ --verbose \
+ --disable-shared \
+ --with-crypto-lib=none \
+ --disable-tcl \
+ --enable-tempstore=yes \
+ CFLAGS="${SQLCIPHER_CFLAGS}" \
+ LDFLAGS="-L/var/tmp/dist/nss/lib" \
+ LIBS="${LIBS} -llog -lm"
+
+make sqlite3.h
+make sqlite3ext.h
+make libsqlcipher.la
+
+mkdir -p $distdir/include/sqlcipher
+mkdir -p $distdir/lib
+
+cp -p "$builddir/build/sqlite3.h" "$distdir/include/sqlcipher"
+cp -p "$builddir/build/sqlite3ext.h" "$distdir/include/sqlcipher"
+cp -p "$builddir/build/.libs/libsqlcipher.a" "$distdir/lib"
+
+# Just in case, ensure that the created binaries are not -w.
+chmod +w "$distdir/lib/libsqlcipher.a"
+
+cd /var/tmp/dist
+[% c('tar', {
+ tar_src => [ project ],
+ tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+ }) %]
diff --git a/projects/sqlcipher/config b/projects/sqlcipher/config
new file mode 100644
index 0000000..fb4ae3a
--- /dev/null
+++ b/projects/sqlcipher/config
@@ -0,0 +1,21 @@
+# vim: filetype=yaml sw=2
+filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'
+# The required versions for application-services can be found at the respective
+# commit in libs/build-all.sh
+version: 4.4.0
+var:
+ container:
+ use_container: 1
+ deps:
+ - build-essential
+ - tcl
+
+input_files:
+ - project: container-image
+ - name: '[% c("var/compiler") %]'
+ project: '[% c("var/compiler") %]'
+ - name: nss
+ project: nss
+ - URL: 'https://github.com/sqlcipher/sqlcipher/archive/v[% c("version") %].tar.gz'
+ name: sqlcipher
+ sha256sum: 0924b2ae1079717954498bda78a30de20ce2a6083076b16214a711567821d148
More information about the tbb-commits
mailing list