From 64a7c24b2b5ad11a6df5dbb11da6e3aa7c0fd6f3 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sat, 28 Apr 2018 23:32:37 +0200 Subject: [PATCH] fix(appimage): build sqlcipher form source Needed since Debian version is broken https://bugs.debian.org/850421 --- appimage/build.sh | 40 +++++++++++++++++++++++++++++++++------- simple_make.sh | 6 +++++- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/appimage/build.sh b/appimage/build.sh index d8175ce10..6e20c2e1b 100755 --- a/appimage/build.sh +++ b/appimage/build.sh @@ -36,6 +36,8 @@ readonly QTOX_APP_DIR="$BUILD_DIR"/appdir readonly LDQT_BUILD_DIR="$BUILD_DIR"/ldqt # "appimagetool" becomes aitool readonly AITOOL_BUILD_DIR="$BUILD_DIR"/aitool +# sqlcipher build directory +readonly SQLCIPHER_BUILD_DIR="$BUILD_DIR"/sqlcipher # ldqt binary readonly LDQT_BIN="/usr/lib/x86_64-linux-gnu/qt5/bin/linuxdeployqt" readonly APT_FLAGS="-y --no-install-recommends" @@ -44,30 +46,49 @@ export MAKEFLAGS="-j$(nproc)" # Get packages apt-get update -apt-get install $APT_FLAGS sudo ca-certificates wget fuse xxd git g++ patchelf +apt-get install $APT_FLAGS sudo ca-certificates wget build-essential fuse xxd \ +git g++ patchelf tclsh libssl-dev # get version cd "$QTOX_SRC_DIR" -export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file +# linuxdeployqt uses this for naming the file +export VERSION=$(git rev-parse --short HEAD) # create build directory mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" +# we need a custom built sqlcipher version because of a Debian bug +# https://bugs.debian.org/850421 +git clone https://github.com/sqlcipher/sqlcipher.git "$SQLCIPHER_BUILD_DIR" +cd "$SQLCIPHER_BUILD_DIR" +git checkout tags/v3.4.2 +./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \ +LDFLAGS="-lcrypto" + +make +make install + # copy qtox source cp -r "$QTOX_SRC_DIR" "$QTOX_BUILD_DIR" cd "$QTOX_BUILD_DIR" +# ensure this directory is empty +rm -rf ./_build + # reuse for our purposes, pass flags to automatically install packages -./simple_make.sh "$APT_FLAGS" +# APT_FLAGS for automatic install +# True to not install sqlcipher +./simple_make.sh "$APT_FLAGS" True # build dir of simple_make cd _build make DESTDIR="$QTOX_APP_DIR" install ; find "$QTOX_APP_DIR" -LDQT_HASH="9c90a882ac744b5f704598e9588450ddfe487c67" # is master as of 2018-04-25 +# is master as of 2018-04-25 +LDQT_HASH="9c90a882ac744b5f704598e9588450ddfe487c67" # build linuxdeployqt git clone https://github.com/probonopd/linuxdeployqt.git "$LDQT_BUILD_DIR" cd "$LDQT_BUILD_DIR" @@ -76,9 +97,12 @@ qmake make make install -AITOOL_HASH="5d93115f279d94a4d23dfd64fb8ccd109e98f039" # is master as of 2018-04-25 +# is master as of 2018-04-25 +AITOOL_HASH="5d93115f279d94a4d23dfd64fb8ccd109e98f039" # build appimagetool -git clone -b appimagetool/master --single-branch --recursive https://github.com/AppImage/AppImageKit "$AITOOL_BUILD_DIR" +git clone -b appimagetool/master --single-branch --recursive \ +https://github.com/AppImage/AppImageKit "$AITOOL_BUILD_DIR" + cd "$AITOOL_BUILD_DIR" git checkout "$AITOOL_HASH" bash -ex install-build-deps.sh @@ -92,7 +116,9 @@ cd build # make sure that deps in separate install tree are found export PKG_CONFIG_PATH=/deps/lib/pkgconfig/ -cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DAPPIMAGEKIT_PACKAGE_DEBS=ON +cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON \ +-DAPPIMAGEKIT_PACKAGE_DEBS=ON + make make install diff --git a/simple_make.sh b/simple_make.sh index aa2cee8e3..7f8ab359e 100755 --- a/simple_make.sh +++ b/simple_make.sh @@ -4,6 +4,7 @@ set -eu -o pipefail # additional flags for apt-get, used for CI readonly APT_FLAGS=$1 +readonly WITHOUT_SQLCIPHER=$2 apt_install() { local apt_packages=( @@ -24,7 +25,6 @@ apt_install() { libqt5opengl5-dev libqt5svg5-dev libsodium-dev - libsqlcipher-dev libtool libvpx-dev libxss-dev @@ -34,6 +34,10 @@ apt_install() { qttools5-dev-tools ) + if [ "$WITHOUT_SQLCIPHER" != "True" ]; then + apt_packages+=libsqlcipher-dev + fi + sudo apt-get install $APT_FLAGS "${apt_packages[@]}" }