Solve the issue with cross-compiling bitmsghash for ARM #2221

Merged
PeterSurda merged 2 commits from gitea-96 into v0.6 2024-05-09 16:21:26 +02:00
2 changed files with 30 additions and 13 deletions

View File

@ -14,36 +14,45 @@ function set_sourceline {
fi fi
} }
function build_appimage {
set_sourceline
./${BUILDER} --recipe ${RECIPE} || exit 1
rm -rf build
}
[ -f ${BUILDER} ] || wget -qO ${BUILDER} \ [ -f ${BUILDER} ] || wget -qO ${BUILDER} \
https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage \ https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage \
&& chmod +x ${BUILDER} && chmod +x ${BUILDER}
chmod 1777 /tmp
export ARCH=amd64 export ARCH=amd64
export APPIMAGE_ARCH=x86_64 export APPIMAGE_ARCH=x86_64
export RUNTIME=${APPIMAGE_ARCH} export RUNTIME=${APPIMAGE_ARCH}
set_sourceline
./${BUILDER} --recipe ${RECIPE} || exit 1 build_appimage
export ARCH=armhf export ARCH=armhf
export APPIMAGE_ARCH=${ARCH} export APPIMAGE_ARCH=${ARCH}
export RUNTIME=gnueabihf export RUNTIME=gnueabihf
export CC=arm-linux-gnueabihf-gcc export CC=arm-linux-gnueabihf-gcc
export CXX=${CC} export CXX=${CC}
set_sourceline
./${BUILDER} --recipe ${RECIPE} || exit 1 build_appimage
export ARCH=arm64 export ARCH=arm64
export APPIMAGE_ARCH=aarch64 export APPIMAGE_ARCH=aarch64
export RUNTIME=${APPIMAGE_ARCH} export RUNTIME=${APPIMAGE_ARCH}
export CC=aarch64-linux-gnu-gcc export CC=aarch64-linux-gnu-gcc
export CXX=${CC} export CXX=${CC}
set_sourceline
./${BUILDER} --recipe ${RECIPE} build_appimage
mkdir -p ../out EXISTING_OWNER=$(stat -c %u ../out) || mkdir -p ../out
sha256sum PyBitmessage*.AppImage > ../out/SHA256SUMS
sha256sum PyBitmessage*.AppImage >> ../out/SHA256SUMS
cp PyBitmessage*.AppImage ../out cp PyBitmessage*.AppImage ../out
if [ ${EXISTING_OWNER} ]; then
chown ${EXISTING_OWNER} ../out/PyBitmessage*.AppImage ../out/SHA256SUMS
fi

View File

@ -5,11 +5,11 @@ Proof of work calculation
import ctypes import ctypes
import os import os
import subprocess # nosec B404
import sys import sys
import tempfile import tempfile
import time import time
from struct import pack, unpack from struct import pack, unpack
from subprocess import call # nosec B404
import highlevelcrypto import highlevelcrypto
import openclpow import openclpow
@ -278,18 +278,26 @@ def buildCPoW():
try: try:
if "bsd" in sys.platform: if "bsd" in sys.platform:
# BSD make # BSD make
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"), subprocess.check_call([ # nosec B607, B603
'-f', 'Makefile.bsd']) # nosec B607, B603 "make", "-C", os.path.join(paths.codePath(), "bitmsghash"),
'-f', 'Makefile.bsd'])
else: else:
# GNU make # GNU make
call([ # nosec B607, B603 subprocess.check_call([ # nosec B607, B603
"make", "-C", os.path.join(paths.codePath(), "bitmsghash")]) "make", "-C", os.path.join(paths.codePath(), "bitmsghash")])
if os.path.exists(os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")): if os.path.exists(
os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")
):
init() init()
notifyBuild(True) notifyBuild(True)
else: else:
notifyBuild(True) notifyBuild(True)
except (OSError, subprocess.CalledProcessError):
notifyBuild(True)
except: # noqa:E722 except: # noqa:E722
logger.warning(
'Unexpected exception rised when tried to build bitmsghash lib',
exc_info=True)
notifyBuild(True) notifyBuild(True)