Added simple build scripts for Linux, FreeBSD, Win32 and MacOS X platforms.

This commit is contained in:
LoRd_MuldeR 2022-09-17 16:29:11 +02:00
parent 31d32b4fce
commit 8dad8628b3
5 changed files with 100 additions and 0 deletions

9
dist/freebsd/mk-release.sh vendored Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# pkg install gmake gcc12
set -e
cd -- "$(dirname -- "$0")/../.."
gmake -B CC=gcc12 XCFLAGS="-m32" MARCH=i586 MTUNE=pentium2 OUTNAME="crc64-i686"
gmake -B CC=gcc12 XCFLAGS="-m64" MARCH=x86-64 MTUNE=znver3 OUTNAME="crc64-x86_64"
echo "Build completed successfully."

36
dist/linux/mk-musl-libc.sh vendored Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# sudo apt install curl crossbuild-essential-{i386,armel,armhf,arm64,mipsel,mips64el}
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
function mk_musl() {
printf "\033[1;36m\nBuilding musl-libc for: ${1}\033[0m\n\n"
local outdir="/usr/local/musl/${1}"
local build="musl-build-${1}"
rm -rf "${build}" && mkdir -p "${build}"
tar -xvf "musl-latest.tar.gz" --strip-components=1 -C "${build}"
pushd "${build}"
local optdirs="$(find './src' -mindepth 1 -maxdepth 1 -type d -printf '%f,' | sed 's/,$//g')"
CFLAGS="${3}" ./configure --enable-optimize="${optdirs}" --disable-shared --prefix="${outdir}" ${2:+--host=$2}
make
sudo rm -rf "${outdir}"
sudo make install
popd
}
if [ "$(gcc -dumpmachine)" != "x86_64-linux-gnu" ]; then
echo "This script is supposed to run on the native \"x86_64-linux-gnu\" platform !!!"
exit 1
fi
curl -vkf -o "musl-latest.tar.gz" "https://musl.libc.org/releases/musl-latest.tar.gz"
mk_musl x86_64 "" "-march=x86-64 -mtune=znver3"
mk_musl i686 i686-linux-gnu "-march=i586 -mtune=pentium2"
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
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

10
dist/linux/mk-release.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.."
find /usr/local/musl -mindepth 2 -type f -executable \( -name 'musl-gcc' -or -name 'musl-clang' \) -printf '%P\0' | \
while IFS= read -r -d '' filename; do
make -B CC="/usr/local/musl/${filename}" OUTNAME="crc64-$(grep -Po '^[^/\\]+' <<< "${filename}")"
done
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"

11
dist/macosx/mk-release.sh vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/zsh
# xcode-select -install
set -e
cd -- "$(dirname -- "$0")/../.."
make -B MARCH= MTUNE= STATIC=0 STRIP=0 XCFLAGS="-target x86_64-apple-darwin" OUTNAME="crc64-x86_64"
make -B MARCH= MTUNE= STATIC=0 STRIP=0 XCFLAGS="-target arm64-apple-darwin" OUTNAME="crc64-arm64"
strip crc64-*
echo "Build completed successfully."

34
dist/win32/mk-release.cmd vendored Normal file
View File

@ -0,0 +1,34 @@
@echo off
setlocal enabledelayedexpansion
cd "%~dp0\..\..\win32"
if "%MSVC_PATH%"=="" (
set "MSVC_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC"
)
if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" (
echo MSVC not found. Please check MSVC_PATH and try again ^^!^^!^^!
pause
goto:eof
)
for %%p in (x86,x64,ARM64) do (
echo ------------------------------------------------------------------------------
echo [%%p]
echo ------------------------------------------------------------------------------
call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%~p
for %%t in (Clean,Rebuild) do (
MSBuild.exe /property:Configuration=Release /property:Platform=%%p /target:%%t /verbosity:normal "%CD%\crc64.sln"
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
)
echo.
)
echo Build completed successfully.
pause
goto:eof
:BuildFailed
echo.
echo Build has failed ^^!^^!^^!
pause