sh-elf-vhex - v1.2.0-rc0 : Update vxSDK integration

*update*
<> [patchs/gcc/11.2.0/gcc/config.gcc]
  | force-provide the stdint-gcc.h needed by the fxlibc
<> Makefile
  | prepare circular dependency workaround (WIP)
  | change build design : first build binutils then GCC (stage1,fxlibc,stage2)
  | proper export the first rule (all)
  | proper fix circular dependencies with fxlibc and openlibm
<> [scripts/binutils]
  | [build] add sysroot support
  | [configure] add sysroot support
  | [configure] proper setup archive cache
  | [configure] add cmake as legits dependency (fxlibc)
  | [configure] remove untested android fix
  | [install] support sysroot
<> [scripts/gcc]
  | [build] add sysroot support
  | [configure] add sysroot support
  | [configure] proper setup archive cache
<> [scripts]
  | [install] isolate installation step for binutils and gcc
  | [uninstall] isolate uninstallation step for binutils and gcc
This commit is contained in:
Yann MAGNIN 2023-01-08 16:59:05 +01:00
parent 2d12f3026f
commit 14db2abf33
13 changed files with 297 additions and 457 deletions

View File

@ -1,27 +1,60 @@
#---
# This makefile is particular because it can be involved many time during the
# building process. This is why we using many conditional rule exposition
#
# All possible scenarii are :
# * sh-elf-vhex -> fxlibc -> OpenLibM -> sh-elf-vhex
# * sh-elf-vhex -> fxlibc -> sh-elf-vhex
# * fxlibc -> sh-elf-vhex -> fxlibc -> sh-elf-vhex
# * OpenLibM -> sh-elf-vhex -> fxlibc -> OpenLibM -> sh-elf-vhex
#---
VERSION_BINUTILS := 2.38
VERSION_GCC := 11.3.0
VERSION_BINUTILS := 2.38
VERSION_GCC := 11.3.0
# check that the vxSDK is used
ifeq ($(VXSDK_PREFIX_INSTALL),)
$(error you need to use the vxSDK to compile this package)
endif
configure:
@ cd ./scripts/binutils \
&& ./configure.sh --version="$(VERSION_BINUTILS)" \
&& cd ../gcc && ./configure.sh --version="$(VERSION_GCC)"
# default rules
all: build install
#---
# Performs the real operations
#---
ifeq ($(VXSDK_COMPILER_CIRCULAR_BUILD_WORKAROUND),)
build:
@ cd ./scripts/binutils && ./build.sh && cd ../gcc && ./build.sh
@ cd ./scripts/binutils && ./configure.sh --version="$(VERSION_BINUTILS)"
@ cd ./scripts/binutils && ./build.sh
@ cd ./scripts/gcc && ./configure.sh --version="$(VERSION_GCC)"
@ cd ./scripts/gcc && ./build.sh
install:
@ cd ./scripts/binutils \
&& ./install.sh --prefix="$(VXSDK_PREFIX_INSTALL)" \
&& cd ../gcc && ./install.sh --prefix="$(VXSDK_PREFIX_INSTALL)"
@ cd ./scripts && ./install.sh --prefix="$(VXSDK_PREFIX_INSTALL)"
uninstall:
@ cd ./scripts/binutils \
&& ./uninstall.sh --prefix="$(VXSDK_PREFIX_INSTALL)" \
&& cd ../gcc && ./uninstall.sh --prefix="$(VXSDK_PREFIX_INSTALL)"
@ cd ./scripts && ./uninstall.sh --prefix="$(VXSDK_PREFIX_INSTALL)"
.PHONY: configure build install uninstall
#---
# If a circular build is detected, simulate that all operations have
# successfully been executed
#---
else
build:
@ true
install:
@ true
uninstall:
@ true
endif
.PHONY: all build install uninstall

View File

@ -1,14 +0,0 @@
#! /usr/bin/env bash
# check mandatory args
if [[ $# -eq 0 ]]; then
echo "missing install path prefix !" >&2
exit 1
fi
cd scripts/binutils
./configure.sh --version=2.37 && ./build.sh && ./install.sh --prefix="$1"
cd ../gcc
./configure.sh --version=11.2.0 && ./build.sh && ./install.sh --prefix="$1"

View File

@ -3252,9 +3252,18 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
tm_file="${tm_file} sh/embed-elf.h"
tm_file="${tm_file} sh/superh.h"
extra_options="${extra_options} sh/superh.opt" ;;
# Special vhex target information
sh*-*-vhex*)
# use our superH configuration
tm_file="${tm_file} newlib-stdint.h sh/vhex.h"
use_gcc_stdint=provide ;;
# Do not privide the stdint.h, it will be provided using the fxlibc
use_gcc_stdint=provide
extra_headers="${extra_headers} ../../ginclude/stdint-gcc.h"
# End of the target information
;;
*) if test x$with_newlib = xyes \
&& test x$with_libgloss = xyes; then
tm_file="${tm_file} sh/newlib.h"

View File

@ -2,9 +2,9 @@
verbose=false
#
#---
# Help screen
#
#---
help() {
cat << OEF
Script for the building step of binutils for the Vhex kernel.
@ -20,9 +20,9 @@ OEF
#
#---
# Parse arguments
#
#---
for arg; do case "$arg" in
--help | -h) help;;
@ -34,9 +34,11 @@ esac; done
#
# Building step
#
#---
# Setup check
#---
source ../../scripts/utils.sh
TAG='<sh-elf-vhex-binutils>'
@ -56,21 +58,21 @@ fi
cd ../../build/binutils/build
# Import some helpers
source ../../../scripts/utils.sh
#---
# Build part
#---
echo "$TAG Compiling binutils (usually 5-10 minutes)..."
$quiet $make_cmd -j"$cores"
echo "$TAG Installing to local folder..."
echo "$TAG Installing binutils to sysroot..."
$quiet $make_cmd install-strip
# Indicate that the build is finished
touch ../.fini

View File

@ -1,12 +1,13 @@
#! /usr/bin/env bash
verbose=false
cache=false
cache=true
version='?'
#
#---
# Help screen
#
#---
help() {
cat << OEF
Script for the configuration step of Vhex kernel's binutils.
@ -26,9 +27,9 @@ OEF
#
#---
# Parse arguments
#
#---
[[ $# -eq 0 ]] && help
@ -43,12 +44,9 @@ for arg; do case "$arg" in
esac; done
#
# Check parsing validity
#
#---
# check version
#---
list_version=''
for tmp in $(ls -d ../../patchs/binutils/*); do
@ -67,51 +65,60 @@ if [[ ! $list_version =~ (^|[[:space:]])$version($|[[:space:]]) ]]; then
exit 1
fi
# Import some helpers
source ../../scripts/utils.sh
#
#---
# Configuration part
#
#---
TAG='<sh-elf-vhex-binutils>'
VERSION=$version
URL="https://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.xz"
ARCHIVE="../../cache/$(basename $URL)"
ARCHIVE="/tmp/sh-elf-vhex/$(basename $URL)"
SYSROOT="$(get_sysroot)"
#---
# Avoid rebuilds of the same version
#---
existing_as="../../build/binutils/bin/sh-elf-vhex-as"
existing_as="$SYSROOT/bin/sh-elf-vhex-as"
if [[ -f "$existing_as" ]]; then
existing_version=$($existing_as --version | head -n 1 | grep -Eo '[0-9.]+$')
if [[ $existing_version == $VERSION ]]; then
echo "$TAG Version $VERSION already installed, skipping rebuild"
mkdir -p ../../build/binutils/
touch ../../build/binutils/.fini
exit 0
fi
[[ -d ../../build/binutils/build ]] && rm -rf ../../build/binutils/build
[[ -f ../../build/binutils/.fini ]] && rm -f ../../build/binutils/.fini
fi
#---
# Check dependencies for binutils and GCC
#---
if command -v pkg >/dev/null 2>&1; then
deps="libmpfr libmpc libgmp libpng flex clang git texinfo libisl bison xz-utils"
deps="cmake libmpfr libmpc libgmp libpng flex clang git texinfo libisl bison xz-utils"
pm=pkg
pm_has="dpkg -s"
pm_install="pkg install"
elif command -v apt >/dev/null 2>&1; then
deps="libmpfr-dev libmpc-dev libgmp-dev libpng-dev libppl-dev flex g++ git texinfo xz-utils"
deps="cmake libmpfr-dev libmpc-dev libgmp-dev libpng-dev libppl-dev flex g++ git texinfo xz-utils"
pm=apt
pm_has="dpkg -s"
pm_install="sudo apt install"
elif command -v dnf >/dev/null 2>&1; then
deps="mpfr-devel libmpc-devel gmp-devel libpng-devel ppl-devel flex gcc git texinfo xz"
deps="cmake mpfr-devel libmpc-devel gmp-devel libpng-devel ppl-devel flex gcc git texinfo xz"
pm=dnf
pm_has="echo '$(rpm -qa)' | grep -i "
pm_install="sudo dnf install"
fix='-'
elif command -v pacman >/dev/null 2>&1; then
deps="mpfr libmpc gmp libpng ppl flex gcc git texinfo xz"
deps="cmake mpfr libmpc gmp libpng ppl flex gcc git texinfo xz"
pm=pacman
pm_has="pacman -Qi"
pm_install="sudo pacman -S"
@ -128,7 +135,9 @@ if [[ -z "$trust_deps" ]]; then
done
fi
#---
# Offer to install dependencies
#---
if [[ ! -z "$missing" ]]; then
echo "$TAG Based on $pm, some dependencies are missing: $missing"
@ -142,12 +151,19 @@ if [[ ! -z "$missing" ]]; then
fi
fi
#---
# Download archive
#---
if [[ "$cache" == 'false' ]]; then
if [[ -f "$ARCHIVE" ]]; then
rm -f "$ARCHIVE"
fi
fi
mkdir -p $(dirname "$ARCHIVE")
if [[ -f "$ARCHIVE" ]]; then
echo "$TAG Found $ARCHIVE, skipping download"
else
mkdir -p $(dirname "$ARCHIVE")
echo "$TAG Downloading $URL..."
if command -v curl >/dev/null 2>&1; then
curl $URL -o $ARCHIVE
@ -159,7 +175,9 @@ else
fi
fi
#---
# Extract archive (OpenBDS-compliant version)
#---
echo "$TAG Extracting $ARCHIVE..."
@ -183,44 +201,30 @@ cp -r ../../patchs/binutils/$VERSION/* ./binutils-$VERSION/
# Create build folder
[[ -d "build" ]] && rm -rf build
mkdir build
mkdir build && cd build
# Configure binutils does not support the uninstall target (wow) so we just
# install in this directory and later symlink executables to the "real" prefix.
PREFIX="$(pwd)"
cd build
#---
# Real configuration step
#---
echo "$TAG Configuring binutils..."
if command -v termux-setup-storage >/dev/null 2>&1; then
# Since the __ANDROID_API__ flag is hardcoded as 24 in clang, and <stdio.h>
# doesn't prototype some functions when this flag is too low, fixes it's
# version by checking system's properties so as to prevent from missing
# prototypes of existing functions such as fgets_unlocked (only if API >= 28)
# See the following issues :
# * https://github.com/termux/termux-packages/issues/6176
# * https://github.com/termux/termux-packages/issues/2469
export CFLAGS="-D__ANDROID_API__=$(getprop ro.build.version.sdk) -g -O2" \
CXXFLAGS="-D__ANDROID_API__=$(getprop ro.build.version.sdk) -g -O2"
fi
# Import some helpers
source ../../../scripts/utils.sh
# Real configuration step
$quiet ../binutils-$VERSION/configure --prefix="$PREFIX" --target=sh-elf-vhex \
--with-multilib-list=m3,m4-nofpu --disable-nls --enable-lto
$quiet ../binutils-$VERSION/configure \
--prefix="$SYSROOT" \
--target='sh-elf-vhex' \
--with-multilib-list='m3,m4-nofpu' \
--program-prefix='sh-elf-vhex-' \
--enable-lto \
--disable-nls
#---
# Cache management
#---
if [[ "$cache" == 'false' ]]; then
echo "$TAG Removing $ARCHIVE..."
rm -f $ARCHIVE
echo "$TAG Removing $ARCHIVE..."
rm -f "$ARCHIVE"
fi
exit 0

View File

@ -1,10 +1,10 @@
#! /usr/bin/env bash
verbose=false
verbose=true
#
#---
# Help screen
#
#---
help() {
cat << OEF
Script for the building step of GCC for the Vhex kernel.
@ -20,9 +20,9 @@ OEF
#
#---
# Parse arguments
#
#---
for arg; do case "$arg" in
--help | -h) help;;
@ -33,8 +33,11 @@ for arg; do case "$arg" in
esac; done
# Import some helpers
#
source ../utils.sh
#---
# Building step
# @note:
# We need to build GCC at least two time. This because we want to enable
@ -46,14 +49,10 @@ esac; done
# static version of the libgcc. This will enable us to compile the openlibm,
# then our custom C standard library. After that, we will rebuild GCC with,
# this time, the shared version of the libgcc.
#
#---
TAG='<sh-elf-vhex-gcc>'
# Import some helpers
source ../utils.sh
SYSROOT="$(get_sysroot)"
# Avoid rebuilds and error
@ -62,7 +61,7 @@ if [[ -f ../../build/gcc/.fini ]]; then
exit 0
fi
if [[ ! -d ../../build/gcc/build ]]; then
if [[ ! -d ../../build/gcc ]]; then
echo "error: Are you sure to have built GCC ? it seems that" >&2
echo " the build directory is missing..." >&2
exit 1
@ -70,33 +69,29 @@ fi
cd ../../build/gcc/build
# OpenBSD apparently installs these in /usr/local
extra_args=
if [[ $(uname) == "OpenBSD" ]]; then
extra_args='--with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local'
fi
#
#---
# Build GCC stage-1
#
#---
echo "$TAG Configuring GCC (stage 1)..."
# GCC does not support 'make uninstall' so we install in this directory and
# later symlink executables to the "real" prefix.
PREFIX="$(pwd)/.."
# Configure GCC stage-1 (force disable shared version of the libgcc)
$quiet ../gcc/configure --prefix=$PREFIX --target=sh-elf-vhex \
--with-multilib-list=m3,m4-nofpu --enable-languages=c --without-headers \
--disable-nls --enable-lto --disable-shared $extra_args
$quiet ../gcc/configure \
--prefix="$SYSROOT" \
--target='sh-elf-vhex' \
--with-multilib-list='m3,m4-nofpu' \
--enable-languages='c' \
--without-headers \
--program-prefix="sh-elf-vhex-" \
--enable-lto \
--disable-threads \
--disable-nls \
--enable-shared \
$extra_args
echo "$TAG Compiling GCC (stage 1) (usually 10-20 minutes)..."
@ -106,134 +101,31 @@ echo "$TAG Install GCC (stage 1)..."
$quiet $make_cmd -j"$cores" install-strip-gcc
echo "$TAG Compiling libgcc (stage 1)..."
$quiet $make_cmd -j"$cores" all-target-libgcc
echo "$TAG Install libgcc (stage 1)..."
$quiet $make_cmd -j"$cores" install-strip-target-libgcc
#
#---
# Patch the C standar library
#
#---
# Export binaries used to build OpenLibM and fxLibc
# export binaries used to build OpenLibM and fxLibc
# also export sysroot for the fxlibc build / install steps
cd ..
export PATH="$PATH:$(pwd)/bin"
export PATH="$PATH:$(pwd)/sh-elf-vhex/bin"
cd ..
export PATH="$PATH:$SYSROOT/bin"
export VXSDK_COMPILER_SYSROOT="$SYSROOT/sh-elf-vhex"
export VXSDK_COMPILER_CIRCULAR_BUILD_WORKAROUND="true"
echo "$TAG Building Vhex's custom C standard library..."
# Install OpenLibM
rm -rf OpenLibm
$quiet git clone https://gitea.planet-casio.com/Vhex-Kernel-Core/OpenLibm.git --depth=1
cd OpenLibm
# Get installation path
LIP=$(sh-elf-vhex-gcc --print-search-dirs | grep install | sed 's/install: //')
# Build
$quiet $make_cmd USEGCC=1 FORCE_PIC=1 ARCH=sh3eb TOOLPREFIX=sh-elf-vhex- \
CC=sh-elf-vhex-gcc AR=sh-elf-vhex-ar \
libdir="$LIP" includedir="$LIP/include"
# Install (needed by fxlibc)
$quiet $make_cmd USEGCC=1 FORCE_PIC=1 ARCH=sh3eb TOOLPREFIX=sh-elf-vhex- \
CC=sh-elf-vhex-gcc AR=sh-elf-vhex-ar \
libdir="$LIP" includedir="$LIP/include" \
install-static install-headers
cd ..
# Build Vhex custom C standard library
rm -rf fxlibc
$quiet git clone https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc.git --branch dev --depth=1
cd fxlibc
$quiet cmake -DFXLIBC_PIC=1 -DFXLIBC_TARGET=vhex-sh -B build-vhex \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-vhex.cmake \
-DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_INSTALL_PREFIX="$LIP"
cd build-vhex
$quiet $make_cmd
cd ../..
$quiet vxsdk pkg clone fxlibc@dev -o ../fxlibc --yes
$quiet vxsdk -vvv build-superh ../fxlibc --verbose
#
# Build GCC stage-2
#
echo "$TAG Configuring GCC (stage 2)..."
cd gcc
# Remove stage-1 compilation part
rm -rf $(ls | grep -v gcc | grep -v sh-elf-vhex)
# Recreate the build directory
mkdir -p build
cd build
# Configure GCC for the stage-2 (force enable shared version of libgcc)
$quiet ../gcc/configure --prefix=$PREFIX --target=sh-elf-vhex \
--with-multilib-list=m3,m4-nofpu --enable-languages=c --without-headers \
--disable-nls --enable-lto $extra_args
echo "$TAG Compiling GCC (stage 2) (usually 10-20 minutes)..."
$quiet $make_cmd -j"$cores" all-gcc
echo "$TAG Install GCC (stage 2)..."
$quiet $make_cmd -j"$cores" install-strip-gcc
#
# Patch the generation of the shared version of the libgcc which require a C
# standard library.
#
echo "$TAG Install C standar library..."
# Re-install openlibm
cd ../../OpenLibm
$quiet $make_cmd USEGCC=1 ARCH=sh3eb TOOLPREFIX=sh-elf-vhex- \
CC=sh-elf-vhex-gcc AR=sh-elf-vhex-ar \
libdir="$LIP" includedir="$LIP/include" \
install-static install-headers
# Install the C standard library
cd ../fxlibc/build-vhex
$quiet $make_cmd install
# Generate the shared version of libgcc
cd ../../gcc/build
# It seems that the generation of the shared libgcc search the
# libc in a non-conventional (?) path
rm -rf $(pwd)/../sh-elf-vhex/lib
ln -sf $LIP/lib $(pwd)/../sh-elf-vhex/lib
#---
# Finish to build GCC
#---
echo "$TAG Compiling libgcc (stage 2)..."
@ -243,7 +135,13 @@ echo "$TAG Install libgcc (stage 2)..."
$quiet $make_cmd -j"$cores" install-strip-target-libgcc
#---
# Indicate that the build is finished
#---
touch ../.fini
exit 0

View File

@ -1,12 +1,12 @@
#! /usr/bin/env bash
verbose=false
cache=false
cache=true
version='?'
#
#---
# Help screen
#
#---
help() {
cat << OEF
Script for the configuration step of Vhex kernel's binutils.
@ -26,9 +26,9 @@ OEF
#
#---
# Parse arguments
#
#---
[[ $# -eq 0 ]] && help
@ -42,12 +42,9 @@ for arg; do case "$arg" in
exit 1
esac; done
#
# Check parsing validity
#
#---
# check version
#---
list_version=''
for tmp in $(ls -d ../../patchs/gcc/*); do
@ -66,20 +63,29 @@ if [[ ! $list_version =~ (^|[[:space:]])$version($|[[:space:]]) ]]; then
exit 1
fi
#---
# Import some helpers
# <> get_sysroot() -> workaround with the vxsdk to fetch the sysroot path
# <> run_quietly() -> do not display command logs and save them in log files
#---
source ../../scripts/utils.sh
#
#---
# Configuration part
#
#---
TAG='<sh-elf-vhex-gcc>'
VERSION="$version"
URL="https://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.xz"
ARCHIVE="../../cache/$(basename $URL)"
ARCHIVE="/tmp/sh-elf-vhex/$(basename $URL)"
SYSROOT="$(get_sysroot)"
#---
# Avoid rebuilds of the same version
#---
existing_gcc="../../build/gcc/bin/sh-elf-vhex-gcc"
existing_gcc="$SYSROOT/bin/sh-elf-vhex-gcc"
if [[ -f "$existing_gcc" ]]; then
existing_version=$($existing_gcc --version | head -n 1 | grep -Eo '[0-9.]+$')
@ -91,8 +97,16 @@ if [[ -f "$existing_gcc" ]]; then
[[ -f ../../build/gcc/.fini ]] && rm -f ../../build/gcc/.fini
fi
#---
# Download archive
#---
if [[ "$cache" == 'false' ]]; then
if [[ -f "$ARCHIVE" ]]; then
rm -f "$ARCHIVE"
fi
fi
mkdir -p $(dirname "$ARCHIVE")
if [[ -f "$ARCHIVE" ]]; then
echo "$TAG Found $ARCHIVE, skipping download"
else
@ -107,47 +121,47 @@ else
fi
fi
#---
# Extract archive (openBSD-compliant version)
#---
echo "$TAG Extracting $ARCHIVE..."
mkdir -p ../../build/gcc/build
cd ../../build/gcc
mkdir -p ../../build/gcc
cd ../../build/gcc/
unxz -c < $ARCHIVE | tar -xf -
#---
# Apply GCC patchs for Vhex
#---
echo "$TAG Apply Vhex patchs..."
cp -r ../../patchs/gcc/$VERSION/* ./gcc-$VERSION/
# Rename the extracted directory to avoid path deduction during building strep
# Rename the extracted directory to avoid path deduction during building step
# (so the build script will use explicitly ...build/gcc/... path)
[[ -d ./gcc ]] && rm -rf ./gcc
mv ./gcc-$VERSION/ ./gcc
#---
# Install dependencies
#---
cd gcc
./contrib/download_prerequisites
cd ..
# Symlink as, ld, ar and ranlib, which gcc will not find by itself (we renamed
# them from sh3eb-elf-* to sh-elf-* with --program-prefix).
mkdir -p sh-elf-vhex/bin
ln -sf $(pwd)/../binutils/bin/sh-elf-vhex-as sh-elf-vhex/bin/as
ln -sf $(pwd)/../binutils/bin/sh-elf-vhex-ld sh-elf-vhex/bin/ld
ln -sf $(pwd)/../binutils/bin/sh-elf-vhex-ar sh-elf-vhex/bin/ar
ln -sf $(pwd)/../binutils/bin/sh-elf-vhex-ranlib sh-elf-vhex/bin/ranlib
# Patch OpenLibM building error (which search for sh-elf-vhex-ar)
ln -sf $(pwd)/../binutils/bin/sh-elf-vhex-ar sh-elf-vhex/bin/sh-elf-vhex-ar
mkdir -p build
#---
# Cache management
#---
if [[ "$cache" == 'false' ]]; then
echo "$TAG Removing $ARCHIVE..."
rm -f $ARCHIVE
rm -f "$ARCHIVE"
fi
exit 0

View File

@ -1,77 +0,0 @@
#! /usr/bin/env bash
verbose=false
cache=false
prefix=
#
# Help screen
#
help() {
cat << OEF
Script for the installation step of GCC for the Vhex kernel.
Usage $0 [options...]
Configurations:
-h, --help Display this help
--cache Keep the build and sources directory
--verbose Display extra information during the installation step
--prefix=<PREFIX> Installation prefix
OEF
exit 0
}
#
# Parse arguments
#
[[ $# -eq 0 ]] && help
for arg; do case "$arg" in
--help | -h) help;;
--verbose) verbose=true;;
--cache) cache=true;;
--prefix=*) prefix=${arg#*=};;
*)
echo "error: unreconized argument '$arg', giving up." >&2
exit 1
esac; done
#
# Installation step
#
TAG='<sh-elf-vhex-gcc>'
PREFIX="$prefix"
# Check that all tools has been generated
existing_gcc="../../build/gcc/bin/sh-elf-vhex-gcc"
if [[ ! -f "$existing_gcc" ]]; then
echo "error: Are you sure to have built GCC ? it seems that" >&2
echo " the tool is missing..." >&2
exit 1
fi
cd ../../build/gcc/bin
# Symbolic link executables to $PREFIX/bin
echo "$TAG Symlinking binaries..."
mkdir -p $PREFIX
for x in *; do
ln -sf "$(pwd)/$x" "$PREFIX/$x"
done
# Cleanup build files
if [[ "$cache" == 'false' ]]; then
echo "$TAG Cleaning up build files..."
rm -rf gcc/
rm -rf build/
fi

View File

@ -1,71 +0,0 @@
#! /usr/bin/env bash
verbose=false
prefix=
#
# Help screen
#
help()
{
cat << OEF
Script for the uninstallation of the Vhex kernel's GCC.
Usage $0 [options...]
Configurations:
-h, --help Display this help
--verbose Display extra information during the installation step
--prefix=<PREFIX> Installation prefix
OEF
exit 0
}
#
# Parse arguments
#
[[ $# -eq 0 ]] && help
for arg; do case "$arg" in
--help | -h) help;;
--verbose) verbose=true;;
--prefix=*) prefix=${arg#*=};;
*)
echo "error: unreconized argument '$arg', giving up." >&2
exit 1
esac; done
#
# Unistall step
#
TAG='<sh-elf-vhex-gcc>'
PREFIX="$prefix"
# Check that the configuration step has been effectuated
if [[ ! -d ../../build/gcc/bin ]]; then
echo "error: Are you sure to have configured GCC ? it seems that" >&2
echo " the build directory is missing..." >&2
exit 1
fi
cd ../../build/gcc
# Remove symlinks
echo "$TAG Removing symlinks to binaries..."
for x in bin/*; do
rm "$PREFIX/$x"
done
# Remove local files
echo "$TAG Removing installed files..."
rm -rf ../gcc
exit 0

View File

@ -4,12 +4,12 @@ verbose=false
cache=false
prefix=
#
#---
# Help screen
#
#---
help() {
cat << OEF
Script for the installation step of binutils for the Vhex kernel.
Script for the installation step of binutils/GCC tools for the Vhex kernel.
Usage $0 [options...]
@ -24,9 +24,10 @@ OEF
#
#---
# Parse arguments
#
#---
[[ $# -eq 0 ]] && help
@ -42,36 +43,46 @@ esac; done
#
# Installation step
#
TAG='<sh-elf-vhex-binutils>'
#---
# Installation step
#---
source ../scripts/utils.sh
TAG='<sh-elf-vhex>'
PREFIX="$prefix"
SYSROOT="$(get_sysroot)"
# Check that all tools has been generated
existing_as="../../build/binutils/bin/sh-elf-vhex-as"
existing_gcc="$SYSROOT/bin/sh-elf-vhex-gcc"
if [[ ! -f "$existing_as" ]]; then
echo "error: Are you sure to have built binutils ? it seems that" >&2
if [[ ! -f "$existing_gcc" ]]; then
echo "error: Are you sure to have built sh-elf-vhex ? it seems that" >&2
echo " the 'as' tool is missing..." >&2
exit 1
fi
cd ../../build/binutils/bin
# Symbolic link executables to $PREFIX/bin
echo "$TAG Symlinking binaries..."
mkdir -p $PREFIX
for x in *; do
ln -sf "$(pwd)/$x" "$PREFIX/$x"
done
# Cleanup build files
if [[ "$cache" == 'false' ]]; then
echo "$TAG Cleaning up build files..."
rm -rf binutils-*/
rm -rf build/
rm -rf ../../build
fi
#---
# Symbolic link executables to $PREFIX
#---
echo "$TAG Symlinking binaries..."
cd "$SYSROOT/bin"
mkdir -p "$PREFIX"
for x in *; do
ln -sf "$SYSROOT/bin/$x" "$PREFIX/$x"
done

View File

@ -3,10 +3,9 @@
verbose=false
prefix=
#
#---
# Help screen
#
#---
help()
{
cat << OEF
@ -24,9 +23,10 @@ OEF
#
#---
# Parse arguments
#
#---
[[ $# -eq 0 ]] && help
@ -40,30 +40,46 @@ for arg; do case "$arg" in
esac; done
#
#---
# Unistall step
#
#---
TAG='<sh-elf-vhex-binutils>'
source ../scripts/utils.sh
TAG='<sh-elf-vhex>'
PREFIX="$prefix"
SYSROOT="$(get_sysroot)"
# Check that the configuration step has been effectuated
# Check that all tools has been generated
if [[ ! -d ../../build/binutils/bin ]]; then
echo "error: Are you sure to have configured binutils ? it seems that" >&2
echo " the build directory is missing..." >&2
existing_gcc="$SYSROOT/bin/sh-elf-vhex-gcc"
if [[ ! -f "$existing_gcc" ]]; then
echo "error: Are you sure to have built sh-elf-vhex ? it seems that" >&2
echo " the 'as' tool is missing..." >&2
exit 1
fi
cd ../../build/binutils
#---
# Remove symlinks
#---
cd "$SYSROOT/bin"
echo "$TAG Removing symlinks to binaries..."
for x in bin/*; do
rm "$PREFIX/$x"
for x in *; do
unlink "$PREFIX/$x"
done
# Remove local files
#---
# Remove sysroot
#---
echo "$TAG Removing installed files..."
rm -rf ../binutils
rm -rf "$SYSROOT"

View File

@ -15,7 +15,8 @@ quiet='run_normaly'
#
run_normaly() {
bash -c "$@"
echo "$@"
"$@"
if [[ "$?" != 0 ]]; then
echo "$TAG error: command failed, abord"
exit 1
@ -31,4 +32,16 @@ run_quietly() {
>&2 echo "$@"
exit 1
fi
rm -f "$out"
}
get_sysroot() {
if [ -z $VXSDK_PREFIX_SYSROOT ]; then
>2& echo "error: are you sure to use the vxSDK ?"
>2& echo " Missing sysroot information, abord"
exit 1
fi
SYSROOT="${VXSDK_PREFIX_SYSROOT/#\~/$HOME}"
mkdir -p "$SYSROOT"
echo "$SYSROOT"
}

View File

@ -1,9 +1,11 @@
[project]
name = 'sh-elf-vhex'
type = 'app'
name = 'sh-elf-vhex'
type = 'app'
target = [
'superh'
]
[build]
configure = 'make configure'
[superh.build]
build = 'make build'
install = 'make install'
uninstall = 'make uninstall'