From 9f5e1faf6d4fea83fb1ff1c37934037c975418ad Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Thu, 27 May 2021 00:43:07 +0200 Subject: [PATCH] Small improvement to release script. --- mk-release.sh | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/mk-release.sh b/mk-release.sh index 1fddb7a..d2d9d77 100755 --- a/mk-release.sh +++ b/mk-release.sh @@ -6,19 +6,44 @@ readonly USE_STATIC=1 readonly USE_STRIP=1 readonly USE_MTUNE=corei7 -PLATFORM="$(uname -a)" +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" rm -f "out/slunkcrypt-*" +${MAKE} clean -for cpu in 32 64; do - [[ ${cpu} -lt 64 ]] && march=pentium2 || march=x86-64 - make -B CPU=${cpu} MARCH=${march} MTUNE=${USE_MTUNE} STATIC=${USE_STATIC} STRIP=${USE_STRIP} clean all - cp -f "frontend/bin/slunkcrypt${SUFFIX}" "out/slunkcrypt-x${cpu}${SUFFIX}" +for cpu in ${ARGUMENTS}; do + case "${cpu}" in + 32) + mk_slunk "${cpu}" x86 pentium2 + ;; + 64) + mk_slunk "${cpu}" x64 x86-64 + ;; + *) + printf "Skipping unknown argument: \"${cpu}\"\n" + ;; + esac done printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"