Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(appimage): build sqlcipher form source
Browse files Browse the repository at this point in the history
Needed since Debian version is broken https://bugs.debian.org/850421
  • Loading branch information
sudden6 committed May 4, 2018
1 parent 48179b6 commit 64a7c24
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
40 changes: 33 additions & 7 deletions appimage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion simple_make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand All @@ -24,7 +25,6 @@ apt_install() {
libqt5opengl5-dev
libqt5svg5-dev
libsodium-dev
libsqlcipher-dev
libtool
libvpx-dev
libxss-dev
Expand All @@ -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[@]}"
}

Expand Down

0 comments on commit 64a7c24

Please sign in to comment.