From 3d8073f63ba51b1993bcfd0c4831d6dcb7651c8f Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Thu, 29 Feb 2024 21:15:21 -0600 Subject: [PATCH] lint and add clean script --- build.sh | 18 +++--------------- clean.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 15 deletions(-) create mode 100755 clean.sh diff --git a/build.sh b/build.sh index 8ba1c19ec..12d92dca7 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -35,13 +35,6 @@ printf "${YEL}Running \`make clean\` and \`make distclean\`...\n" && printf "${CYA}\n" && # Clean artifacts -export NINJA_SUMMARIZE_BUILD=1 && - -export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" && -export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" && -export CPPFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" && -export LDFLAGS="-Wl,-O3 -mavx -maes" && - make clean && make distclean && printf "\n" && @@ -59,7 +52,6 @@ printf "${YEL}Building htop (Debug Version)...\n" && printf "${CYA}\n" && # Build debug htop -export NINJA_SUMMARIZE_BUILD=1 && ./autogen.sh && @@ -81,8 +73,7 @@ printf "\n" && printf "${YEL}Building htop (SSE4.1 Version)...\n" && printf "${CYA}\n" && -# Build htop -export NINJA_SUMMARIZE_BUILD=1 && +# Build htop without AVX export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -msse4.1 -flto=auto" && export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -msse4.1 -flto=auto" && @@ -109,7 +100,6 @@ printf "${YEL}Building htop...\n" && printf "${CYA}\n" && # Build htop -export NINJA_SUMMARIZE_BUILD=1 && export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes -flto=auto" && export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes -flto=auto" && @@ -125,6 +115,4 @@ make VERBOSE=1 V=1 && printf "\n" && printf "${GRE}${bold}Build Completed. ${YEL}${bold}You can now run \`sudo make install\` or \`make install\` to install it.\n" && printf "\n" && -tput sgr0 && - -exit 0 +tput sgr0 diff --git a/clean.sh b/clean.sh new file mode 100755 index 000000000..2d6f72ba8 --- /dev/null +++ b/clean.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Copyright (c) 2024 Alex313031. + +YEL='\033[1;33m' # Yellow +CYA='\033[1;96m' # Cyan +RED='\033[1;31m' # Red +GRE='\033[1;32m' # Green +c0='\033[0m' # Reset Text +bold='\033[1m' # Bold Text +underline='\033[4m' # Underline Text + +# Error handling +yell() { echo "$0: $*" >&2; } +die() { yell "$*"; exit 111; } +try() { "$@" || die "${RED}Failed $*"; } + +# --help +displayHelp () { + printf "\n" && + printf "${bold}${GRE}Script to clean htop build artifacts.${c0}\n" && + printf "${bold}${YEL}Use the --help flag to show this help.${c0}\n" && + printf "\n" +} +case $1 in + --help) displayHelp; exit 0;; +esac + +printf "\n" && +printf "${YEL}Running \`make clean\` and \`make distclean\`...\n" && +printf "${CYA}\n" && + +# Clean artifacts +make clean && make distclean && + +printf "\n" && +printf "${GRE}${bold}Done.\n" && +printf "\n" && +tput sgr0