Improve install-crosstool-ng-toolchain.sh scripts

It is now possible to choose the version of crosstool-ng per image, To make it easier to upgrade crosstool-ng to newer versions without having to update all images at the same time

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2021-06-23 14:53:33 +02:00
parent 9adf96c16b
commit 2082f62c76
9 changed files with 48 additions and 9 deletions

View File

@ -42,6 +42,7 @@ RUN mkdir /dockcross/crosstool \
&& /dockcross/install-crosstool-ng-toolchain.sh \ && /dockcross/install-crosstool-ng-toolchain.sh \
-p "${XCC_PREFIX}" \ -p "${XCC_PREFIX}" \
-c /dockcross/crosstool-ng.config \ -c /dockcross/crosstool-ng.config \
-v "${CT_VERSION}" \
&& rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh && rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh
# Restore our default workdir (from "dockcross/base"). # Restore our default workdir (from "dockcross/base").

View File

@ -16,7 +16,7 @@ set -o pipefail
# be generated underneath of here. # be generated underneath of here.
ROOT=${PWD} ROOT=${PWD}
usage() { echo "Usage: $0 -p <prefix> -c <config-path>" 1>&2; exit 1; } usage() { echo "Usage: $0 -p <prefix> -c <config-path> -v <version>" 1>&2; exit 1; }
# Resolve our input parameters. # Resolve our input parameters.
# #
@ -24,7 +24,8 @@ usage() { echo "Usage: $0 -p <prefix> -c <config-path>" 1>&2; exit 1; }
# change directories during installation. # change directories during installation.
CT_PREFIX= CT_PREFIX=
CONFIG_PATH= CONFIG_PATH=
while getopts "p:c:" o; do REV=
while getopts "p:c:v:" o; do
case "${o}" in case "${o}" in
p) p)
CT_PREFIX=$(readlink -f ${OPTARG}) CT_PREFIX=$(readlink -f ${OPTARG})
@ -32,6 +33,9 @@ while getopts "p:c:" o; do
c) c)
CONFIG_PATH=$(readlink -f ${OPTARG}) CONFIG_PATH=$(readlink -f ${OPTARG})
;; ;;
v)
REV=${OPTARG}
;;
*) *)
usage usage
;; ;;
@ -48,6 +52,12 @@ if [ -z ${CONFIG_PATH} ] || [ ! -f ${CONFIG_PATH} ]; then
usage usage
fi fi
if [ -z ${REV} ]; then
echo "WARNING: No version selected, use default version: crosstool-ng-1.23.0 (-v)."
REV=crosstool-ng-1.23.0
fi
## ##
# Build "crosstool-ng". # Build "crosstool-ng".
## ##
@ -57,12 +67,17 @@ mkdir -p "${CTNG}"
cd "${CTNG}" cd "${CTNG}"
# Download and install the "crosstool-ng" source. # Download and install the "crosstool-ng" source.
REV=1.23.0
curl -# -LO \ git clone https://github.com/crosstool-ng/crosstool-ng.git
"https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-${REV}.tar.gz" cd crosstool-ng
tar -xf "crosstool-ng-${REV}.tar.gz" git fetch --tags
patch crosstool-ng-crosstool-ng-1.23.0/scripts/build/companion_libs/210-expat.sh -i /dockcross/crosstool-ng-expat.patch
cd "crosstool-ng-crosstool-ng-${REV}" # checkout
git checkout ${REV}
if [ ${REV} = "crosstool-ng-1.23.0" ]; then
patch scripts/build/companion_libs/210-expat.sh -i /dockcross/crosstool-ng-expat.patch
fi
# Bootstrap and install the tool. # Bootstrap and install the tool.
BOOTSTRAP_PREFIX="${CTNG}/prefix" BOOTSTRAP_PREFIX="${CTNG}/prefix"
@ -96,5 +111,6 @@ cp "${CONFIG_PATH}" "${BUILD}/.config"
unset LD_LIBRARY_PATH unset LD_LIBRARY_PATH
# Build and install the toolchain! # Build and install the toolchain!
"${BOOTSTRAP_PREFIX}/bin/ct-ng" build # Print last 250 lines if build fail
"${BOOTSTRAP_PREFIX}/bin/ct-ng" build || tail -250 build.log

View File

@ -2,6 +2,9 @@ FROM dockcross/base:latest
# This is for 64-bit ARM Linux machine # This is for 64-bit ARM Linux machine
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
# The cross-compiling emulator # The cross-compiling emulator

View File

@ -4,6 +4,9 @@ MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# This is for ARMv5 "legacy" (armel) devices which do NOT support hard float # This is for ARMv5 "legacy" (armel) devices which do NOT support hard float
# VFP instructions (armhf). # VFP instructions (armhf).
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
# The cross-compiling emulator # The cross-compiling emulator

View File

@ -1,6 +1,9 @@
FROM dockcross/base:latest FROM dockcross/base:latest
MAINTAINER Matt McCormick "matt.mccormick@kitware.com" MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
# This is for 32-bit ARMv7 Linux # This is for 32-bit ARMv7 Linux
#include "common.crosstool" #include "common.crosstool"

View File

@ -2,6 +2,10 @@ FROM dockcross/base:latest
MAINTAINER Matt McCormick "matt.mccormick@kitware.com" MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# This is for 32-bit ARMv7 Linux # This is for 32-bit ARMv7 Linux
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
# The cross-compiling emulator # The cross-compiling emulator

View File

@ -2,6 +2,9 @@ FROM dockcross/base:latest
# This is for 32-bit Big-Endian MIPS devices with hard floating point enabled # This is for 32-bit Big-Endian MIPS devices with hard floating point enabled
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
# The cross-compiling emulator # The cross-compiling emulator

View File

@ -1,6 +1,9 @@
FROM dockcross/base:latest FROM dockcross/base:latest
MAINTAINER Matt McCormick "matt.mccormick@kitware.com" MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
ENV CROSS_TRIPLE powerpc64le-linux-gnu ENV CROSS_TRIPLE powerpc64le-linux-gnu

View File

@ -2,6 +2,9 @@ FROM dockcross/base:latest
# This is for 64-bit S390X Linux machine # This is for 64-bit S390X Linux machine
# Crosstool-ng version
ENV CT_VERSION crosstool-ng-1.23.0
#include "common.crosstool" #include "common.crosstool"
# The cross-compiling emulator # The cross-compiling emulator