Import FBE build scripts.

This commit is contained in:
2020-08-01 23:01:33 +02:00
commit 251f48ec88
5 changed files with 2806 additions and 0 deletions

38
scripts/fbe.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Check if script launched as root
if [ "$(whoami)" = "root" ]; then
echo "This script cannot be run as root!"
exit 1
fi
# Get the absolute path to the FBE
export FBEDIR="$(realpath $(dirname ${0}))"
# Read the FBE version
export FBEVER="$(cat ${FBEDIR}/Version)"
# Load the library
source ${FBEDIR}/fbelib.sh
# Set the target architecture
: ${TARGET:=${1}}
: ${TARGET:=i386}
# Save the source directory
export SRCDIR="${2:-${PWD}}"
# Make sure the compiler flags are clean
export HOST=
export CFLAGS=
export CXXFLAGS=
export LDFLAGS=
# Update PATH
export PATH="${FBEDIR}/bin:${PATH}"
# Display banner
version
# Invoke shell
bash --rcfile <(echo 'cd ${SRCDIR}')

40
scripts/fbelib.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Sets the target architecture
charch()
{
if [ "x${1}" == "x" ]; then
echo "Syntax: charch [architecture]"
return
fi
case ${1} in
"i386"|"i486"|"i586"|"i686"|"x86")
export TARGET="i386"
;;
"amd64"|"x64"|"x86_64")
export TARGET="amd64"
;;
*)
export TARGET="UNKNOWN"
esac
echo "Target Architecture: ${TARGET}"
}
export -f charch
# Displays version banner
version()
{
echo "###############################################################################"
echo "# FerretOS Build Environment v${FBEVER} for Linux #"
echo "# by Rafal Kupiec <belliash@codingworkshop.eu.org> #"
echo "###############################################################################"
echo
echo
echo "Binutils Version: $(${FBEDIR}/bin/i686-w64-mingw32-ld -v | cut -d' ' -f5)"
echo "GCC Version: $(${FBEDIR}/bin/i686-w64-mingw32-gcc -v 2>&1| grep 'gcc version' | cut -d' ' -f3)"
echo "IDL Compiler Version: $(${FBEDIR}/bin/i686-w64-mingw32-widl -V | grep 'version' | cut -d' ' -f5)"
charch ${TARGET}
echo
echo
}
export -f version