From 8abd46569a31d48eb3c24080835453f7b867d87a Mon Sep 17 00:00:00 2001 From: project-repo Date: Thu, 13 Apr 2023 21:03:41 +0200 Subject: [PATCH] Add output-hashes script --- README.md | 17 +++++++++++++++ meson.build | 3 +++ scripts/output-hashes | 50 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100755 scripts/output-hashes diff --git a/README.md b/README.md index f299362..63b1468 100644 --- a/README.md +++ b/README.md @@ -327,6 +327,23 @@ Cagebreak with `-Dgpg_id=GPGID`. can be used alternatively. +##### Output Hashes + +Hashes of release versions of all binaries can be output to `local-hashes.txt` +via: + +``` +meson compile output-hashes -C build +``` + +Or + +``` +./scripts/output-hashes VERSION +``` + +if meson is unavailable. + ### GCC and -fanalyzer Cagebreak should compile with any reasonably new gcc or clang. Consider diff --git a/meson.build b/meson.build index 501cc4f..d00d590 100644 --- a/meson.build +++ b/meson.build @@ -356,6 +356,9 @@ run_target('adjust-epoch', run_target('git-tag', command : ['scripts/git-tag', get_option('gpg_id'), meson.project_version()]) +run_target('output-hashes', + command : ['scripts/output-hashes', meson.project_version()]) + # Test Suite test('Build without warnings', find_program('test/build-w-o-warnings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel') diff --git a/scripts/output-hashes b/scripts/output-hashes new file mode 100755 index 0000000..cf7cacf --- /dev/null +++ b/scripts/output-hashes @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2023, project-repo and the cagebreak contributors +# SPDX-License-Identifier: MIT + +if [[ -n ${MESON_SOURCE_ROOT} ]] +then + # shellcheck disable=2164 + cd "${MESON_SOURCE_ROOT}" +fi + +readonly version="${1}" + +rm -rf hashes +meson setup hashes -Dxwayland=true -Dman-pages=true --buildtype=release +ninja -C hashes + +cb256=$(sha256sum hashes/cagebreak | cut -d " " -f1) +cb512=$(sha512sum hashes/cagebreak | cut -d " " -f1) + +cb1man256=$(sha256sum hashes/cagebreak.1 | cut -d " " -f1) +cb1man512=$(sha512sum hashes/cagebreak.1 | cut -d " " -f1) + +cb5man256=$(sha256sum hashes/cagebreak-config.5 | cut -d " " -f1) +cb5man512=$(sha512sum hashes/cagebreak-config.5 | cut -d " " -f1) + +cb7man256=$(sha256sum hashes/cagebreak-socket.7 | cut -d " " -f1) +cb7man512=$(sha512sum hashes/cagebreak-socket.7 | cut -d " " -f1) + +echo "${version} cagebreak + + * sha 256: ${cb256} + * sha 512: ${cb512} + +${version} cagebreak.1 + + * sha 256: ${cb1man256} + * sha 512: ${cb1man512} + +${version} cagebreak-config.5 + + * sha 256: ${cb5man256} + * sha 512: ${cb5man512} + +${version} cagebreak-socket.7 + + * sha 256: ${cb7man256} + * sha 512: ${cb7man512} +" > local-hashes.txt + +rm -rf hashes