From 03a98f5e78cac9a373c3820a092d94a897a6b3c6 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 3 Mar 2023 10:36:04 +0000 Subject: [PATCH] scripts/ndk-make.sh: enable debug builds explicitly with --debug Currently F-Droid builds split architecture .apks by invoking ndk-make.sh with architecture argument. This results in debug builds of the core. This change makes debug builds explicit. --- scripts/ndk-make.sh | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/scripts/ndk-make.sh b/scripts/ndk-make.sh index 3124150da..074be8cd5 100755 --- a/scripts/ndk-make.sh +++ b/scripts/ndk-make.sh @@ -6,6 +6,11 @@ # scripts/ndk-make.sh arm64-v8a # # Possible values are armeabi-v7a, arm64-v8a, x86 and x86_64. +# +# To build the core in debug mode, run with "--debug" argument in the beginning: +# +# scripts/ndk-make.sh --debug arm64-v8a +# # You should be able to find out your architecture by running: # # adb shell uname -m @@ -66,6 +71,23 @@ export CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/x86_64-linux-and export RUSTUP_TOOLCHAIN=$(cat "$(dirname "$0")/rust-toolchain") +if test "$1" = "--debug"; then + echo Quick debug build that will produce a slower app. DO NOT UPLOAD THE APK ANYWHERE. + + RELEASE="debug" + RELEASEFLAG="" + + shift +else + echo Full build + + # According to 1.45.0 changelog in https://github.com/rust-lang/rust/blob/master/RELEASES.md, + # "The recommended way to control LTO is with Cargo profiles, either in Cargo.toml or .cargo/config, or by setting CARGO_PROFILE__LTO in the environment." + export CARGO_PROFILE_RELEASE_LTO=on + RELEASE="release" + RELEASEFLAG="--release" +fi + # Check if the argument is a correct architecture: if test $1 && echo "armeabi-v7a arm64-v8a x86 x86_64" | grep -vwq -- $1; then echo "Architecture '$1' not known, possible values are armeabi-v7a, arm64-v8a, x86 and x86_64." @@ -88,21 +110,6 @@ cd deltachat-core-rust # fix build on MacOS Catalina unset CPATH -if test -z $1; then - echo Full build - - # According to 1.45.0 changelog in https://github.com/rust-lang/rust/blob/master/RELEASES.md, - # "The recommended way to control LTO is with Cargo profiles, either in Cargo.toml or .cargo/config, or by setting CARGO_PROFILE__LTO in the environment." - export CARGO_PROFILE_RELEASE_LTO=on - RELEASE="release" - RELEASEFLAG="--release" -else - echo Fast, partial, slow debug build. DO NOT UPLOAD THE APK ANYWHERE. - - RELEASE="debug" - RELEASEFLAG= -fi - # Work around the bug in the build of Rust standard library. # It is built against r22b NDK toolchains and still requires -lgcc instead of -lunwind used in newer r23 NDK. # See discussion at