From a6642e0ebceee175135d781ec325aeaa8c656858 Mon Sep 17 00:00:00 2001 From: r4sas Date: Fri, 22 Mar 2019 23:17:39 +0000 Subject: [PATCH] add script for packaging archive with android binaries --- android_binary_only/jni/Application.mk | 10 ++--- contrib/android_binary_pack/.gitignore | 2 + contrib/android_binary_pack/build-archive | 45 +++++++++++++++++++++++ contrib/android_binary_pack/i2pd | 33 +++++++++++++++++ 4 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 contrib/android_binary_pack/.gitignore create mode 100755 contrib/android_binary_pack/build-archive create mode 100755 contrib/android_binary_pack/i2pd diff --git a/android_binary_only/jni/Application.mk b/android_binary_only/jni/Application.mk index 9b437f6a..655bf430 100755 --- a/android_binary_only/jni/Application.mk +++ b/android_binary_only/jni/Application.mk @@ -1,8 +1,8 @@ -#APP_ABI := all -#APP_ABI := armeabi-v7a x86 -#APP_ABI := x86 -#APP_ABI := x86_64 -APP_ABI := armeabi-v7a +APP_ABI := all +#APP_ABI += x86 +#APP_ABI += x86_64 +#APP_ABI += armeabi-v7a +#APP_ABI += arm64-v8a #can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there. APP_PLATFORM := android-14 diff --git a/contrib/android_binary_pack/.gitignore b/contrib/android_binary_pack/.gitignore new file mode 100644 index 00000000..bad5f807 --- /dev/null +++ b/contrib/android_binary_pack/.gitignore @@ -0,0 +1,2 @@ +archive +i2pd_*_android_binary.zip diff --git a/contrib/android_binary_pack/build-archive b/contrib/android_binary_pack/build-archive new file mode 100755 index 00000000..bb56cace --- /dev/null +++ b/contrib/android_binary_pack/build-archive @@ -0,0 +1,45 @@ +#!/bin/bash + +# Copyright (c) 2013-2017, The PurpleI2P Project +# +# This file is part of Purple i2pd project and licensed under BSD3 +# +# See full license text in LICENSE file at top of project tree + +GITDESC=$(git describe --tags) + +declare -A ABILIST=( + ["armeabi-v7a"]="armv7l" + ["arm64-v8a"]="aarch64" + ["x86"]="x86" + ["x86_64"]="x86_64" +) + +# Remove old files and archives +if [ -d archive ]; then + rm -r archive +fi + +if [ -f i2pd_*_android_binary.zip ]; then + rm i2pd_*_android_binary.zip +fi + +# Prepare files for package +mkdir archive + +for ABI in "${!ABILIST[@]}"; do + if [ -f ../../android_binary_only/libs/${ABI}/i2pd ]; then + cp ../../android_binary_only/libs/${ABI}/i2pd archive/i2pd-${ABILIST[$ABI]} + fi +done + +cp i2pd archive/i2pd +cp -rH ../../android/assets/* archive/ + +# Compress files +cd archive +zip -r6 ../i2pd_${GITDESC}_android_binary.zip . + +# Remove temporary folder +cd .. +rm -r archive diff --git a/contrib/android_binary_pack/i2pd b/contrib/android_binary_pack/i2pd new file mode 100755 index 00000000..aeaae804 --- /dev/null +++ b/contrib/android_binary_pack/i2pd @@ -0,0 +1,33 @@ +#!/bin/sh + +# Copyright (c) 2013-2019, The PurpleI2P Project +# +# This file is part of Purple i2pd project and licensed under BSD3 +# +# See full license text in LICENSE file at top of project tree +# +# That script written for use with Termux. + +# https://stackoverflow.com/a/246128 +SOURCE="${0}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + +arch=$(uname -m) + +screenfind=$(which screen) +if [ -z $screenfind ]; then + echo "Can't find 'screen' installed. That script needs it!"; + exit 1; +fi + +if [ -z i2pd-$arch ]; then + echo "Can't find i2pd binary for your archtecture."; + exit 1; +fi + +screen -AmdS i2pd ./i2pd-$arch --datadir=$DIR