From 7b7bca87a535462dac62e087309bf90c04495005 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 2 Jan 2024 22:45:20 +0100 Subject: drop android's `log` library. linux support --- .github/workflows/linux.yml | 445 +++++++++++++++++++++++++++++++ libbridge/CMakeLists.txt | 4 +- libbridge/src/main/cpp/helpers.cpp | 1 + libbridge/src/main/cpp/wallet2_api_c.cpp | 1 + 4 files changed, 448 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linux.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..08b24f0 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,445 @@ +name: Linux Release +run-name: Building monero_c for linux +on: + push: + tags: + - '*' + +# cat envs.txt | sed 's/ //g' | sed 's/: /=/g' | grep -v '#' > .env +# export $(cat .env | xargs) +env: + PREFIX: /opt/linux/prefix + NPROC: 4 + PATH: /usr/cmake-3.14.6-Linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + + # CMake + CMAKE_VERSION: '3.14.6' + CMAKE_HASH: '82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd' + # Boost + BOOST_VERSION: '1_70_0' + BOOST_VERSION_DOT: '1.70.0' + BOOST_HASH: '430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778' + # iconv + ICONV_VERSION: '1.16' + ICONV_HASH: 'e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04' + # zlib + ZLIB_VERSION: '1.3' + ZLIB_HASH: 'ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e' + # OpenSSL + OPENSSL_VERSION: '3.2.0' + OPENSSL_HASH: '14c826f07c7e433706fb5c69fa9e25dab95684844b4c962a2cf1bf183eb4690e' + # ZMQ + ZMQ_VERSION: 'v4.3.2' + ZMQ_HASH: 'a84ffa12b2eb3569ced199660bac5ad128bff1f0' + # libsodium + SODIUM_VERSION: '1.0.18' + SODIUM_HASH: '4f5e89fa84ce1d178a6765b8b46f2b6f91216677' + # libexpat + LIBEXPAT_VERSION: 'R_2_4_8' + LIBEXPAT_HASH: '3bab6c09bbe8bf42d84b81563ddbcf4cca4be838' + # libunbound + LIBUNBOUND_VERSION: 'branch-1.16.1' + LIBUNBOUND_HASH: '903538c76e1d8eb30d0814bb55c3ef1ea28164e8' + # polyseed + POLYSEED_HASH: 'b7c35bb3c6b91e481ecb04fc235eaff69c507fa1' + # utf8proc + UTF8PROC_HASH: '1cb28a66ca79a0845e99433fd1056257456cef8b' + # (finally) monero + MONERO_GIT_SOURCE_SIMPLE: 'github.com_monero-project_monero' + MONERO_GIT_SOURCE: https://github.com/monero-project/monero + MONERO_TAG: 'v0.18.3.1' + + +jobs: + build-linux: + strategy: + matrix: + include: + - short_arch: x86_64 + full_arch: x86_64 + monero_arch: x86-64 + monero_buildtag: linux-x86_64 + monero_build64: 'ON' + monero_cmake_arm_mode: 'OFF' + host_triplet: x86_64-linux-gnu + runs-on: amd64-debian-bookworm + steps: + - name: apt install + run: apt update && apt install -y pkg-config m4 libtool automake autoconf bison + - name: Checkout repository code + uses: actions/checkout@v3 + - name: Download cached build artifacts + run: | + ${{ github.workspace }}/download_artifact.sh libsodium "${SODIUM_VERSION}-${{ matrix.host_triplet }}-${SODIUM_HASH}" ${{ github.workspace }}/prefix/lib/libsodium.a + ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libcrypto.a + ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libssl.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_chrono.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_date_time.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_filesystem.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_program_options.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_regex.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_serialization.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_system.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_thread.a + ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_wserialization.a + ${{ github.workspace }}/download_artifact.sh libunbound "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/prefix/lib/libunbound.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet_api.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/common/libcommon.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device/libdevice.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/libversion.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/net/libnet.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/wallet/libwallet-crypto.a + ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a + - name: Create skip flag based on cache + run: | + if [[ -f "${{ github.workspace }}/prefix/lib/libsodium.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libcrypto.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libssl.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_chrono.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_date_time.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_filesystem.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_program_options.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_regex.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_serialization.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_system.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_thread.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libboost_wserialization.a" ]] \ + && [[ -f "${{ github.workspace }}/prefix/lib/libunbound.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet_api.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/common/libcommon.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/device/libdevice.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/libversion.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/net/libnet.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a" ]] \ + && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a" ]]; \ + then \ + echo "Cache exist, creating /tmp/skip_deps"; \ + touch /tmp/skip_deps; \ + else \ + echo "Cache missing, this will be a looooong build."; \ + fi + - name: Download monero + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && rm -rf monero && git clone ${MONERO_GIT_SOURCE} --depth=1 --branch ${MONERO_TAG} monero \ + && cd monero \ + && git submodule init && git submodule update + - name: Install CMake + run: | + cd ${{ github.workspace }} \ + && 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 + - name: Download Boost + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && 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 -xf boost_${BOOST_VERSION}.tar.bz2 \ + && rm -f boost_${BOOST_VERSION}.tar.bz2 + - name: Download iconv + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && 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 + - name: Download zlib + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && 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 + - name: Download OpenSSL + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && 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 + - name: Download ZMQ + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth=1 \ + && cd libzmq \ + && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 + - name: Download libsodium + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth=1 \ + && cd libsodium \ + && test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 + - name: Download libexpat + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION} --depth=1 \ + && cd libexpat/expat \ + && test `git rev-parse HEAD` = ${LIBEXPAT_HASH} || exit 1 \ + - name: Download libunbound + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION} --depth=1 \ + && cd unbound \ + && test `git rev-parse HEAD` = ${LIBUNBOUND_HASH} || exit 1 + - name: Download polyseed + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/tevador/polyseed.git \ + && cd polyseed \ + && git reset --hard ${POLYSEED_HASH} + - name: Download utf8proc + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && git clone https://github.com/JuliaStrings/utf8proc -b v2.8.0 --depth=1 \ + && cd utf8proc \ + && git reset --hard ${UTF8PROC_HASH} + - name: Build boost (1/2) + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd boost_${BOOST_VERSION} \ + && ./bootstrap.sh --prefix=${PREFIX} + # iconv: libtool: warning: remember to run 'libtool --finish /opt/android/prefix/lib' + # TODO(mrcyjanek): x86_64-linux-gnu <- get this dynamically. + - name: Build iconv (for boost) + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd libiconv-${ICONV_VERSION} \ + && ./configure --build=x86_64-linux-gnu --host=${{ matrix.host_triplet }} --prefix=${PREFIX} --disable-rpath \ + && make -j${NPROC} \ + && make install + - name: Build boost (2/2) + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd boost_${BOOST_VERSION} \ + && echo -n -e '\n#undef PTHREAD_STACK_MIN\n#define PTHREAD_STACK_MIN 16384\n' | cat - ./boost/thread/pthread/thread_data.hpp > temp && mv temp ./boost/thread/pthread/thread_data.hpp \ + && ./b2 cxxflags=-fPIC cflags=-fPIC --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=linux --stagedir=linux toolset=gcc threading=multi threadapi=pthread -sICONV_PATH=${PREFIX} install -j${NPROC} &>/tmp/boost_log.txt || cat /tmp/boost_log.txt + - name: Build zlib + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd zlib \ + && ./configure --static \ + && make -j${NPROC} + - name: Build OpenSSL + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd openssl-${OPENSSL_VERSION} \ + && ./Configure -static no-shared no-tests --with-zlib-include=${{ github.workspace }}/zlib/include --with-zlib-lib=${{ github.workspace }}/zlib/lib --prefix=${PREFIX} --openssldir=${PREFIX} -fpic \ + && 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 + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd libzmq \ + && ./autogen.sh \ + && mkdir build && cd build \ + && cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_SHARED=OFF -DBUILD_TESTS=OFF .. \ + && make -j${NPROC} \ + && make install + - name: Build Sodium + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd libsodium \ + && ./autogen.sh \ + && ./configure --prefix=${PREFIX} --host=${{ matrix.host_triplet }} --enable-static --disable-shared \ + && make -j${NPROC} \ + && make install + - name: Build libexpat + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd libexpat/expat \ + && ./buildconf.sh \ + && ./configure --prefix=${PREFIX} --host=${{ matrix.host_triplet }} --enable-static --disable-shared \ + && make -j${NPROC} \ + && make install + - name: Fix paths + run: | + cp /opt/linux/prefix/lib64/* /opt/linux/prefix/lib -r + - name: Build libunbound + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd unbound \ + && ./configure -with-pic --prefix=${PREFIX} --enable-static --disable-shared --disable-flto --with-libexpat=${PREFIX} --with-ssl=${PREFIX} \ + && make -j${NPROC} \ + && make install + - name: Build polyseed + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd polyseed \ + && cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \ + && make -j${NPROC} \ + && make install + - name: Build utf8proc + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd utf8proc \ + && mkdir build \ + && cd build \ + && rm -rf ../CMakeCache.txt ../CMakeFiles/ \ + && cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. \ + && make -j${NPROC} \ + && make install + - name: Build monero (1/2) configure + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd monero \ + && export CMAKE_INCLUDE_PATH="${PREFIX}/include" \ + CMAKE_LIBRARY_PATH="${PREFIX}/lib" \ + USE_SINGLE_BUILDDIR=1 \ + && mkdir -p build/release \ + && cd build/release \ + && env 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=false -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Linux" ../.. + - name: Build monero (2/2) build + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cd monero \ + && cd build/release \ + && export CMAKE_INCLUDE_PATH="${PREFIX}/include" \ + && export CMAKE_LIBRARY_PATH="${PREFIX}/lib" \ + && export ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \ + && export USE_SINGLE_BUILDDIR=1 \ + && make wallet_api -j${NPROC} + - name: Copy prefix from $PREFIX to local + run: | + [[ -f "/tmp/skip_deps" ]] && exit 0; \ + cd ${{ github.workspace }} \ + && cp -a /opt/linux/prefix/lib64/* /opt/linux/prefix/lib \ + && cp -a /opt/linux/prefix ${{ github.workspace }}/prefix + - name: Build libbridge (1/2) configure + run: | + cd ${{ github.workspace }} \ + && cd libbridge \ + && mkdir build \ + && cd build \ + && env CC=gcc CXX=g++ cmake -DANDROID_ABI=linux-x86_64 .. + - name: Build libbridge (2/2) make + run: | + cd ${{ github.workspace }} \ + && cd libbridge \ + && cd build \ + && make -j${NPROC} + - name: Rename and compress libwallet2_api_c.so + run: | + 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 \ + && xz -e ${{ matrix.host_triplet }}_libwallet2_api_c.so \ + && sha256sum ${{ matrix.host_triplet }}_libwallet2_api_c.so.xz > ${{ matrix.host_triplet }}_libwallet2_api_c.so.xz.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: + body: | + This is a **preview** release to be used by testers. + It was built 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) + ### Release info + ${{ github.event.head_commit.message }} + files: |- + ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.xz + ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.sha256 + ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.xz.sha256 + - name: Create cache entries + run: | + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh libsodium "${SODIUM_VERSION}-${{ matrix.host_triplet }}-${SODIUM_HASH}" ${{ github.workspace }}/prefix/lib/libsodium.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libcrypto.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libssl.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_chrono.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_date_time.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_filesystem.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_program_options.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_regex.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_serialization.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_system.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_thread.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_wserialization.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh libunbound "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/prefix/lib/libunbound.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet_api.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/common/libcommon.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device/libdevice.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/libversion.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/net/libnet.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/wallet/libwallet-crypto.a + PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a \ No newline at end of file diff --git a/libbridge/CMakeLists.txt b/libbridge/CMakeLists.txt index e82b3d1..4729bb1 100644 --- a/libbridge/CMakeLists.txt +++ b/libbridge/CMakeLists.txt @@ -184,7 +184,7 @@ set_target_properties(cryptonote_format_utils_basic PROPERTIES IMPORTED_LOCATION # System ############# -find_library( log-lib log ) +#find_library( log-lib log ) include_directories( ${EXTERNAL_LIBS_DIR}/include ) @@ -241,6 +241,4 @@ target_link_libraries( wallet2_api_c crypto sodium - - log ) diff --git a/libbridge/src/main/cpp/helpers.cpp b/libbridge/src/main/cpp/helpers.cpp index ffb96f2..064ce36 100644 --- a/libbridge/src/main/cpp/helpers.cpp +++ b/libbridge/src/main/cpp/helpers.cpp @@ -8,6 +8,7 @@ #include "helpers.hpp" #include #include +#include const char* vectorToString(const std::vector& vec, const std::string separator) { // Concatenate all strings in the vector diff --git a/libbridge/src/main/cpp/wallet2_api_c.cpp b/libbridge/src/main/cpp/wallet2_api_c.cpp index b3ea430..e173526 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.cpp +++ b/libbridge/src/main/cpp/wallet2_api_c.cpp @@ -3,6 +3,7 @@ #include "wallet2_api.h" #include #include "helpers.hpp" +#include #ifdef __cplusplus extern "C" -- cgit v1.2.3