forked from xt-sys/xtchain
Import scripts and wrappers.
This commit is contained in:
parent
ff2c349be3
commit
cf334d86dd
42
scripts/clang-target-wrapper
Executable file
42
scripts/clang-target-wrapper
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/clang-target-wrapper
|
||||||
|
# DESCRIPTION: CLANG Wrapper
|
||||||
|
# DEVELOPERS: Martin Storsjo <martin@martin.st>
|
||||||
|
# Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Set basic variables
|
||||||
|
DIR="$(cd $(dirname $0) && pwd)"
|
||||||
|
CLANG="$DIR/clang"
|
||||||
|
BASENAME="$(basename $0)"
|
||||||
|
TARGET="${BASENAME%-*}"
|
||||||
|
EXECUTABLE="${BASENAME##*-}"
|
||||||
|
DEFAULT_TARGET="x86_64-w64-mingw32"
|
||||||
|
ARCH="${TARGET%%-*}"
|
||||||
|
|
||||||
|
# Set proper target
|
||||||
|
if [ "${TARGET}" = "${BASENAME}" ]; then
|
||||||
|
TARGET="${DEFAULT_TARGET}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set lang-specific flags
|
||||||
|
case ${EXECUTABLE} in
|
||||||
|
"clang++"|"g++"|"c++")
|
||||||
|
FLAGS="$FLAGS --driver-mode=g++"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FLAGS=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Set compiler flags
|
||||||
|
FLAGS="${FLAGS} -target ${TARGET}"
|
||||||
|
FLAGS="${FLAGS} -rtlib=compiler-rt"
|
||||||
|
FLAGS="${FLAGS} -stdlib=libc++"
|
||||||
|
FLAGS="${FLAGS} -fuse-ld=lld"
|
||||||
|
FLAGS="${FLAGS} -Qunused-arguments"
|
||||||
|
|
||||||
|
# Launch the compiler
|
||||||
|
$CLANG $FLAGS "$@"
|
42
scripts/dlltool-wrapper
Executable file
42
scripts/dlltool-wrapper
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/dlltool-wrapper
|
||||||
|
# DESCRIPTION: DLLTOOL Wrapper
|
||||||
|
# DEVELOPERS: Martin Storsjo <martin@martin.st>
|
||||||
|
# Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Set basic variables
|
||||||
|
DIR="$(cd $(dirname $0) && pwd)"
|
||||||
|
BASENAME="$(basename $0)"
|
||||||
|
TARGET="${BASENAME%-*}"
|
||||||
|
DEFAULT_TARGET="x86_64-w64-mingw32"
|
||||||
|
|
||||||
|
# Update PATH
|
||||||
|
export PATH="$DIR":"$PATH"
|
||||||
|
|
||||||
|
# Set proper target
|
||||||
|
if [ "${TARGET}" = "${BASENAME}" ]; then
|
||||||
|
TARGET="${DEFAULT_TARGET}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set target machine
|
||||||
|
ARCH="${TARGET%%-*}"
|
||||||
|
case $ARCH in
|
||||||
|
aarch64)
|
||||||
|
M="arm64"
|
||||||
|
;;
|
||||||
|
armv7)
|
||||||
|
M="arm"
|
||||||
|
;;
|
||||||
|
i686)
|
||||||
|
M="i386"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
M="i386:x86-64"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Launch the utility
|
||||||
|
llvm-dlltool -m ${M} "$@"
|
42
scripts/ld-wrapper
Executable file
42
scripts/ld-wrapper
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/ld-wrapper
|
||||||
|
# DESCRIPTION: LLD Wrapper
|
||||||
|
# DEVELOPERS: Martin Storsjo <martin@martin.st>
|
||||||
|
# Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Set basic variables
|
||||||
|
DIR="$(cd $(dirname $0) && pwd)"
|
||||||
|
BASENAME="$(basename $0)"
|
||||||
|
TARGET="${BASENAME%-*}"
|
||||||
|
DEFAULT_TARGET="x86_64-w64-mingw32"
|
||||||
|
|
||||||
|
# Update PATH
|
||||||
|
export PATH="${DIR}":"${PATH}"
|
||||||
|
|
||||||
|
# Set proper target
|
||||||
|
if [ "${TARGET}" = "${BASENAME}" ]; then
|
||||||
|
TARGET="${DEFAULT_TARGET}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set target machine
|
||||||
|
ARCH="${TARGET%%-*}"
|
||||||
|
case ${ARCH} in
|
||||||
|
aarch64)
|
||||||
|
M="arm64pe"
|
||||||
|
;;
|
||||||
|
armv7)
|
||||||
|
M="thumb2pe"
|
||||||
|
;;
|
||||||
|
i686)
|
||||||
|
M="i386pe"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
M="i386pep"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Launch the linker
|
||||||
|
ld.lld -m ${M} "$@"
|
46
scripts/objdump-wrapper
Executable file
46
scripts/objdump-wrapper
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/objdump-wrapper
|
||||||
|
# DESCRIPTION: OBJDUMP Wrapper
|
||||||
|
# DEVELOPERS: Martin Storsjo <martin@martin.st>
|
||||||
|
# Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Set basic variables
|
||||||
|
DIR="$(cd $(dirname $0) && pwd)"
|
||||||
|
|
||||||
|
# Update PATH
|
||||||
|
export PATH="$DIR":"$PATH"
|
||||||
|
|
||||||
|
# Libtool can try to run objdump -f and wants to see certain strings in
|
||||||
|
# the output, to accept it being a valid windows (import) library
|
||||||
|
if [ "$1" = "-f" ]; then
|
||||||
|
llvm-readobj $2 | while read -r line; do
|
||||||
|
case $line in
|
||||||
|
File:*)
|
||||||
|
file=$(echo $line | awk '{print $2}')
|
||||||
|
;;
|
||||||
|
Format:*)
|
||||||
|
format=$(echo $line | awk '{print $2}')
|
||||||
|
case $format in
|
||||||
|
COFF-i386)
|
||||||
|
format=pe-i386
|
||||||
|
;;
|
||||||
|
COFF-x86-64)
|
||||||
|
format=pe-x86-64
|
||||||
|
;;
|
||||||
|
COFF-ARM*)
|
||||||
|
# This is wrong; modern COFF armv7 isn't pe-arm-wince, and
|
||||||
|
# arm64 definitely isn't, but libtool wants to see this
|
||||||
|
# string (or some of the others) in order to accept it.
|
||||||
|
format=pe-arm-wince
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $file: file format $format
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
llvm-objdump "$@"
|
||||||
|
fi
|
50
scripts/xtchain
Executable file
50
scripts/xtchain
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/xtchain
|
||||||
|
# DESCRIPTION: XTchain Entry Script
|
||||||
|
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# 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 XTchain
|
||||||
|
export XTCDIR="$(realpath $(dirname ${0}))"
|
||||||
|
|
||||||
|
# Read the XTchain version
|
||||||
|
export XTCVER="$(cat ${XTCDIR}/Version)"
|
||||||
|
|
||||||
|
# Load the library
|
||||||
|
source ${XTCDIR}/lib/xtchain/xtclib
|
||||||
|
|
||||||
|
# Set the target architecture
|
||||||
|
: ${TARGET:=${1}}
|
||||||
|
: ${TARGET:=amd64}
|
||||||
|
|
||||||
|
# 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="${XTCDIR}/bin:${PATH}"
|
||||||
|
|
||||||
|
# Display banner
|
||||||
|
version
|
||||||
|
|
||||||
|
# Invoke shell with fancy prompt
|
||||||
|
export PFMAT1="\[\033[0;1;97;44m\]"
|
||||||
|
export PFMAT2="\[\033[0;34;104m\]"
|
||||||
|
export PFMAT3="\[\033[0;1;97;104m\]"
|
||||||
|
export PFMAT4="\[\033[0;94;49m\]"
|
||||||
|
export PFMAT5="\[\033[1;38;5;74m\]"
|
||||||
|
export PROMPT="\n${PFMAT1} XT Toolchain ${PFMAT2}${PFMAT3} \w ${PFMAT4}${PFMAT5} "
|
||||||
|
bash --rcfile <(echo 'source ~/.bashrc && export PS1="${PROMPT}" && cd ${SRCDIR}')
|
55
scripts/xtclib
Executable file
55
scripts/xtclib
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/xtclib
|
||||||
|
# DESCRIPTION: XTchain library
|
||||||
|
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Sets the target architecture
|
||||||
|
charch()
|
||||||
|
{
|
||||||
|
if [ "x${1}" == "x" ]; then
|
||||||
|
echo "Syntax: charch [architecture]"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
case ${1} in
|
||||||
|
"aarch64"|"arm64")
|
||||||
|
export TARGET="aarch64"
|
||||||
|
;;
|
||||||
|
"arm"|"armv7")
|
||||||
|
export TARGET="armv7"
|
||||||
|
;;
|
||||||
|
"i386"|"i486"|"i586"|"i686"|"x86")
|
||||||
|
export TARGET="i686"
|
||||||
|
;;
|
||||||
|
"amd64"|"x64"|"x86_64")
|
||||||
|
export TARGET="amd64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export TARGET="UNKNOWN"
|
||||||
|
esac
|
||||||
|
echo "Target Architecture: ${TARGET}"
|
||||||
|
}
|
||||||
|
export -f charch
|
||||||
|
|
||||||
|
# Displays version banner
|
||||||
|
version()
|
||||||
|
{
|
||||||
|
echo "###############################################################################"
|
||||||
|
echo "# XT Toolchain v${XTCVER} for Linux #"
|
||||||
|
echo "# by Rafal Kupiec <belliash@codingworkshop.eu.org> #"
|
||||||
|
echo "###############################################################################"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "LLVM Compiler Version: $(${XTCDIR}/bin/clang --version | grep 'clang version' | cut -d' ' -f3)"
|
||||||
|
echo "LLVM Windres Utility Version: $(${XTCDIR}/generic-w64-mingw32/bin/windres-wrapper -V | cut -d' ' -f7)"
|
||||||
|
echo "Mingw IDL Compiler Version: $(${XTCDIR}/bin/i686-w64-mingw32-widl -V | grep 'version' | cut -d' ' -f5)"
|
||||||
|
echo "Wine Message Compiler Version: $(${XTCDIR}/bin/wmc -V | grep 'version' | cut -d' ' -f5)"
|
||||||
|
echo "Wine Resource Compiler Version: $(${XTCDIR}/bin/wrc --version | grep 'version' | cut -d' ' -f5)"
|
||||||
|
echo
|
||||||
|
charch ${TARGET}
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
export -f version
|
Loading…
Reference in New Issue
Block a user