1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00
upx/misc/scripts/upx-clang-format.sh
Markus F.X.J. Oberhumer 5d30472ee2 CI updates
2025-08-04 16:05:44 +02:00

35 lines
1.1 KiB
Bash
Executable File

#! /usr/bin/env bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
# "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." --Rob Pike
#
# NOTE: we are using clang-format-15.0.6 from upx-stubtools
# see https://github.com/upx/upx-stubtools/releases
#
# NOTE: we use .clang-format config from upx.git/.clang-format
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
UPX_CLANG_FORMAT="$HOME/local/bin/bin-upx/clang-format-15.0.6"
fi
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
UPX_CLANG_FORMAT="$HOME/.local/bin/bin-upx/clang-format-15.0.6"
fi
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
UPX_CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-15.0.6"
fi
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
echo "ERROR: $0: cannot find clang-format-15.0.6"
echo "ERROR: $0: please visit https://github.com/upx/upx-stubtools"
exit 1
fi
# limit memory usage to 1 GiB (in case of clang-format problems with invalid files)
ulimit -v 1048576 || true
#echo "$UPX_CLANG_FORMAT"
exec "$UPX_CLANG_FORMAT" -style=file "$@"
exit 99