Simplify release script for Linux + drop the separate PGO scripts.
This commit is contained in:
parent
45829c4317
commit
eb7b5e0db1
@ -1,56 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
|
|
||||||
set ECHO="%~dp0.\etc\utils\win32\cecho.exe"
|
|
||||||
if "%MSVC_PATH%"=="" (
|
|
||||||
set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"
|
|
||||||
)
|
|
||||||
|
|
||||||
if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" (
|
|
||||||
%ECHO% red "\nMSVC not found. Please check MSVC_PATH and try again^!\n"
|
|
||||||
pause
|
|
||||||
goto:eof
|
|
||||||
)
|
|
||||||
|
|
||||||
for %%p in (x86,x64) do (
|
|
||||||
call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%p
|
|
||||||
for %%c in (Release,Release_SSE2) do (
|
|
||||||
if not "%%p::%%c" == "x64::Release_SSE2" (
|
|
||||||
set "TEMP_NAME=!RANDOM!-!RANDOM!"
|
|
||||||
if "%%c"=="Release_SSE2" (set "SUFFIX=sse2") else (if "%%p"=="x86" (set "SUFFIX=i686") else (set "SUFFIX=%%p"))
|
|
||||||
%ECHO% white "\n------------------------------------------------------------------------------"
|
|
||||||
%ECHO% white "Clean [%%p:%%c]"
|
|
||||||
%ECHO% white "------------------------------------------------------------------------------\n"
|
|
||||||
MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /target:Clean /verbosity:normal "%~dp0\Slunk.sln"
|
|
||||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
|
||||||
%ECHO% white "\n------------------------------------------------------------------------------"
|
|
||||||
%ECHO% white "Instrument [%%p:%%c]"
|
|
||||||
%ECHO% white "------------------------------------------------------------------------------\n"
|
|
||||||
MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /property:WholeProgramOptimization=PGInstrument /property:LinkTimeCodeGeneration=PGInstrument /target:Rebuild /verbosity:normal "%~dp0\Slunk.sln"
|
|
||||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
|
||||||
%ECHO% white "\n------------------------------------------------------------------------------"
|
|
||||||
%ECHO% white "Profiling [%%p:%%c]"
|
|
||||||
%ECHO% white "------------------------------------------------------------------------------\n"
|
|
||||||
"%~dp0.\etc\utils\win32\rand.exe" | "%~dp0.\etc\utils\win32\head.exe" -c 104857600 > "%TMP%\!TEMP_NAME!.dat"
|
|
||||||
if not "%ERRORLEVEL%"=="0" goto:BuildFailed
|
|
||||||
"%~dp0.\bin\static\slunkcrypt-cli-!SUFFIX!.exe" --encrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc"
|
|
||||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
|
||||||
"%~dp0.\bin\static\slunkcrypt-cli-!SUFFIX!.exe" --decrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
|
|
||||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
|
||||||
del /F "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
|
|
||||||
%ECHO% white "\n------------------------------------------------------------------------------"
|
|
||||||
%ECHO% white "Re-compile [%%p:%%c]"
|
|
||||||
%ECHO% white "------------------------------------------------------------------------------\n"
|
|
||||||
MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /property:WholeProgramOptimization=PGOptimize /property:LinkTimeCodeGeneration=PGOptimization /target:Build /verbosity:normal "%~dp0\Slunk.sln"
|
|
||||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
%ECHO% green "\nBuild completed successfully.\n"
|
|
||||||
pause
|
|
||||||
goto:eof
|
|
||||||
|
|
||||||
:BuildFailed
|
|
||||||
%ECHO% red "\nBuild has failed ^!^!^!\n"
|
|
||||||
pause
|
|
@ -1,48 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
||||||
|
|
||||||
readonly USE_LTO=1
|
|
||||||
|
|
||||||
PLATFORM="$(uname -a)"
|
|
||||||
unset SUFFIX
|
|
||||||
if [[ "${PLATFORM}" == MINGW* || "${PLATFORM}" == CYGWIN* ]]; then
|
|
||||||
SUFFIX=".exe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -e /dev/urandom ] && RANDOM_SOURCE="/dev/urandom" || RANDOM_SOURCE="/dev/random"
|
|
||||||
TMP_NAME="$(tr -dc 'a-zA-Z0-9' < ${RANDOM_SOURCE} | fold -w 12 | head -n 1)"
|
|
||||||
PGO_PATH="$(tr -dc 'a-zA-Z0-9' < ${RANDOM_SOURCE} | fold -w 12 | head -n 1)"
|
|
||||||
trap "printf \"\033[1;31m\nBuild has failed !!!\033[0m\n\n\"" ERR
|
|
||||||
trap "rm -rf /tmp/${TMP_NAME}.dat /tmp/${TMP_NAME}.enc /tmp/${TMP_NAME}.out /tmp/${PGO_PATH}" EXIT
|
|
||||||
|
|
||||||
printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n"
|
|
||||||
printf "\033[1;36mClean\n"
|
|
||||||
printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n"
|
|
||||||
|
|
||||||
make clean
|
|
||||||
|
|
||||||
printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n"
|
|
||||||
printf "\033[1;36mInstrument\n"
|
|
||||||
printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n"
|
|
||||||
|
|
||||||
make FLTO=${USE_LTO} FPGO="generate=/tmp/${PGO_PATH}" -B "$@"
|
|
||||||
|
|
||||||
printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n"
|
|
||||||
printf "\033[1;36mProfiling\n"
|
|
||||||
printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n"
|
|
||||||
|
|
||||||
dd bs=1024 count=102400 < ${RANDOM_SOURCE} > /tmp/${TMP_NAME}.dat
|
|
||||||
printf "\n"
|
|
||||||
PASSWRD="$(./frontend/bin/slunkcrypt${SUFFIX} --make-pw)"
|
|
||||||
|
|
||||||
./frontend/bin/slunkcrypt${SUFFIX} --encrypt pass:"${PASSWRD}" /tmp/${TMP_NAME}.dat /tmp/${TMP_NAME}.enc
|
|
||||||
./frontend/bin/slunkcrypt${SUFFIX} --decrypt pass:"${PASSWRD}" /tmp/${TMP_NAME}.enc /tmp/${TMP_NAME}.out
|
|
||||||
|
|
||||||
printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n"
|
|
||||||
printf "\033[1;36mRe-compile\n"
|
|
||||||
printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n"
|
|
||||||
|
|
||||||
make FLTO=${USE_LTO} FPGO="use=/tmp/${PGO_PATH}" STRIP=1 -B "$@"
|
|
||||||
|
|
||||||
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"
|
|
@ -2,48 +2,22 @@
|
|||||||
set -e
|
set -e
|
||||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
readonly USE_STATIC=1
|
|
||||||
readonly USE_STRIP=1
|
|
||||||
readonly USE_MTUNE=corei7
|
|
||||||
|
|
||||||
ARGUMENTS="$@"
|
|
||||||
if [[ -z "${ARGUMENTS}" ]]; then
|
|
||||||
ARGUMENTS="32 64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PLATFORM="$(uname -s)"
|
|
||||||
unset SUFFIX
|
|
||||||
if [[ "${PLATFORM}" == MINGW* || "${PLATFORM}" == CYGWIN* ]]; then
|
|
||||||
SUFFIX=".exe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
MAKE=make
|
|
||||||
if [[ "${PLATFORM}" == *BSD || "${PLATFORM}" == DragonFly || "${PLATFORM}" == SunOS ]]; then
|
|
||||||
MAKE=g${MAKE}
|
|
||||||
fi
|
|
||||||
|
|
||||||
function mk_slunk() {
|
|
||||||
printf "\033[1;36m\n[ Build ${2} ]\033[0m\n\n"
|
|
||||||
${MAKE} -B CPU=${1} MARCH=${3} MTUNE=${USE_MTUNE} STATIC=${USE_STATIC} STRIP=${USE_STRIP}
|
|
||||||
cp -f "frontend/bin/slunkcrypt${SUFFIX}" "out/slunkcrypt-${2}${SUFFIX}"
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdir -p "out"
|
mkdir -p "out"
|
||||||
rm -f "out/slunkcrypt-*"
|
$BASH -x -c "make clean"
|
||||||
${MAKE} clean
|
|
||||||
|
|
||||||
for cpu in ${ARGUMENTS}; do
|
case "$(getconf LONG_BIT)" in
|
||||||
case "${cpu}" in
|
"64")
|
||||||
32)
|
$BASH -x -c "make -B CC=musl-gcc CPU=64 FLTO=1 STATIC=1 STRIP=1 MARCH=x86-64 MTUNE=nocona"
|
||||||
mk_slunk "${cpu}" x86 pentium2
|
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-x64"
|
||||||
;;
|
;;
|
||||||
64)
|
"32")
|
||||||
mk_slunk "${cpu}" x64 x86-64
|
$BASH -x -c "make -B CC=musl-gcc CPU=32 FLTO=1 STATIC=1 STRIP=1 MARCH=pentiumpro MTUNE=generic"
|
||||||
;;
|
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-i686"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "Skipping unknown argument: \"${cpu}\"\n"
|
echo "Unknown platform!"
|
||||||
;;
|
exit 1
|
||||||
esac
|
;;
|
||||||
done
|
esac
|
||||||
|
|
||||||
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"
|
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user