ci update, cpp update
This commit is contained in:
@@ -15,8 +15,8 @@ env:
|
||||
TOOLCHAIN_DIR: /opt/android/toolchain
|
||||
NPROC: 4
|
||||
CLEAN_PATH: /usr/cmake-3.14.6-Linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
PATH: /usr/cmake-3.14.6-Linux-x86_64/bin:/opt/android/toolchain/${{ matrix.host_triplet }}/bin:/opt/android/toolchain/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
# CMake
|
||||
CMAKE_VERSION: '3.14.6'
|
||||
CMAKE_HASH: '82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd'
|
||||
@@ -174,11 +174,8 @@ jobs:
|
||||
&& git reset --hard ${UTF8PROC_HASH}
|
||||
- name: Make standalone toolchain
|
||||
run: |
|
||||
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
|
||||
--arch ${{ matrix.short_arch }} \
|
||||
--api 21 \
|
||||
--install-dir ${TOOLCHAIN_DIR} \
|
||||
--stl=libc++
|
||||
cd ${{ github.workspace }} \
|
||||
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch ${{ matrix.short_arch }} --api 21 --install-dir ${TOOLCHAIN_DIR} --stl=libc++
|
||||
- name: Build boost (1/2)
|
||||
run: |
|
||||
cd ${{ github.workspace }} \
|
||||
@@ -209,12 +206,7 @@ jobs:
|
||||
cd ${{ github.workspace }} \
|
||||
&& cd openssl-${OPENSSL_VERSION} \
|
||||
&& export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \
|
||||
&& ./Configure android-${{ matrix.short_arch }} \
|
||||
-D__ANDROID_API__=21 \
|
||||
-static \
|
||||
no-shared no-tests \
|
||||
--with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib \
|
||||
--prefix=${PREFIX} --openssldir=${PREFIX} \
|
||||
&& ./Configure android-${{ matrix.short_arch }} -D__ANDROID_API__=21 -static no-shared no-tests --with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib --prefix=${PREFIX} --openssldir=${PREFIX} \
|
||||
&& make -j${NPROC} &>/tmp/openssl_log.txt || cat /tmp/openssl_log.txt \
|
||||
&& make install_sw &>/tmp/openssl_log_2.txt || cat /tmp/openssl_log_2.txt
|
||||
- name: Build ZMQ
|
||||
@@ -276,26 +268,24 @@ jobs:
|
||||
PATH=${CLEAN_PATH} \
|
||||
&& mkdir -p build/release \
|
||||
&& cd build/release \
|
||||
&& if [[ "x${{ matrix.monero_cmake_arm_mode }}" == "xON" ]]; then \
|
||||
CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARM_MODE="ON" -D CMAKE_ANDROID_ARCH_ABI="${{ matrix.full_arch }}" ../.. ; \
|
||||
else
|
||||
CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="${{ matrix.full_arch }}" ../.. ; \
|
||||
fi
|
||||
&& if [[ "x${{ matrix.monero_cmake_arm_mode }}" == "xON" ]]; then echo xON \
|
||||
&& env CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARM_MODE="ON" -D CMAKE_ANDROID_ARCH_ABI="${{ matrix.full_arch }}" ../.. ; else echo xONelse \
|
||||
&& env CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="${{ matrix.full_arch }}" ../.. ; fi
|
||||
- name: Build monero (2/2) build
|
||||
run: |
|
||||
cd ${{ github.workspace }} \
|
||||
&& cd monero \
|
||||
&& cd build/release \
|
||||
&& export CMAKE_INCLUDE_PATH="${PREFIX}/include" \
|
||||
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
|
||||
ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
|
||||
USE_SINGLE_BUILDDIR=1 \
|
||||
PATH=${CLEAN_PATH} \
|
||||
&& make wallet_api -j${NPROC}
|
||||
# && ln -s /src/build/release/lib/ /opt/android/monero \
|
||||
&& export CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
|
||||
&& export ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
|
||||
&& export USE_SINGLE_BUILDDIR=1 \
|
||||
&& export PATH=${CLEAN_PATH} \
|
||||
&& make wallet_api -j${NPROC}
|
||||
- name: Copy prefix from $PREFIX to local
|
||||
run: |
|
||||
cp -a /opt/android/prefix ${{ github.workspace }}/prefix
|
||||
cd ${{ github.workspace }} \
|
||||
&& cp -a /opt/android/prefix ${{ github.workspace }}/prefix
|
||||
- name: Build libbridge (1/2) configure
|
||||
run: |
|
||||
cd ${{ github.workspace }} \
|
||||
@@ -312,8 +302,12 @@ jobs:
|
||||
&& make -j${NPROC}
|
||||
- name: Rename libwallet2_api_c.so
|
||||
run: |
|
||||
cd ${{ github.workspace }}/libbridge/build/
|
||||
mv libwallet2_api_c.so ${{ matrix.host_triplet }}_libwallet2_api_c.so
|
||||
cd ${{ github.workspace }}/libbridge/build/ \
|
||||
&& mv libwallet2_api_c.so ${{ matrix.host_triplet }}_libwallet2_api_c.so \
|
||||
&& sha256sum ${{ matrix.host_triplet }}_libwallet2_api_c.so > ${{ matrix.host_triplet }}_libwallet2_api_c.so.sha256
|
||||
- name: act - copy workspace to /opt/wspace
|
||||
if: ${{ env.ACT }}
|
||||
run: cp -a ${{ github.workspace }} /opt/wspace
|
||||
- name: Create release
|
||||
uses: https://gitea.com/akkuman/gitea-release-action@v1
|
||||
with:
|
||||
@@ -322,4 +316,5 @@ jobs:
|
||||
It was build from **${{ github.ref }}** commit `${{ github.sha }}`
|
||||
Grab corresponding [wallet2_api_c.h](https://git.mrcyjanek.net/mrcyjanek/monero_c/src/commit/${{ github.sha }}/libbridge/src/main/cpp/wallet2_api_c.h)
|
||||
files: |-
|
||||
${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so
|
||||
${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so
|
||||
${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.sha256
|
||||
@@ -1,3 +1,42 @@
|
||||
# wallet2_api.h (but this time C compatible)
|
||||
|
||||
Wrapper around wallet2_api.h that can be called using C api.
|
||||
Wrapper around wallet2_api.h that can be called using C api.
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute you can visit git.mrcyjanek.net/mrcyjanek/monero_c and open a PR, alternatively use any other code mirror or send patches directly.
|
||||
|
||||
## Building (android)
|
||||
|
||||
Builds are provided in the [release tab](https://git.mrcyjanek.net/mrcyjanek/monero_c/releases), built using Gitea Runners. Building locally is possible as well, althought it is rather a heavy task which takes ~2 hours to finish (excluding enviroment setup and some downloads).
|
||||
|
||||
Base image for the runner is `registry.mrcyjanek.net/androidndk:r17c`, which contains preinstalled NDK. `Dockerfile` can be obtained from [mrcyjanek/CIimages](https://git.mrcyjanek.net/mrcyjanek/CIimages/src/branch/master/Dockerfile.androidndk-r17c) repository.
|
||||
|
||||
Then to build `.github/workflows/*.yml` files are used.
|
||||
|
||||
Local build?
|
||||
|
||||
```bash
|
||||
$ act --pull=false -Pandroidndk-r17c=registry.mrcyjanek.net/androidndk:r17c
|
||||
```
|
||||
|
||||
For development?
|
||||
|
||||
```bash
|
||||
$ timeout 5 act --pull=false -Pandroidndk-r17c=registry.mrcyjanek.net/androidndk:r17c # needed to clear cache.
|
||||
$ act --pull=false -Pandroidndk-r17c=registry.mrcyjanek.net/androidndk:r17c --reuse
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE .....................................
|
||||
d0626dcd8c5d registry.mrcyjanek.net/androidndk:r17c ....
|
||||
$ docker commit d0626dcd8c5d monero_c:dev
|
||||
$ docker run --rm -it \
|
||||
-v $PWD/libbridge:/opt/wspace/libbridge_up \
|
||||
--entrypoint /bin/bash \
|
||||
monero_c:dev
|
||||
[docker] $ export 'PATH=/usr/cmake-3.14.6-Linux-x86_64/bin:/opt/android/toolchain/aarch64-linux-android/bin:/opt/android/toolchain/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
[docker] $ cd /opt/wspace/libbridge_up
|
||||
[docker] $ rm -rf build && mkdir build && cd build
|
||||
[docker] $ env CC=clang CXX=clang++ cmake -DANDROID_ABI=-arm64-v8a ..
|
||||
[docker] $ make
|
||||
# Resulting file will be available in the current directory.
|
||||
```
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
MONERUJO_monero with monero release-v0.18.2.2-monerujo cfd9e4f661cf
|
||||
@@ -1,178 +0,0 @@
|
||||
FROM registry.mrcyjanek.net/androidndk:r17c
|
||||
|
||||
RUN set -x \
|
||||
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
|
||||
--arch arm64 \
|
||||
--api 21 \
|
||||
--install-dir ${TOOLCHAIN_DIR} \
|
||||
--stl=libc++
|
||||
|
||||
#INSTALL cmake
|
||||
ARG CMAKE_VERSION=3.14.6
|
||||
ARG CMAKE_HASH=82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd
|
||||
RUN set -x \
|
||||
&& cd /usr \
|
||||
&& curl -L -O https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
|
||||
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" | sha256sum -c \
|
||||
&& tar -xzf /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
|
||||
&& rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz
|
||||
ENV PATH /usr/cmake-${CMAKE_VERSION}-Linux-x86_64/bin:$PATH
|
||||
|
||||
## Boost
|
||||
ARG BOOST_VERSION=1_70_0
|
||||
ARG BOOST_VERSION_DOT=1.70.0
|
||||
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
|
||||
RUN set -x \
|
||||
&& curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
|
||||
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& cd boost_${BOOST_VERSION} \
|
||||
&& ./bootstrap.sh --prefix=${PREFIX}
|
||||
|
||||
ENV HOST_PATH $PATH
|
||||
ENV PATH $TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin:$PATH
|
||||
|
||||
ARG NPROC=4
|
||||
|
||||
# Build iconv for lib boost locale
|
||||
ENV ICONV_VERSION 1.16
|
||||
ENV ICONV_HASH e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
|
||||
RUN set -x \
|
||||
&& curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
|
||||
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& cd libiconv-${ICONV_VERSION} \
|
||||
&& CC=clang CXX=clang++ ./configure --build=x86_64-linux-gnu --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath \
|
||||
&& make -j${NPROC} && make install
|
||||
|
||||
## Build BOOST
|
||||
RUN set -x \
|
||||
&& cd boost_${BOOST_VERSION} \
|
||||
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
||||
|
||||
# download, configure and make Zlib
|
||||
ENV ZLIB_VERSION 1.3
|
||||
ENV ZLIB_HASH ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e
|
||||
RUN set -x \
|
||||
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
||||
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& rm zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& mv zlib-${ZLIB_VERSION} zlib \
|
||||
&& cd zlib && CC=clang CXX=clang++ ./configure --static \
|
||||
&& make -j${NPROC}
|
||||
|
||||
# open ssl
|
||||
ARG OPENSSL_VERSION=3.0.5
|
||||
ARG OPENSSL_HASH=aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a
|
||||
# openssl explicitly demands to be built by a clang that has a "/prebuilt/" somewhere along its path, so use the prebuilt version, but make sure to specify the target android api
|
||||
RUN set -x \
|
||||
&& curl -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
|
||||
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& cd openssl-${OPENSSL_VERSION} \
|
||||
&& export not=needed PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \
|
||||
&& ./Configure android-arm64 \
|
||||
-D__ANDROID_API__=21 \
|
||||
-static \
|
||||
no-shared no-tests \
|
||||
--with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib \
|
||||
--prefix=${PREFIX} --openssldir=${PREFIX} \
|
||||
&& make -j${NPROC} \
|
||||
&& make install_sw
|
||||
|
||||
# ZMQ
|
||||
ARG ZMQ_VERSION=v4.3.2
|
||||
ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
|
||||
RUN set -x \
|
||||
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
|
||||
&& cd libzmq \
|
||||
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
|
||||
&& ./autogen.sh \
|
||||
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
|
||||
&& make -j${NPROC} \
|
||||
&& make install
|
||||
|
||||
# Sodium
|
||||
ARG SODIUM_VERSION=1.0.18
|
||||
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
|
||||
RUN set -x \
|
||||
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \
|
||||
&& cd libsodium \
|
||||
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
|
||||
&& ./autogen.sh \
|
||||
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
|
||||
&& make -j${NPROC} \
|
||||
&& make install
|
||||
|
||||
# libexpat (required by libunbound)
|
||||
ARG LIBEXPAT_VERSION=R_2_4_8
|
||||
ARG LIBEXPAT_HASH=3bab6c09bbe8bf42d84b81563ddbcf4cca4be838
|
||||
RUN set -x \
|
||||
&& git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION} \
|
||||
&& cd libexpat/expat \
|
||||
&& test `git rev-parse HEAD` = ${LIBEXPAT_HASH} || exit 1 \
|
||||
&& ./buildconf.sh \
|
||||
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
|
||||
&& make -j${NPROC} \
|
||||
&& make install
|
||||
|
||||
# libunbound
|
||||
ARG LIBUNBOUND_VERSION=branch-1.16.1
|
||||
ARG LIBUNBOUND_HASH=903538c76e1d8eb30d0814bb55c3ef1ea28164e8
|
||||
RUN git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION}
|
||||
RUN set -x \
|
||||
&& cd unbound \
|
||||
&& test `git rev-parse HEAD` = ${LIBUNBOUND_HASH} || exit 1 \
|
||||
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared --disable-flto --with-ssl=${PREFIX} --with-libexpat=${PREFIX} \
|
||||
&& make -j${NPROC} \
|
||||
&& make install
|
||||
|
||||
# polyseed
|
||||
RUN git clone https://github.com/tevador/polyseed.git
|
||||
RUN set -x \
|
||||
&& cd polyseed \
|
||||
&& git reset --hard b7c35bb3c6b91e481ecb04fc235eaff69c507fa1 \
|
||||
&& CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \
|
||||
&& make \
|
||||
&& make install
|
||||
|
||||
# utf8proc
|
||||
RUN git clone https://github.com/JuliaStrings/utf8proc -b v2.8.0
|
||||
RUN set -x \
|
||||
&& cd utf8proc \
|
||||
&& git reset --hard 1cb28a66ca79a0845e99433fd1056257456cef8b \
|
||||
&& mkdir build \
|
||||
&& cd build \
|
||||
&& rm -rf ../CMakeCache.txt ../CMakeFiles/ \
|
||||
&& CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. \
|
||||
&& make \
|
||||
&& make install
|
||||
|
||||
COPY monero/ /src
|
||||
|
||||
RUN cd /src \
|
||||
&& export CMAKE_INCLUDE_PATH="${PREFIX}/include" \
|
||||
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
|
||||
ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
|
||||
USE_SINGLE_BUILDDIR=1 \
|
||||
PATH=${HOST_PATH} \
|
||||
&& mkdir -p build/release \
|
||||
&& cd build/release \
|
||||
&& CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../.. \
|
||||
&& make wallet_api -j ${NPROC}
|
||||
|
||||
RUN set -x \
|
||||
&& cd /src/build/release \
|
||||
&& find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;
|
||||
|
||||
COPY ./libbridge /opt/android/libbridge
|
||||
RUN cd libbridge/ \
|
||||
&& ln -s /src/build/release/lib/ /opt/android/monero \
|
||||
&& mkdir build \
|
||||
&& cd build \
|
||||
&& env CC=clang CXX=clang++ cmake -DANDROID_ABI=arm64-v8a .. \
|
||||
&& make -j${NPROC}
|
||||
@@ -173,7 +173,7 @@ set_target_properties(rpc_base PROPERTIES IMPORTED_LOCATION
|
||||
# TODO(mrcyjanek): fix (x86_64 maybe?)
|
||||
add_library(wallet-crypto STATIC IMPORTED)
|
||||
set_target_properties(wallet-crypto PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero/libwallet-crypto.a)
|
||||
${EXTERNAL_LIBS_DIR}/monero/build/release/src/crypto/wallet/libwallet-crypto.a)
|
||||
|
||||
add_library(cryptonote_format_utils_basic STATIC IMPORTED)
|
||||
set_target_properties(cryptonote_format_utils_basic PROPERTIES IMPORTED_LOCATION
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2017 m2049r
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "wallet2_api_c.h"
|
||||
#include "wallet2_api.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@@ -40,12 +25,10 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// void* MONERO_createWalletJ(const char* path, const char* password, const char* language, int networkType);
|
||||
void* MONERO_createWalletJ(const char* path, const char* password, const char* language, int networkType) {
|
||||
// void* MONERO_WalletManager_createWallet(const char* path, const char* password, const char* language, int networkType)
|
||||
void* MONERO_WalletManager_createWallet(const char* path, const char* password, const char* language, int networkType) {
|
||||
Monero::NetworkType _networkType = static_cast<Monero::NetworkType>(networkType);
|
||||
|
||||
std::cout << "WE GOT OUT\n";
|
||||
|
||||
std::string _path(path);
|
||||
std::string _password(password);
|
||||
std::string _language(language);
|
||||
@@ -60,15 +43,26 @@ void* MONERO_createWalletJ(const char* path, const char* password, const char* l
|
||||
_language,
|
||||
_networkType);
|
||||
|
||||
int status;
|
||||
std::string errorString;
|
||||
wallet->statusWithErrorString(status, errorString);
|
||||
|
||||
std::cout << status << " - " << errorString << "\n";
|
||||
|
||||
return reinterpret_cast<void*>(wallet);
|
||||
}
|
||||
|
||||
// virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0) = 0;
|
||||
|
||||
const char* MONERO_Wallet_errorString(void* wallet_ptr) {
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->errorString().c_str();
|
||||
}
|
||||
|
||||
int MONERO_Wallet_status(void* wallet_ptr) {
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->status();
|
||||
}
|
||||
|
||||
int MONERO_DEBUG_sleep(int time) {
|
||||
sleep(time);
|
||||
return time-1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2017 m2049r
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef XMRWALLET_WALLET_LIB_H
|
||||
#define XMRWALLET_WALLET_LIB_H
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
/*
|
||||
#include <android/log.h>
|
||||
|
||||
@@ -28,54 +7,16 @@
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
|
||||
*/
|
||||
|
||||
jfieldID getHandleField(JNIEnv *env, jobject obj, const char *fieldName = "handle") {
|
||||
jclass c = env->GetObjectClass(obj);
|
||||
return env->GetFieldID(c, fieldName, "J"); // of type long
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T *getHandle(JNIEnv *env, jobject obj, const char *fieldName = "handle") {
|
||||
jlong handle = env->GetLongField(obj, getHandleField(env, obj, fieldName));
|
||||
return reinterpret_cast<T *>(handle);
|
||||
}
|
||||
|
||||
void setHandleFromLong(JNIEnv *env, jobject obj, jlong handle) {
|
||||
env->SetLongField(obj, getHandleField(env, obj), handle);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void setHandle(JNIEnv *env, jobject obj, T *t) {
|
||||
jlong handle = reinterpret_cast<jlong>(t);
|
||||
setHandleFromLong(env, obj, handle);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void* MONERO_createWalletJ(const char* path, const char* password, const char* language, int networkType);
|
||||
|
||||
extern const char* const MONERO_VERSION; // the actual monero core version
|
||||
|
||||
// from monero-core crypto/hash-ops.h - avoid #including monero code here
|
||||
enum {
|
||||
HASH_SIZE = 32,
|
||||
HASH_DATA_AREA = 136
|
||||
};
|
||||
|
||||
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height);
|
||||
|
||||
inline void slow_hash(const void *data, const size_t length, char *hash) {
|
||||
cn_slow_hash(data, length, hash, 0 /*variant*/, 0 /*prehashed*/, 0 /*height*/);
|
||||
}
|
||||
|
||||
inline void slow_hash_broken(const void *data, char *hash, int variant) {
|
||||
cn_slow_hash(data, 200 /*sizeof(union hash_state)*/, hash, variant, 1 /*prehashed*/, 0 /*height*/);
|
||||
}
|
||||
void* MONERO_WalletManager_createWallet(const char* path, const char* password, const char* language, int networkType);
|
||||
const char* MONERO_Wallet_errorString(void* wallet_ptr);
|
||||
int MONERO_Wallet_status(void* wallet_ptr);
|
||||
int MONERO_DEBUG_sleep(int time);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //XMRWALLET_WALLET_LIB_H
|
||||
#endif
|
||||
Executable
Reference in New Issue
Block a user