From 4e2042150086b6a35218e375809af6cd15fef349 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Thu, 2 Mar 2023 02:56:43 +0200 Subject: [PATCH] Parametrize appimage-builder recipe, setup environment in build.sh, start from building amd64 appimage, download appimage-builder in docker. --- .buildbot/appimage/Dockerfile | 3 +++ .buildbot/appimage/build.sh | 37 +++++++++++++++++++++++---- packages/AppImage/AppImageBuilder.yml | 12 ++++----- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/.buildbot/appimage/Dockerfile b/.buildbot/appimage/Dockerfile index 5672c785..5de7ed7e 100644 --- a/.buildbot/appimage/Dockerfile +++ b/.buildbot/appimage/Dockerfile @@ -19,4 +19,7 @@ RUN apt-get update | true RUN apt-get install -yq libssl-dev:armhf +RUN wget -qO appimage-builder-x86_64.AppImage \ + https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage + ADD . . diff --git a/.buildbot/appimage/build.sh b/.buildbot/appimage/build.sh index 02018b4f..07cb491b 100755 --- a/.buildbot/appimage/build.sh +++ b/.buildbot/appimage/build.sh @@ -1,11 +1,38 @@ -#!/bin/sh +#!/bin/bash -wget -O appimage-builder-x86_64.AppImage \ +export APPIMAGE_EXTRACT_AND_RUN=1 +BUILDER=appimage-builder-x86_64.AppImage +RECIPE=packages/AppImage/AppImageBuilder.yml + +export APP_VERSION=$(python setup.py --version) + +function set_sourceline { + if [ ${ARCH} == amd64 ]; then + export SOURCELINE="deb http://archive.ubuntu.com/ubuntu/ bionic main universe" + else + export SOURCELINE="deb [arch=${ARCH}] http://ports.ubuntu.com/ubuntu-ports/ bionic main universe" + fi +} + +[ -f ${BUILDER} ] || wget -qO ${BUILDER} \ https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage \ - && chmod +x appimage-builder-x86_64.AppImage + && chmod +x ${BUILDER} -APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder-x86_64.AppImage \ - --recipe packages/AppImage/AppImageBuilder.yml + +export ARCH=amd64 +export APPIMAGE_ARCH=x86_64 +export RUNTIME=${APPIMAGE_ARCH} +set_sourceline + +./${BUILDER} --recipe ${RECIPE} || exit 1 + +export ARCH=armhf +export RUNTIME=gnueabihf +export CC=arm-linux-gnueabihf-gcc +export CXX=${CC} +set_sourceline + +./${BUILDER} --recipe ${RECIPE} mkdir -p ../out mv PyBitmessage*.AppImage ../out diff --git a/packages/AppImage/AppImageBuilder.yml b/packages/AppImage/AppImageBuilder.yml index 27d339dc..8874efdb 100644 --- a/packages/AppImage/AppImageBuilder.yml +++ b/packages/AppImage/AppImageBuilder.yml @@ -2,7 +2,7 @@ version: 1 script: # Remove any previous build - rm -rf AppDir | true - - CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-gcc python setup.py install --prefix=/usr --root=AppDir + - python setup.py install --prefix=/usr --root=AppDir AppDir: path: ./AppDir @@ -11,7 +11,7 @@ AppDir: id: pybitmessage name: PyBitmessage icon: pybitmessage - version: 0.6.3.2 + version: !ENV ${APP_VERSION} # Set the python executable as entry point exec: usr/bin/python # Set the application main script path as argument. @@ -22,9 +22,9 @@ AppDir: - sed -i "s|GTK_.*||g" AppDir/AppRun.env apt: - arch: armhf + arch: !ENV '${ARCH}' sources: - - sourceline: 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main universe' + - sourceline: !ENV '${SOURCELINE}' key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32' include: @@ -67,7 +67,7 @@ AppDir: - usr/share/doc runtime: - arch: [ gnueabihf ] + arch: [ !ENV '${RUNTIME}' ] env: # Set python home # See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME @@ -77,4 +77,4 @@ AppDir: PYTHONPATH: '${APPDIR}/usr/lib/python2.7/site-packages' AppImage: - arch: armhf + arch: !ENV '${APPIMAGE_ARCH}'