Linux cross-build script: Added support for some more target architectures + added GNU/Hurd and NetBSD build scripts.

This commit is contained in:
LoRd_MuldeR 2024-06-05 00:23:48 +02:00
parent 1291cf3d75
commit 3d18592b4c
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
31 changed files with 228 additions and 53 deletions

View File

@ -4,4 +4,4 @@ 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 -i '\(gcc\|clang\)[[:space:]]\{1,\}version' | head -n 1`"
echo "Compiler : `$CC -v 2>&1 | egrep -i '(gcc|clang)[[:space:]]+version' 2>/dev/null | head -n 1`"

View File

@ -3,7 +3,7 @@ set -e
cd -- "$(dirname -- "${0}")/../../.."
if [ -z "${cc_path}" ]; then
cc_path="/usr/local/bin/gcc12"
cc_path="/usr/local/bin/gcc13"
fi
mk_slunk() {
@ -11,6 +11,11 @@ mk_slunk() {
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${2}"
}
if [ "$(uname -s)" != "FreeBSD" ]; then
echo "This script is supposed to run on the FreeBSD platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
gmake CC="${cc_path}" clean
@ -18,4 +23,6 @@ gmake CC="${cc_path}" clean
mk_slunk 32 "i686" "pentiumpro" "pentium3"
mk_slunk 64 "x86_64" "x86-64" "nocona"
./etc/build/build_info.sh "${cc_path}" > "out/.build_info"
echo "Build completed successfully."

24
etc/build/gnuhurd/mk-release.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
function mk_slunk() {
local command="make -B CC=${2}-gcc STRIP=1 FLTO=1 THREAD=0"
$BASH -x -c "${command}${3:+ ${3}}"
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
}
if [ "$OSTYPE" != "gnu" ]; then
echo "This script is supposed to run on the gnu/hurd platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
$BASH -x -c "make clean"
mk_slunk "i686" "i686-gnu" "MARCH=pentiumpro MTUNE=pentium3"
./etc/build/build_info.sh "gcc" > "out/.build_info"
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

View File

@ -7,6 +7,11 @@ mk_slunk() {
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${2}"
}
if [ "$(uname -s)" != "Haiku" ]; then
echo "This script is supposed to run on the SunOS (Solaris) platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
make clean
@ -14,9 +19,11 @@ make clean
case "${BE_HOST_CPU}" in
x86_64)
mk_slunk "gcc" "x86_64" "x86-64" "nocona"
./etc/build/build_info.sh "gcc" > "out/.build_info"
;;
x86)
mk_slunk "gcc-x86" "i686" "pentiumpro" "pentium3"
./etc/build/build_info.sh "gcc-x86" > "out/.build_info"
;;
*)
echo "Unknown host CPU type !!!"

View File

@ -1,9 +1,13 @@
#!/bin/bash
# sudo apt install crossbuild-essential-{i386,armel,armhf,arm64,mipsel,mips64el}
# Prerequisites: sudo apt install crossbuild-essential-*
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
function mk_musl() {
if [[ -n "${2}" && -z "$(which "${2}-gcc")" ]]; then
echo "Warning: Cross-compiler for target \"${2}\" not found -> skipping!"
return
fi
local outdir="/usr/local/musl/${1}"
local build="musl-build-${1}"
rm -rf "${build}" && mkdir -p "${build}"
@ -19,6 +23,7 @@ function mk_musl() {
sudo rm -rf "${outdir}"
sudo make install
popd
rm -rf "${build}"
}
if [ "$(gcc -dumpmachine)" != "x86_64-linux-gnu" ]; then
@ -28,10 +33,21 @@ fi
curl -vkf -o "musl-latest.tar.gz" "https://musl.libc.org/releases/musl-latest.tar.gz"
mk_musl x86_64
mk_musl i686 i686-linux-gnu
mk_musl armel arm-linux-gnueabi
mk_musl armhf arm-linux-gnueabihf
mk_musl arm64 aarch64-linux-gnu
mk_musl mipsel mipsel-linux-gnu
mk_musl mips64el mips64el-linux-gnuabi64
mk_musl arm64 aarch64-linux-gnu
mk_musl armel arm-linux-gnueabi
mk_musl armhf arm-linux-gnueabihf
mk_musl i686 i686-linux-gnu
mk_musl mips64el mips64el-linux-gnuabi64
mk_musl mips64 mips64-linux-gnuabi64
mk_musl mips64r6el mipsisa64r6el-linux-gnuabi64
mk_musl mips64r6 mipsisa64r6-linux-gnuabi64
mk_musl mipsel mipsel-linux-gnu
mk_musl mips mips-linux-gnu
mk_musl mipsr6el mipsisa32r6el-linux-gnu
mk_musl mipsr6 mipsisa32r6-linux-gnu
mk_musl riscv64 riscv64-linux-gnu
mk_musl s390x s390x-linux-gnu
mk_musl x86_64 x86_64-linux-gnu
#mk_musl ppc64le powerpc64le-linux-gnu
#mk_musl powerpc powerpc-linux-gnu

View File

@ -0,0 +1,45 @@
#!/bin/bash
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
function mk_slunk() {
if [[ -n "${2}" && -z "$(which "${2}-gcc")" ]]; then
echo "Warning: Cross-compiler for target \"${2}\" not found -> skipping!"
return
fi
local command="make -B CC=${2}-gcc STRIP=1 FLTO=1"
$BASH -x -c "${command}${3:+ ${3}}"
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
}
if [[ "$OSTYPE" != "linux"* ]]; then
echo "This script is supposed to run on the linux platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
$BASH -x -c "make clean"
mk_slunk "x86_64" "x86_64-linux-gnu" "MARCH=x86-64 MTUNE=nocona"
mk_slunk "i686" "i686-linux-gnu" "MARCH=pentiumpro MTUNE=pentium3"
mk_slunk "arm64" "aarch64-linux-gnu"
mk_slunk "armel" "arm-linux-gnueabi"
mk_slunk "armhf" "arm-linux-gnueabihf"
mk_slunk "mips" "mips-linux-gnu"
mk_slunk "mips64" "mips64-linux-gnuabi64"
mk_slunk "mips64el" "mips64el-linux-gnuabi64"
mk_slunk "mips64r6" "mipsisa64r6-linux-gnuabi64"
mk_slunk "mips64r6el" "mipsisa64r6el-linux-gnuabi64"
mk_slunk "mipsel" "mipsel-linux-gnu"
mk_slunk "mipsr6" "mipsisa32r6-linux-gnu"
mk_slunk "mipsr6el" "mipsisa32r6el-linux-gnu"
mk_slunk "powerpc" "powerpc-linux-gnu"
mk_slunk "ppc64le" "powerpc64le-linux-gnu"
mk_slunk "riscv64" "riscv64-linux-gnu"
mk_slunk "s390x" "s390x-linux-gnu"
./etc/build/build_info.sh "x86_64-linux-gnu-gcc" > "out/.build_info"
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

View File

@ -1,9 +1,13 @@
#!/bin/bash
# See "etc/utils/linux/mk-musl.sh" in order to build musl libc!
# See "etc/build/linux/mk-musl.sh" in order to build musl libc!
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
function mk_slunk() {
if [ ! -e "/usr/local/musl/${1}/bin/musl-gcc" ]; then
echo "Warning: Musl libc compiler for target \"${1}\" not found -> skipping!"
return
fi
local command="make -B CC=/usr/local/musl/${1}/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1"
$BASH -x -c "${command}${2:+ ${2}}"
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
@ -20,10 +24,21 @@ $BASH -x -c "make clean"
mk_slunk "x86_64" "MARCH=x86-64 MTUNE=nocona"
mk_slunk "i686" "MARCH=pentiumpro MTUNE=pentium3"
mk_slunk "arm64"
mk_slunk "armel"
mk_slunk "armhf"
mk_slunk "arm64"
mk_slunk "mipsel"
mk_slunk "mips"
mk_slunk "mips64"
mk_slunk "mips64el"
mk_slunk "mips64r6"
mk_slunk "mips64r6el"
mk_slunk "mipsel"
mk_slunk "mipsr6"
mk_slunk "mipsr6el"
mk_slunk "riscv64"
mk_slunk "s390x"
./etc/build/build_info.sh "/usr/local/musl/x86_64/bin/musl-gcc" > "out/.build_info"
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

View File

@ -0,0 +1,2 @@
hdiutil create archive.dmg -ov -volname "SlunkCrypt" -fs HFS+ -srcfolder out
hdiutil convert archive.dmg -format UDZO -imagekey zlib-level=9 -o archive.compressed.dmg

View File

@ -18,4 +18,6 @@ make CC="${cc_path}" clean
mk_slunk "x86_64"
mk_slunk "arm64"
./etc/build/build_info.sh "${cc_path}" > "out/.build_info"
echo "Build completed successfully."

37
etc/build/netbsd/mk-release.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/ksh
set -e
cd -- "$(dirname -- "${0}")/../../.."
if [ -z "${cc_path}" ]; then
cc_path="/usr/pkg/gcc13/bin/gcc"
fi
mk_slunk() {
gmake -B CC="${cc_path}" MARCH=${2} MTUNE=${3} STATIC=1 STRIP=1
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
}
if [ "$(uname -s)" != "NetBSD" ]; then
echo "This script is supposed to run on the NetBSD platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
gmake CC="${cc_path}" clean
case "$(uname -m)" in
amd64)
mk_slunk "x86_64" "x86-64" "nocona"
;;
i386)
mk_slunk "i686" "pentiumpro" "pentium3"
;;
*)
echo "Unknown host CPU type !!!"
exit 1
esac
./etc/build/build_info.sh "${cc_path}" > "out/.build_info"
echo "Build completed successfully."

View File

@ -7,10 +7,15 @@ if [ -z "${cc_path}" ]; then
fi
mk_slunk() {
gmake -B CC="${cc_path}" MARCH=${2} MTUNE=${3} STATIC=1 STRIP=1
gmake -B CC="${cc_path}" MARCH=${2} MTUNE=${3} STATIC=1 STRIP=1 FLTO=1
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
}
if [ "$(uname -s)" != "OpenBSD" ]; then
echo "This script is supposed to run on the OpenBSD platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
gmake CC="${cc_path}" clean
@ -27,4 +32,6 @@ case "$(uname -m)" in
exit 1
esac
./etc/build/build_info.sh "${cc_path}" > "out/.build_info"
echo "Build completed successfully."

View File

@ -3,7 +3,7 @@ set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
if [ -z "${cc_path}" ]; then
cc_path="/usr/gcc/11/bin/gcc"
cc_path="/usr/gcc/13/bin/gcc"
fi
mk_slunk() {
@ -11,6 +11,11 @@ mk_slunk() {
cp -f "frontend/bin/slunkcrypt" "out/slunkcrypt-${2}"
}
if [ "$(uname -s)" != "SunOS" ]; then
echo "This script is supposed to run on the SunOS (Solaris) platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
gmake CC="${cc_path}" clean
@ -18,4 +23,6 @@ gmake CC="${cc_path}" clean
mk_slunk 32 "i686" "pentiumpro" "pentium3"
mk_slunk 64 "x86_64" "x86-64" "nocona"
./etc/build/build_info.sh "${cc_path}" > "out/.build_info"
echo "Build completed successfully."

View File

@ -3,7 +3,7 @@ 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"
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw32 -no-start -defterm -where "%CD%" -c "./etc/build/win32/%~n0.sh"
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw64 -no-start -defterm -where "%CD%" -c "./etc/build/win32/%~n0.sh"
pause

View File

@ -6,6 +6,13 @@ if [ -z "${cc_path}" ]; then
cc_path="cc"
fi
readonly system_name="$(uname -s)"
if [[ "${system_name}" != "MINGW"* ]] && [[ "${system_name}" != "CYGWIN"* ]]; then
echo "This script is supposed to run on the Win32 platform !!!"
exit 1
fi
readonly machine="$("${cc_path}" -dumpmachine)"
if [[ "${machine}" == *"-cygwin" ]]; then
@ -39,4 +46,6 @@ if [[ "${machine}" == *"-cygwin" ]]; then
cp -vfu "$(which cygwin1.dll)" "out/_next_"
fi
./etc/build/build_info.sh "${cc_path}" > "out/_next_/.build_info"
echo "Build completed successfully."

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -2,11 +2,11 @@
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
if [ ! -x "bin/slunkcrypt-a" ]; then
echo "Executbale file \"bin/slunkcrypt-a\" not found !!!"
echo "Executable file \"bin/slunkcrypt-a\" not found !!!"
exit 1
fi
if [ ! -x "bin/slunkcrypt-b" ]; then
echo "Executbale file \"bin/slunkcrypt-b\" not found !!!"
echo "Executable file \"bin/slunkcrypt-b\" not found !!!"
exit 1
fi

View File

@ -1,28 +0,0 @@
#!/bin/bash
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.."
function mk_slunk() {
local command="make -B CC=${2}-gcc STRIP=1 FLTO=1"
$BASH -x -c "${command}${3:+ ${3}}"
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
}
if [[ "$OSTYPE" != "linux"* ]]; then
echo "This script is supposed to run on the linux platform !!!"
exit 1
fi
rm -rf "out" && mkdir -p "out"
$BASH -x -c "make clean"
mk_slunk "x86_64" "x86_64-linux-gnu" "MARCH=x86-64 MTUNE=nocona"
mk_slunk "i686" "i686-linux-gnu" "MARCH=pentiumpro MTUNE=pentium3"
mk_slunk "armel" "arm-linux-gnueabi"
mk_slunk "armhf" "arm-linux-gnueabihf"
mk_slunk "arm64" "aarch64-linux-gnu"
mk_slunk "mipsel" "mipsel-linux-gnu"
mk_slunk "mips64el" "mips64el-linux-gnuabi64"
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

View File

@ -1 +0,0 @@
sudo hdiutil create archive.dmg -ov -volname "SlunkCrypt" -fs HFS+ -srcfolder out

View File

@ -309,6 +309,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -419,6 +420,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -438,6 +440,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

View File

@ -81,14 +81,34 @@
# define CPU_ARCH "armel"
#elif defined(__arm__) || defined(_M_ARM)
# define CPU_ARCH "arm"
#elif defined(__mips__) && defined(__mips64) && (__mips_isa_rev == 6) && defined(_MIPSEL)
# define CPU_ARCH "mips64r6el"
#elif defined(__mips__) && defined(__mips64) && (__mips_isa_rev == 6)
# define CPU_ARCH "mips64r6"
#elif defined(__mips__) && defined(__mips64) && defined(_MIPSEL)
# define CPU_ARCH "mips64el"
#elif defined(__mips__) && defined(__mips64)
# define CPU_ARCH "mips64"
#elif (defined(__mips__) || defined(__mips)) && (__mips_isa_rev == 6) && defined(_MIPSEL)
# define CPU_ARCH "mipsr6el"
#elif (defined(__mips__) || defined(__mips)) && (__mips_isa_rev == 6)
# define CPU_ARCH "mipsr6"
#elif (defined(__mips__) || defined(__mips)) && defined(_MIPSEL)
# define CPU_ARCH "mipsel"
#elif defined(__mips__) || defined(__mips)
#elif (defined(__mips__) || defined(__mips))
# define CPU_ARCH "mips"
#elif defined(__riscv) && (__riscv_xlen == 64)
# define CPU_ARCH "riscv64"
#elif defined(__riscv) && (__riscv_xlen == 32)
# define CPU_ARCH "riscv32"
#elif (defined(__powerpc64__) || defined(_ARCH_PPC64)) && defined(__LITTLE_ENDIAN__)
# define CPU_ARCH "ppc64le"
#elif (defined(__powerpc64__) || defined(_ARCH_PPC64))
# define CPU_ARCH "ppc64"
#elif defined(__powerpc__) || defined(_ARCH_PPC) || defined(__powerpc)
# define CPU_ARCH "powerpc"
#elif defined(__s390__) && defined(__s390x__)
# define CPU_ARCH "s390x"
#else
# error Unknown CPU architecture!
#endif

View File

@ -296,6 +296,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>
@ -414,6 +415,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>
@ -432,6 +434,7 @@
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>

View File

@ -105,7 +105,7 @@ static INLINE uint64_t keygen_loop(uint64_t seed, const uint64_t i, const uint8_
void slunkcrypt_keygen(keydata_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len, const size_t rounds)
{
key->a = keygen_loop(salt, 0x162603FA1CDA99D3 + (uint64_t)pepper, passwd, passwd_len, rounds);
key->b = keygen_loop(salt, 0xBFDEC4A6C1A46E09 + (uint64_t)pepper, passwd, passwd_len, rounds);
key->c = keygen_loop(salt, 0x6BA17D11624973EE + (uint64_t)pepper, passwd, passwd_len, rounds);
key->a = keygen_loop(salt, UINT64_C(0x162603FA1CDA99D3) + pepper, passwd, passwd_len, rounds);
key->b = keygen_loop(salt, UINT64_C(0xBFDEC4A6C1A46E09) + pepper, passwd, passwd_len, rounds);
key->c = keygen_loop(salt, UINT64_C(0x6BA17D11624973EE) + pepper, passwd, passwd_len, rounds);
}

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
set ECHO="%~dp0.\etc\utils\win32\cecho.exe"
set ECHO="%~dp0.\etc\build\win32\cecho.exe"
if "%MSVC_PATH%"=="" (
set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"
)