about summary refs log tree commit diff homepage
path: root/scripts/build/p-sqlite.inc
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2023-02-23 22:01:12 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-03-17 22:38:16 +0000
commitca60811f5d55254bec378919430dd0e7e6e5cdd1 (patch)
treedbd4f7a78929eb959e26755c22e5157808a09862 /scripts/build/p-sqlite.inc
parentdd492f8763f13312c17eb67af33e3e90217a30e1 (diff)
downloadklee-ca60811f5d55254bec378919430dd0e7e6e5cdd1.tar.gz
Update build scripts
* Support for Ubuntu 22.04
* Remove support for Python2
* Better separation between sanitizer builds and non-sanitizer builds
* Fix build of metaSMT on newer Ubuntu versions
* Use ninja to build LLVM
* Simplifying building arbitrary LLVM configurations, e.g. different
  LLVM sanitizer builds (MemSan, UBSan, ASan)
* Use MemSan with origin tracking
* Build sqlite3 container correctly
* Add support to provide sqlite3 version number
Diffstat (limited to 'scripts/build/p-sqlite.inc')
-rw-r--r--scripts/build/p-sqlite.inc15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/build/p-sqlite.inc b/scripts/build/p-sqlite.inc
index 3c41ccc6..1182e590 100644
--- a/scripts/build/p-sqlite.inc
+++ b/scripts/build/p-sqlite.inc
@@ -1,8 +1,7 @@
 setup_build_variables_sqlite() {
-  SQLITE_VERSION="3370200"
   SQLITE_SRC_PATH="${BASE}/sqlite-amalgamation-${SQLITE_VERSION}"
-  SQLITE_INSTALL_PATH=${SQLITE_SRC_PATH}
   SQLITE_SUFFIX="${SANITIZER_SUFFIX}"
+  SQLITE_INSTALL_PATH="${SQLITE_SRC_PATH}${SANITIZER_SUFFIX}"
 }
 
 download_sqlite() {
@@ -20,11 +19,14 @@ build_sqlite() {
     CFLAGS=("${SANITIZER_C_FLAGS[@]}")
     COMP="${SANITIZER_C_COMPILER}"
   else
-    COMP="${BITCODE_CC}"
-    [[ -z "${COMP}" ]] && COMP="$(which gcc)"
+    [[ -z "${COMP:-}" ]] && COMP="$(which gcc)"
   fi
 
-  "${COMP}" "${CFLAGS[@]}" -fPIC -o libsqlite3.so -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -shared sqlite3.c
+  mkdir -p "${SQLITE_INSTALL_PATH}"
+  "${COMP}" "${CFLAGS[@]}" -fPIC -o "${SQLITE_INSTALL_PATH}"/libsqlite3.so -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -shared sqlite3.c
+  if [[ -n "${SANITIZER_SUFFIX:-}" ]]; then
+    cp "${SQLITE_SRC_PATH}/"sqlite3.h "${SQLITE_INSTALL_PATH}/"
+  fi
 }
 
 install_sqlite() {
@@ -45,7 +47,7 @@ setup_artifact_variables_sqlite() {
 get_docker_config_id_sqlite() {
   (
     setup_build_variables_sqlite
-    echo "${SQLITE_SUFFIX}"
+    echo "${SQLITE_VERSION}${SQLITE_SUFFIX}"
   )
 }
 
@@ -53,5 +55,6 @@ get_build_artifacts_sqlite() {
   (
     setup_build_variables_sqlite
     echo "${SQLITE_SRC_PATH}"
+    echo "${SQLITE_INSTALL_PATH}"
   )
 }