2024-12-20 18:15:57 +04:00
|
|
|
#!/bin/echo Must be sourced from a bash script **
|
|
|
|
|
|
|
|
# strict mode
|
|
|
|
export IFS=$'\n'
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# git clone wrapper
|
|
|
|
clone () {
|
|
|
|
if ! [ -e "$2" ]; then
|
|
|
|
git clone \
|
|
|
|
--single-branch --depth 1 \
|
|
|
|
--recurse-submodules \
|
|
|
|
"$1" \
|
|
|
|
"$2"
|
|
|
|
else
|
|
|
|
echo " ** '$2/' already exists"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-12-20 19:25:20 +04:00
|
|
|
# optimizations
|
|
|
|
set_cflags () {
|
|
|
|
export \
|
|
|
|
CFLAGS="-O3" CPPFLAGS="-O3" LDFLAGS="-Wl,-O3 -Wl,-S" \
|
|
|
|
RUSTFLAGS="-C target-cpu=native"
|
|
|
|
}
|
|
|
|
|
2024-12-20 18:15:57 +04:00
|
|
|
# make -j12
|
|
|
|
make_maxthreads() {
|
|
|
|
[ -v JOBS ] || JOBS=$(nproc || echo 4)
|
|
|
|
JOBS="${JOBS//[^0-9]/}"
|
|
|
|
make -j"$JOBS"
|
|
|
|
}
|