2022-09-17 11:14:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
# This file is part of the Flowee project
|
2024-01-16 12:45:05 +01:00
|
|
|
# Copyright (C) 2022-2024 Tom Zander <tom@flowee.org>
|
2022-09-17 11:14:55 +02:00
|
|
|
#
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
_thehub_dir_="$1"
|
2022-11-10 16:42:34 +01:00
|
|
|
_pay_native_name_="$2"
|
2022-09-17 11:14:55 +02:00
|
|
|
|
2022-11-13 20:06:26 +01:00
|
|
|
if test -f smartBuild.sh; then
|
2024-01-16 12:45:05 +01:00
|
|
|
./smartBuild.sh
|
2022-09-17 11:14:55 +02:00
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
2024-01-16 12:45:05 +01:00
|
|
|
if test -z "$_thehub_dir_"; then
|
2022-09-17 11:14:55 +02:00
|
|
|
echo "Usage:"
|
2024-01-16 12:45:05 +01:00
|
|
|
echo " build-pay <HUB_builddir> [PAY_NATIVE_builddir]"
|
2022-09-17 11:14:55 +02:00
|
|
|
echo ""
|
|
|
|
|
echo "Start this client in your builddir"
|
2022-11-10 16:42:34 +01:00
|
|
|
echo "HUB-builddir is the dir where the android build of flowe-thehub is."
|
2024-01-16 12:45:05 +01:00
|
|
|
echo "Pay_NATIVE-builddir for a native build of flowee-pay, for translations."
|
2022-09-17 11:14:55 +02:00
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# check if the provided dir is really an android HUB-libs dir
|
|
|
|
|
_thehub_dir_=`realpath $_thehub_dir_`
|
|
|
|
|
_ok=0
|
|
|
|
|
if test -f $_thehub_dir_/lib/libflowee_p2p.a; then
|
2022-12-13 11:53:40 +01:00
|
|
|
if grep -q -- -DANDROID $_thehub_dir_/build.ninja; then
|
2022-09-17 11:14:55 +02:00
|
|
|
_ok=1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test "$_ok" -eq 0; then
|
2022-11-10 16:42:34 +01:00
|
|
|
echo "Invalid or not compiled for Android HUB build dir."
|
2022-09-17 11:14:55 +02:00
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test -z "$_docker_name_"; then
|
2023-10-31 22:08:21 +01:00
|
|
|
_docker_name_="codeberg.org/flowee/buildenv-android:v6.5.3"
|
2022-11-10 16:42:34 +01:00
|
|
|
fi
|
|
|
|
|
|
2022-11-13 20:06:26 +01:00
|
|
|
mkdir -p imports
|
2024-01-16 12:45:05 +01:00
|
|
|
if test -d "$_pay_native_name_"; then
|
|
|
|
|
cp -f "$_pay_native_name_"/*qm imports/
|
|
|
|
|
fi
|
2022-11-13 20:06:26 +01:00
|
|
|
|
2022-09-17 11:14:55 +02:00
|
|
|
floweePaySrcDir=`dirname $0`/..
|
2022-11-30 14:19:43 +01:00
|
|
|
if test -f $floweePaySrcDir/android/netlog.conf; then
|
2022-12-03 16:30:08 +01:00
|
|
|
developerSwitches="-DNetworkLogClient=ON -Dquick_deploy=ON"
|
2022-11-30 14:19:43 +01:00
|
|
|
fi
|
2022-09-17 11:14:55 +02:00
|
|
|
|
2022-11-13 20:06:26 +01:00
|
|
|
if test ! -f .config; then
|
2022-09-17 11:14:55 +02:00
|
|
|
cat << HERE > .config
|
2022-12-14 15:02:01 +01:00
|
|
|
#!/bin/bash
|
2022-09-17 11:14:55 +02:00
|
|
|
cd /home/builds/build
|
|
|
|
|
|
|
|
|
|
if ! test -f build.ninja; then
|
|
|
|
|
cmake \\
|
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/android-qt6/lib/cmake/Qt6/qt.toolchain.cmake \\
|
|
|
|
|
-DANDROID_SDK_ROOT=/opt/android-sdk \\
|
|
|
|
|
-DANDROID_NDK_ROOT=/opt/android-ndk \\
|
|
|
|
|
-Dflowee_DIR=/home/builds/floweelibs/cmake \\
|
|
|
|
|
-DOPENSSL_ROOT_DIR=/opt/android-ssl \\
|
|
|
|
|
-DOPENSSL_CRYPTO_LIBRARY=/opt/android-ssl/lib/libcrypto.a \\
|
|
|
|
|
-DOPENSSL_SSL_LIBRARY=/opt/android-ssl/lib/libssl.a \\
|
|
|
|
|
-DOPENSSL_INCLUDE_DIR=/opt/android-ssl/include/ \\
|
2022-12-03 16:30:08 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=Release $developerSwitches \\
|
2022-09-17 11:14:55 +02:00
|
|
|
-G Ninja \\
|
|
|
|
|
/home/builds/src
|
|
|
|
|
fi
|
|
|
|
|
HERE
|
|
|
|
|
chmod 755 .config
|
|
|
|
|
fi
|
|
|
|
|
|
2022-11-14 16:01:45 +01:00
|
|
|
if test ! -f .sign; then
|
|
|
|
|
cat << HERE > .sign
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
cd /home/builds/build
|
|
|
|
|
export QT_ANDROID_KEYSTORE_STORE_PASS=longPassword
|
|
|
|
|
export QT_ANDROID_KEYSTORE_KEY_PASS=longPassword
|
|
|
|
|
|
|
|
|
|
/usr/local/bin/androiddeployqt \
|
2023-06-23 15:52:39 +02:00
|
|
|
--release \
|
2022-11-14 16:01:45 +01:00
|
|
|
--input /home/builds/build/android-pay_mobile-deployment-settings.json \
|
|
|
|
|
--output /home/builds/build/android-build \
|
2024-10-24 14:31:11 +02:00
|
|
|
--sign /home/builds/src/android/selfsigned.keystore floweepay && \
|
|
|
|
|
echo -n "-- COPYING: " && \
|
2023-08-18 11:01:17 +02:00
|
|
|
cp -v android-build//build/outputs/apk/release/android-build-release-signed.apk floweepay.apk
|
2022-11-14 16:01:45 +01:00
|
|
|
HERE
|
|
|
|
|
chmod 755 .sign
|
|
|
|
|
fi
|
|
|
|
|
|
2022-11-13 20:06:26 +01:00
|
|
|
if ! test -f smartBuild.sh; then
|
|
|
|
|
cat << HERE > smartBuild.sh
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
#Created by build-pay.sh
|
|
|
|
|
|
|
|
|
|
if test "\$1" = "distclean"; then
|
2023-08-30 18:11:25 +02:00
|
|
|
mv android-build/assets/blockheaders .
|
|
|
|
|
perl -e 'use File::Path qw(remove_tree); opendir DIR, "."; while (\$entry = readdir DIR) { if (\$entry=~/^\./) { next; } if (\$entry=~/smartBuild.sh$/ || \$entry=~/^imports$/ || \$entry=~/^blockheaders$/) { next; } unlink "\$entry"; remove_tree "\$entry"; }'
|
|
|
|
|
mkdir -p android-build/assets/
|
|
|
|
|
mv blockheaders android-build/assets/
|
2022-11-13 20:06:26 +01:00
|
|
|
fi
|
|
|
|
|
|
2022-12-14 15:02:01 +01:00
|
|
|
if test -f .docker; then
|
|
|
|
|
DOCKERID=\`cat .docker\`
|
|
|
|
|
if test -n "\$DOCKERID"; then
|
|
|
|
|
if test -z "\`docker container inspect \$DOCKERID | grep '"Status": "running"'\`"; then
|
|
|
|
|
echo "docker image died, removing"
|
|
|
|
|
docker container rm \$DOCKERID
|
|
|
|
|
DOCKERID=""
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
if test -z "\$DOCKERID"; then
|
|
|
|
|
echo "starting docker container"
|
|
|
|
|
DOCKERID=\`docker run -d -ti \\
|
|
|
|
|
--volume=`pwd`:/home/builds/build \\
|
|
|
|
|
--volume=$floweePaySrcDir:/home/builds/src \\
|
|
|
|
|
--volume=$_thehub_dir_:/home/builds/floweelibs \\
|
2023-02-06 21:56:37 +01:00
|
|
|
${_docker_name_} /bin/bash\`
|
2022-12-14 15:02:01 +01:00
|
|
|
echo "\$DOCKERID" > .docker
|
|
|
|
|
fi
|
|
|
|
|
execInDocker="docker container exec --workdir /home/builds --user \`id -u\` \$DOCKERID"
|
|
|
|
|
|
|
|
|
|
if test ! -f build.ninja; then
|
|
|
|
|
cp -n imports/*qm .
|
|
|
|
|
\$execInDocker build/.config
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test -f $floweePaySrcDir/android/netlog.conf; then
|
|
|
|
|
cp $floweePaySrcDir/android/netlog.conf android-build/assets/
|
|
|
|
|
fi
|
|
|
|
|
|
2024-01-25 19:48:21 +01:00
|
|
|
\$execInDocker /usr/bin/ninja -C build pay_mobile pay_mobile_prepare_apk_dir && \
|
2024-01-16 12:45:05 +01:00
|
|
|
if test "\$1" = "sign" -o "\$2" = "sign"; then
|
2022-12-14 15:02:01 +01:00
|
|
|
\$execInDocker build/.sign
|
2022-11-14 16:01:45 +01:00
|
|
|
fi
|
2022-11-13 20:06:26 +01:00
|
|
|
|
2022-09-17 11:14:55 +02:00
|
|
|
HERE
|
2022-11-13 20:06:26 +01:00
|
|
|
chmod 700 smartBuild.sh
|
2022-09-17 11:14:55 +02:00
|
|
|
fi
|
|
|
|
|
|
2024-01-22 15:30:40 +01:00
|
|
|
./smartBuild.sh
|