From 25cc8f442d23813e4e34fe669fbfea827d2c1377 Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Wed, 4 Oct 2023 23:16:22 +0200 Subject: [PATCH] Repair build of different type (debug, release) Refs: #25 --- .github/workflows/build.yaml | 10 ++++++---- CONTRIBUTING.md | 17 +++++++++++------ Containerfile | 10 ++++++---- crossfile_arm.ini.in | 14 ++++++-------- icons/meson.build | 2 ++ meson.build | 4 +++- 6 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f2b37ab..4436e2c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -59,12 +59,14 @@ jobs: - name: Build application run: | - meson setup builddir . --cross-file crossfile_arm.ini --buildtype=release - cd builddir - meson compile + meson setup builddir . \ + --cross-file crossfile_arm.ini \ + --buildtype=release \ + --strip + DESTDIR=artifact ninja -C builddir install - name: Upload archive uses: actions/upload-artifact@v3 with: - path: builddir/taranis.app + path: builddir/artifact if-no-files-found: error diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b68e6bd..5923f94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,12 +19,14 @@ and installed manually, see instructions below. ### Using a container To build the application *for a given version*, one can build a Docker -image and export the ELF file from that image:: +image and export an archive containing the ELF file from that image. For example, for a debug build of the most recent version:: ```sh - VERSION=v$(meson version | grep 'Project version: ' | cut -d':' -f 2 | tr -d '[:space:]') - buildah bud -t taranis-build:$VERSION --build-arg VERSION=${VERSION} . + VERSION=$(git tag --list 'v*' | sort --version-sort --reverse | head -n 1) + buildah bud -t taranis-build:${VERSION} \ + --build-arg="VERSION=${VERSION}" \ + --build-arg="MESON_ARGS=--buildtype=debug --strip=false" . podman run --rm -v ${PWD}:/opt/taranis \ - taranis-build:$VERSION bash -c "cp builddir/taranis.app /opt/taranis" + taranis-build:$VERSION bash -c "cp builddir/artifact.zip /opt/artifact.zip" ``` ### Cross-compile on a Debian host @@ -75,8 +77,11 @@ dependencies. 4. Finally build the application: ```sh - meson setup builddir . --cross-file crossfile_arm.ini - pushd builddir && meson compile; popd + meson setup builddir . \ + --cross-file crossfile_arm.ini \ + --buildtype=debug \ + --strip=false + DESTDIR=artifact ninja -C builddir install ``` ## Tooling diff --git a/Containerfile b/Containerfile index d44bb74..156d246 100644 --- a/Containerfile +++ b/Containerfile @@ -10,7 +10,8 @@ RUN apt-get update -y && apt-get upgrade -y && \ git \ libtinfo5 \ meson \ - wget && \ + wget \ + zip && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -47,6 +48,7 @@ RUN mkdir 3rd-parties && \ make -j4 && \ make install -RUN meson setup builddir . --cross-file crossfile_arm.ini && \ - cd builddir && \ - meson compile +ARG MESON_ARGS +RUN meson setup builddir . --cross-file crossfile_arm.ini ${MESON_ARGS} && \ + DESTDIR=artifact ninja -C builddir install +RUN cd builddir; zip -r artifact.zip artifact/ diff --git a/crossfile_arm.ini.in b/crossfile_arm.ini.in index 0065d37..f6e4724 100644 --- a/crossfile_arm.ini.in +++ b/crossfile_arm.ini.in @@ -9,14 +9,12 @@ pkgconfig = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/pkg-config' [built-in options] cpp_args = ['-fsigned-char', - '-Werror-return-type', - '-O3', - '-pipe', - '-fomit-frame-pointer', - '-march=armv7-a', - '-mtune=cortex-a8', - '-mfpu=neon', - '-mfloat-abi=softfp'] + '-fPIC', + '-Werror-return-type', + '-march=armv7-a', + '-mtune=cortex-a8', + '-mfpu=neon', + '-mfloat-abi=softfp'] [host_machine] system = 'linux' diff --git a/icons/meson.build b/icons/meson.build index 4462b06..a4a5142 100644 --- a/icons/meson.build +++ b/icons/meson.build @@ -12,3 +12,5 @@ icons = files( 'icon_menu.bmp', 'icon_warning.bmp' ) + +install_data(sources: ['taranis.bmp', 'taranis_f.bmp'], install_dir: '/icons') diff --git a/meson.build b/meson.build index 57dc14e..e010367 100644 --- a/meson.build +++ b/meson.build @@ -56,5 +56,7 @@ sources += [icons_cc] executable( 'taranis.app', sources, - dependencies: taranis_deps + dependencies: taranis_deps, + install: true, + install_dir: '/', )