From 509924c84cfcf386f016c0408897a31e7ce8fd79 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Mon, 12 Dec 2022 15:25:25 +0100 Subject: [PATCH] Added build script for Mingw-w64 and Cygwin. --- etc/utils/build_info.sh | 7 ++++++ etc/utils/macosx/hdiutil.txt | 2 +- etc/utils/macosx/mk-release.sh | 2 +- etc/utils/win32/mk-release.cmd | 9 ++++++++ etc/utils/win32/mk-release.sh | 42 ++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100755 etc/utils/build_info.sh create mode 100644 etc/utils/win32/mk-release.cmd create mode 100755 etc/utils/win32/mk-release.sh diff --git a/etc/utils/build_info.sh b/etc/utils/build_info.sh new file mode 100755 index 0000000..c661088 --- /dev/null +++ b/etc/utils/build_info.sh @@ -0,0 +1,7 @@ +#!/bin/sh +if [ -n "$1" ]; then CC="$1"; elif [ -z "$CC" ]; then CC="cc"; fi + +echo "Built : `date -u +"%Y-%m-%d %H:%M:%S"`" +echo "Platform : `uname -s -r -v -m`" +echo "Target : `$CC -dumpmachine`" +echo "Compiler : `$CC -v 2>&1 | grep -iE '\b(gcc|clang)\s+version\b' | head -n 1`" diff --git a/etc/utils/macosx/hdiutil.txt b/etc/utils/macosx/hdiutil.txt index 70d1d31..180d138 100644 --- a/etc/utils/macosx/hdiutil.txt +++ b/etc/utils/macosx/hdiutil.txt @@ -1 +1 @@ -sudo hdiutil create archive.dmg -ov -volname "CRC-64" -fs HFS+ -srcfolder out +sudo hdiutil create archive.dmg -ov -volname "SlunkCrypt" -fs HFS+ -srcfolder out diff --git a/etc/utils/macosx/mk-release.sh b/etc/utils/macosx/mk-release.sh index c5a9be6..c9733bc 100755 --- a/etc/utils/macosx/mk-release.sh +++ b/etc/utils/macosx/mk-release.sh @@ -7,7 +7,7 @@ if [ -z "${cc_path}" ]; then fi mk_slunk() { - make -B CC="${cc_path}" TARGET="${1}-apple-macos" FLTO=1 + make -B CC="${cc_path}" TARGET="${1}-apple-darwin" FLTO=1 strip -o "out/slunkcrypt-${1}" "frontend/bin/slunkcrypt" } diff --git a/etc/utils/win32/mk-release.cmd b/etc/utils/win32/mk-release.cmd new file mode 100644 index 0000000..a05ad49 --- /dev/null +++ b/etc/utils/win32/mk-release.cmd @@ -0,0 +1,9 @@ +@echo off +cd /d "%~dp0..\..\.." + +set "MSYS2_DIR=C:\msys64" + +call "%MSYS2_DIR%\msys2_shell.cmd" -mingw32 -no-start -defterm -where "%CD%" -c "./etc/utils/win32/%~n0.sh" +call "%MSYS2_DIR%\msys2_shell.cmd" -mingw64 -no-start -defterm -where "%CD%" -c "./etc/utils/win32/%~n0.sh" + +pause diff --git a/etc/utils/win32/mk-release.sh b/etc/utils/win32/mk-release.sh new file mode 100755 index 0000000..2c3415b --- /dev/null +++ b/etc/utils/win32/mk-release.sh @@ -0,0 +1,42 @@ +#!/bin/bash +set -e +cd -- "$(dirname -- "${0}")/../../.." + +if [ -z "${cc_path}" ]; then + cc_path="cc" +fi + +readonly machine="$("${cc_path}" -dumpmachine)" + +if [[ "${machine}" == *"-cygwin" ]]; then + readonly use_flto=0 +else + readonly use_flto=1 +fi + +mk_slunk() { + make -B CC="${cc_path}" MARCH=${2} MTUNE=${3} STATIC=1 STRIP=1 FLTO=${use_flto} + cp -vf "frontend/bin/slunkcrypt" "out/_next_/slunkcrypt-${1}" +} + +mkdir -p "out/_next_" + +make -B CC="${cc_path}" clean + +case "${machine}" in + x86_64*) + mk_slunk "x86_64" "x86-64" "nocona" + ;; + i686*) + mk_slunk "i686" "pentiumpro" "pentium3" + ;; + *) + echo "Unknown target CPU type !!!" + exit 1 +esac + +if [[ "${machine}" == *"-cygwin" ]]; then + cp -vfu "$(which cygwin1.dll)" "out/_next_" +fi + +echo "Build completed successfully."