From 8e55f4817cf0e4de938ecf9ae5e9ad92278a1ae2 Mon Sep 17 00:00:00 2001 From: Greg Beard Date: Sat, 29 Jul 2023 12:12:27 +0100 Subject: [PATCH] fix(tooling) Ensures static binary is stripped and hashed --- .versioning/changes/wfIMgIBmTW.patch.md | 1 + tools/make-dist | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .versioning/changes/wfIMgIBmTW.patch.md diff --git a/.versioning/changes/wfIMgIBmTW.patch.md b/.versioning/changes/wfIMgIBmTW.patch.md new file mode 100644 index 0000000..230d84c --- /dev/null +++ b/.versioning/changes/wfIMgIBmTW.patch.md @@ -0,0 +1 @@ +Fixes static binary dist util; Strips and SHA256 hashes diff --git a/tools/make-dist b/tools/make-dist index b1de422..f4a9f8a 100755 --- a/tools/make-dist +++ b/tools/make-dist @@ -24,7 +24,15 @@ tar \ cd ./dist sha256sum ${projectname}-source-${version}.tar.xz >${projectname}-source-${version}.sha256 +[[ -d "${topdir}/build" ]] || mkdir "${topdir}/build" + +cmake -S "${topdir}" -B "${topdir}/build" --fresh -DCMAKE_BUILD_TYPE=Release -DSEMVERUTIL_STATIC_BINARY=ON +cmake --build "${topdir}/build" --clean-first + staticbin=$(find "${topdir}" -type f -executable -name ${projectname}-static | head -1) if [[ -n "${staticbin}" ]]; then - cp "${staticbin}" "${topdir}/dist/${projectname}-static-$(uname -s)-$(uname -m)" + outname="${projectname}-static-$(uname -s)-$(uname -m)" + cp "${staticbin}" "${topdir}/dist/${outname}" + strip --strip-unneeded "${topdir}/dist/${outname}" + sha256sum "${outname}" >"${outname}.sha256" fi