J-Alves | d8e6144 | 2024-10-23 14:26:15 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # Copyright 2024 The Hafnium Authors. |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style |
| 5 | # license that can be found in the LICENSE file or at |
| 6 | # https://opensource.org/licenses/BSD-3-Clause. |
| 7 | |
| 8 | set -euox pipefail |
| 9 | |
| 10 | source "$(dirname ${BASH_SOURCE[0]})/../build/bash/common.inc" |
| 11 | # Initialize global variables, prepare repo for building. |
| 12 | init_build |
| 13 | |
| 14 | OUT=$ROOT_DIR/out |
| 15 | # Dowloading the script from 6.11.5 stable. |
| 16 | LINK=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/scripts/checkpatch.pl?h=v6.11.5 |
| 17 | |
| 18 | # From a fresh clone out/ folder may not have been created. |
| 19 | mkdir -p $OUT |
| 20 | |
| 21 | # Delete the folder to avoid any conflicts if it exists. |
| 22 | CHECKPATCH_DIR=$OUT/checkpatch |
| 23 | |
| 24 | [ -d $CHECKPATCH_DIR ] && rm -r $CHECKPATCH_DIR |
| 25 | mkdir $CHECKPATCH_DIR |
| 26 | |
| 27 | touch ${CHECKPATCH_DIR}/download_checkpatch.log |
| 28 | wget --tries=3 --output-file=${CHECKPATCH_DIR}/download_checkpatch.log ${LINK} -P $CHECKPATCH_DIR |
| 29 | |
| 30 | # Rename to drop the extra characters at the end of the file name. |
| 31 | mv $CHECKPATCH_DIR/checkpatch* $CHECKPATCH_DIR/checkpatch.pl |
| 32 | chmod +x $CHECKPATCH_DIR/checkpatch.pl |
| 33 | |
| 34 | # File for outputting spelling mistakes and for outputting structs that |
| 35 | # shoud const. This is mostly to mute the warnings. |
| 36 | touch $CHECKPATCH_DIR/spelling.txt |
| 37 | touch $CHECKPATCH_DIR/const_structs.checkpatch |