2022-12-12 15:25:25 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd -- "$(dirname -- "${0}")/../../.."
|
|
|
|
|
|
|
|
if [ -z "${cc_path}" ]; then
|
|
|
|
cc_path="cc"
|
|
|
|
fi
|
|
|
|
|
2024-06-05 00:23:48 +02:00
|
|
|
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
|
|
|
|
|
2022-12-12 15:25:25 +01:00
|
|
|
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
|
|
|
|
|
2024-06-05 00:23:48 +02:00
|
|
|
./etc/build/build_info.sh "${cc_path}" > "out/_next_/.build_info"
|
|
|
|
|
2022-12-12 15:25:25 +01:00
|
|
|
echo "Build completed successfully."
|