Files
monero_c/.github/workflows/linux.yml
Czarek Nakamoto a61bd15409 fixed zlib version
2024-02-17 19:05:48 +01:00

302 lines
14 KiB
YAML

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.1'
ZLIB_HASH: '9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23'
# 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: 'git.mrcyjanek.net_mrcyjanek_monero'
MONERO_GIT_SOURCE: https://git.mrcyjanek.net/mrcyjanek/monero.git
MONERO_TAG: 'release-v0.18.3.1-anonero'
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 checkinstall
- name: Checkout repository code
uses: actions/checkout@v3
- name: Download monero
run: |
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: |
cd ${{ github.workspace }} \
&& curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://archives.boost.io/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: |
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: |
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: |
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: |
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: |
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: |
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: |
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: |
cd ${{ github.workspace }} \
&& git clone https://github.com/tevador/polyseed.git \
&& cd polyseed \
&& git reset --hard ${POLYSEED_HASH}
- name: Download utf8proc
run: |
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: |
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: |
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: |
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: |
cd ${{ github.workspace }} \
&& cd zlib \
&& ./configure --static \
&& make -j${NPROC}
- name: Build OpenSSL
run: |
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: |
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: |
cd ${{ github.workspace }} \
&& cd libsodium \
&& ./autogen.sh \
&& ./configure --prefix=${PREFIX} --host=${{ matrix.host_triplet }} --enable-static --disable-shared --with-pic \
&& make -j${NPROC} \
&& make install
- name: Build libexpat
run: |
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: |
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: |
cd ${{ github.workspace }} \
&& cd polyseed \
&& cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \
&& make -j${NPROC} \
&& make install
- name: Build utf8proc
run: |
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: |
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: |
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: |
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/ \
&& cp 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: Publish .deb
# run: |
# cd ${{ github.workspace }} \
# && LD_PRELOAD=/usr/lib/checkinstall/installwatch.so checkinstall --type=debian --pkgname="libwallet2-api-c" --pkgversion="$(git describe --tags | sed 's/v//')" --nodoc --strip=no --stripso=no --maintainer=cyjan@mrcyjanek.net --install=no -y \
# ; ls -lah *.deb \
# ; curl --user mrcyjanek:$PAT_SECRET_PACKAGE --upload-file $(echo *.deb) https://git.mrcyjanek.net/api/packages/mrcyjanek/debian/pool/no-distro/main/upload
# - 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
continue-on-error: true
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