2017-02-23 10:37:50 +00:00
|
|
|
#!/bin/bash
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2008-10-29 16:02:06 +00:00
|
|
|
# Abort execution as soon as an error is encountered
|
|
|
|
# That way the script do not let the user think the process completed correctly
|
|
|
|
# and leave the opportunity to fix the problem and restart compilation where
|
|
|
|
# it stopped
|
|
|
|
set -e
|
|
|
|
|
2006-05-15 13:26:59 +00:00
|
|
|
# this is where this script will store downloaded files and check for already
|
|
|
|
# downloaded files
|
2009-01-08 20:00:10 +00:00
|
|
|
dlwhere="${RBDEV_DOWNLOAD:-/tmp/rbdev-dl}"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
|
|
|
# will append the target string to the prefix dir mentioned here
|
|
|
|
# Note that the user running this script must be able to do make install in
|
|
|
|
# this given prefix directory. Also make sure that this given root dir
|
|
|
|
# exists.
|
2009-01-08 20:00:10 +00:00
|
|
|
prefix="${RBDEV_PREFIX:-/usr/local}"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2006-05-30 08:38:02 +00:00
|
|
|
# This directory is used to extract all files and to build everything in. It
|
|
|
|
# must not exist before this script is invoked (as a security measure).
|
2009-01-08 20:00:10 +00:00
|
|
|
builddir="${RBDEV_BUILD:-/tmp/rbdev-build}"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2006-11-22 09:07:45 +00:00
|
|
|
# This script needs to use GNU Make. On Linux systems, GNU Make is invoked
|
|
|
|
# by running the "make" command, on most BSD systems, GNU Make is invoked
|
|
|
|
# by running the "gmake" command. Set the "make" variable accordingly.
|
2008-12-01 13:24:33 +00:00
|
|
|
if [ -f "`which gmake 2>/dev/null`" ]; then
|
2009-05-10 18:11:09 +00:00
|
|
|
make="gmake"
|
2006-11-22 09:07:45 +00:00
|
|
|
else
|
2010-06-02 00:51:18 +00:00
|
|
|
make="make"
|
2006-11-22 09:07:45 +00:00
|
|
|
fi
|
|
|
|
|
2020-04-04 19:42:35 +00:00
|
|
|
# This is the absolute path to where the script resides.
|
2021-01-31 09:11:23 +00:00
|
|
|
rockboxdevdir="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )"
|
2020-04-04 19:42:35 +00:00
|
|
|
|
2020-08-07 20:11:30 +00:00
|
|
|
if [ `uname -s` = "Darwin" ]; then
|
|
|
|
parallel=`sysctl -n hw.physicalcpu`
|
|
|
|
else
|
|
|
|
parallel=`nproc`
|
|
|
|
fi
|
|
|
|
|
2020-04-03 05:14:46 +00:00
|
|
|
if [ $parallel -gt 1 ] ; then
|
|
|
|
make_parallel=-j$parallel
|
|
|
|
fi
|
|
|
|
|
2008-07-30 15:46:13 +00:00
|
|
|
if [ -z $GNU_MIRROR ] ; then
|
2013-10-20 19:12:39 +00:00
|
|
|
GNU_MIRROR=http://mirrors.kernel.org/gnu
|
2008-07-30 15:46:13 +00:00
|
|
|
fi
|
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
if [ -z $LINUX_MIRROR ] ; then
|
|
|
|
LINUX_MIRROR=http://www.kernel.org/pub/linux
|
|
|
|
fi
|
|
|
|
|
2007-05-24 19:58:17 +00:00
|
|
|
# These are the tools this script requires and depends upon.
|
2012-05-18 23:45:10 +00:00
|
|
|
reqtools="gcc bzip2 gzip make patch makeinfo automake libtool autoconf flex bison"
|
2007-05-24 19:58:17 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
##############################################################################
|
|
|
|
# Functions:
|
2006-11-22 09:07:45 +00:00
|
|
|
|
2006-05-15 13:26:59 +00:00
|
|
|
findtool(){
|
|
|
|
file="$1"
|
|
|
|
|
|
|
|
IFS=":"
|
|
|
|
for path in $PATH
|
|
|
|
do
|
2008-08-01 11:19:29 +00:00
|
|
|
# echo "Checks for $file in $path" >&2
|
2006-05-15 13:26:59 +00:00
|
|
|
if test -f "$path/$file"; then
|
|
|
|
echo "$path/$file"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
findlib (){
|
|
|
|
lib="$1"
|
|
|
|
# on error, gcc will spit out "cannot find -lxxxx", but it may not be in
|
|
|
|
# english so grep for -lxxxx
|
|
|
|
if ! gcc -l$lib 2>&1 | grep -q -- "-l$lib"; then
|
|
|
|
echo "ok"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# check if all the libraries in argument are installed, exit with error if not
|
|
|
|
checklib() {
|
|
|
|
for t in "$@"; do
|
|
|
|
lib=`findlib $t`
|
|
|
|
if test -z "$lib"; then
|
|
|
|
echo "ROCKBOXDEV: library \"$t\" is required for this script to work."
|
|
|
|
missingtools="yes"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$missingtools" ]; then
|
|
|
|
echo "ROCKBOXDEV: Please install the missing libraries and re-run the script."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-05-15 13:26:59 +00:00
|
|
|
input() {
|
|
|
|
read response
|
|
|
|
echo $response
|
|
|
|
}
|
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
# compare two versions, return 1 if first version is strictly before the second
|
|
|
|
# version_lt ver1 ver2
|
|
|
|
version_lt() {
|
|
|
|
# use sort with natural version sorting
|
|
|
|
ltver=`printf "$1\n$2" | sort -V | head -n 1`
|
|
|
|
[ "$1" = "$ltver" ] && true || false
|
|
|
|
}
|
|
|
|
|
|
|
|
# Download a file from a server (unless it already exists locally in $dlwhere).
|
|
|
|
# The output file name is always $dlwhere/$1, and the function will try URLs
|
|
|
|
# one after the other
|
|
|
|
# $1 file
|
|
|
|
# $2 server file name
|
|
|
|
# $2,$3,... URL root list
|
|
|
|
getfile_ex() {
|
|
|
|
out_file="$dlwhere/$1"
|
|
|
|
srv_file="$2"
|
|
|
|
if test -f $out_file; then
|
|
|
|
echo "ROCKBOXDEV: Skipping download of $1: File already exists"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# find tool (curl or wget) and build download command
|
|
|
|
tool=`findtool curl`
|
|
|
|
if test -z "$tool"; then
|
|
|
|
tool=`findtool wget`
|
|
|
|
if test -n "$tool"; then
|
|
|
|
# wget download
|
|
|
|
echo "ROCKBOXDEV: Downloading $1 using wget"
|
|
|
|
tool="$tool -T 60 -O "
|
|
|
|
else
|
|
|
|
echo "ROCKBOXDEV: No downloader tool found!"
|
|
|
|
echo "ROCKBOXDEV: Please install curl or wget and re-run the script"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# curl download
|
|
|
|
echo "ROCKBOXDEV: Downloading $1 using curl"
|
|
|
|
tool="$tool -fLo "
|
2006-05-15 13:26:59 +00:00
|
|
|
fi
|
2008-08-01 11:19:29 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
# shift arguments so that $@ is the list of URLs
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
for url in "$@"; do
|
|
|
|
echo "ROCKBOXDEV: try $url/$srv_file"
|
|
|
|
if $tool "$out_file" "$url/$srv_file"; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
2008-08-10 14:36:18 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
echo "ROCKBOXDEV: couldn't download the file!"
|
|
|
|
echo "ROCKBOXDEV: check your internet connection"
|
2006-05-15 13:26:59 +00:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
#$1 file
|
|
|
|
#$2 URL"root
|
|
|
|
# Output file name is the same as the server file name ($1)
|
|
|
|
# Does not download the file if it already exists locally in $dlwhere/
|
|
|
|
getfile() {
|
|
|
|
getfile_ex "$1" "$1" "$2"
|
|
|
|
}
|
2007-05-24 19:58:17 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
# wrapper around getfile to abstract url
|
|
|
|
# getttool tool version
|
|
|
|
# the file is always downloaded to "$dlwhere/$toolname-$version.tar.bz2"
|
|
|
|
gettool() {
|
2010-06-05 23:05:07 +00:00
|
|
|
toolname="$1"
|
2017-02-23 10:37:50 +00:00
|
|
|
version="$2"
|
|
|
|
ext="tar.bz2"
|
|
|
|
file="$toolname-$version"
|
|
|
|
srv_file="$toolname-$version"
|
2010-06-05 23:05:07 +00:00
|
|
|
case $toolname in
|
|
|
|
gcc)
|
2017-02-23 10:37:50 +00:00
|
|
|
# before 4.7, the tarball was named gcc-core
|
|
|
|
if version_lt "$version" "4.7"; then
|
|
|
|
srv_file="gcc-core-$version"
|
|
|
|
fi
|
2011-01-10 19:13:33 +00:00
|
|
|
url="$GNU_MIRROR/gcc/gcc-$version"
|
2010-06-05 23:05:07 +00:00
|
|
|
;;
|
2006-05-29 22:23:00 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
binutils)
|
2011-01-10 19:13:33 +00:00
|
|
|
url="$GNU_MIRROR/binutils"
|
2010-06-05 23:05:07 +00:00
|
|
|
;;
|
2006-05-29 22:23:00 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
glibc)
|
|
|
|
url="$GNU_MIRROR/glibc"
|
|
|
|
;;
|
|
|
|
|
2014-07-30 12:29:11 +00:00
|
|
|
crosstool-ng)
|
2011-12-23 13:49:43 +00:00
|
|
|
url="http://crosstool-ng.org/download/crosstool-ng"
|
|
|
|
;;
|
2017-02-23 10:37:50 +00:00
|
|
|
|
|
|
|
alsa-lib)
|
2020-10-29 15:45:17 +00:00
|
|
|
url="ftp://ftp.alsa-project.org/pub/lib"
|
|
|
|
;;
|
|
|
|
|
|
|
|
libffi)
|
|
|
|
url="ftp://sourceware.org/pub/libffi"
|
|
|
|
ext="tar.gz"
|
|
|
|
;;
|
|
|
|
|
|
|
|
glib)
|
|
|
|
url="https://ftp.gnome.org/pub/gnome/sources/glib/2.46"
|
|
|
|
ext="tar.xz"
|
|
|
|
;;
|
|
|
|
|
|
|
|
zlib)
|
|
|
|
url="https://zlib.net"
|
|
|
|
ext="tar.gz"
|
|
|
|
;;
|
|
|
|
|
|
|
|
dbus)
|
|
|
|
url="https://dbus.freedesktop.org/releases/dbus"
|
|
|
|
ext="tar.gz"
|
|
|
|
;;
|
|
|
|
|
|
|
|
expat)
|
|
|
|
url="https://src.fedoraproject.org/repo/pkgs/expat/expat-2.1.0.tar.gz/dd7dab7a5fea97d2a6a43f511449b7cd"
|
|
|
|
ext="tar.gz"
|
2017-02-23 10:37:50 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
linux)
|
|
|
|
# FIXME linux kernel server uses an overcomplicated architecture,
|
|
|
|
# especially for longterm kernels, so we need to lookup several
|
|
|
|
# places. This will need fixing for non-4-part 2.6 versions but it
|
|
|
|
# is written in a way that should make it easy
|
|
|
|
case "$version" in
|
|
|
|
2.6.*.*)
|
|
|
|
# 4-part versions -> remove last digit for longterm
|
|
|
|
longterm_ver="${version%.*}"
|
|
|
|
top_dir="v2.6"
|
|
|
|
;;
|
2017-02-23 11:16:32 +00:00
|
|
|
3.*)
|
|
|
|
longterm_ver=""
|
|
|
|
top_dir="v3.x"
|
|
|
|
;;
|
2017-02-23 10:37:50 +00:00
|
|
|
*)
|
|
|
|
echo "ROCKBOXDEV: I don't know how to handle this kernel version: $version"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
base_url="http://www.kernel.org/pub/linux/kernel/$top_dir"
|
2017-02-23 11:16:32 +00:00
|
|
|
# we try several URLs, the 2.6 versions are a mess and need that
|
2017-02-23 10:37:50 +00:00
|
|
|
url="$base_url $base_url/longterm/v$longterm_ver $base_url/longterm"
|
|
|
|
ext="tar.gz"
|
|
|
|
;;
|
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
*)
|
|
|
|
echo "ROCKBOXDEV: Bad toolname $toolname"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
2017-02-23 10:37:50 +00:00
|
|
|
getfile_ex "$file.$ext" "$srv_file.$ext" $url
|
|
|
|
}
|
|
|
|
|
|
|
|
# extract file to the current directory
|
|
|
|
# extract file
|
|
|
|
extract() {
|
|
|
|
if [ -d "$1" ]; then
|
|
|
|
echo "ROCKBOXDEV: Skipping extraction of $1: already done"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "ROCKBOXDEV: extracting $1"
|
|
|
|
if [ -f "$dlwhere/$1.tar.bz2" ]; then
|
|
|
|
tar xjf "$dlwhere/$1.tar.bz2"
|
|
|
|
elif [ -f "$dlwhere/$1.tar.gz" ]; then
|
|
|
|
tar xzf "$dlwhere/$1.tar.gz"
|
2020-10-29 15:45:17 +00:00
|
|
|
elif [ -f "$dlwhere/$1.tar.xz" ]; then
|
|
|
|
tar xJf "$dlwhere/$1.tar.xz"
|
2017-02-23 10:37:50 +00:00
|
|
|
else
|
2021-01-29 21:13:33 +00:00
|
|
|
echo "ROCKBOXDEV: unknown compression for $1"
|
2017-02-23 10:37:50 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# run a command, and a log command and output to a file (append)
|
|
|
|
# exit on error
|
|
|
|
# run_cmd logfile cmd...
|
|
|
|
run_cmd() {
|
|
|
|
logfile="$1"
|
|
|
|
shift
|
|
|
|
echo "Running '$@'" >>$logfile
|
|
|
|
if ! $@ >> "$logfile" 2>&1; then
|
|
|
|
echo "ROCKBOXDEV: an error occured, please see $logfile"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# check if the following should be executed or not, depending on RESTART variable:
|
|
|
|
# $1=tool
|
|
|
|
# If RESTART is empty, always perform step, otherwise only perform is there is
|
|
|
|
# an exact match. On the first match, RESTART is reset to "" so that next step
|
|
|
|
# are executed
|
|
|
|
check_restart() {
|
|
|
|
if [ "$1" = "$RESTART" ]; then
|
|
|
|
RESTART=""
|
|
|
|
true
|
|
|
|
fi
|
|
|
|
[ "$RESTART" = "" ] && true || false
|
|
|
|
}
|
|
|
|
|
|
|
|
# advanced tool building: create a build directory, run configure, run make
|
|
|
|
# and run make install. It is possible to customize all steps or disable them
|
|
|
|
# $1=tool
|
|
|
|
# $2=version
|
|
|
|
# $3=configure options, or "NO_CONFIGURE" to disable step
|
|
|
|
# $4=make options, or "NO_MAKE" to disable step
|
|
|
|
# $5=make install options (will be replaced by "install" if left empty)
|
|
|
|
# By default, the restary step is the toolname, but it can be changed by setting
|
|
|
|
# RESTART_STEP
|
|
|
|
buildtool() {
|
|
|
|
tool="$1"
|
|
|
|
version="$2"
|
|
|
|
toolname="$tool-$version"
|
|
|
|
config_opt="$3"
|
|
|
|
make_opts="$4"
|
|
|
|
install_opts="$5"
|
|
|
|
logfile="$builddir/build-$toolname.log"
|
|
|
|
|
|
|
|
stepname=${RESTART_STEP-$tool}
|
|
|
|
if ! check_restart "$stepname"; then
|
|
|
|
echo "ROCKBOXDEV: Skipping step '$stepname' as requested per RESTART"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "ROCKBOXDEV: Starting step '$stepname'"
|
|
|
|
|
|
|
|
echo "ROCKBOXDEV: logging to $logfile"
|
|
|
|
rm -f "$logfile"
|
|
|
|
|
|
|
|
echo "ROCKBOXDEV: mkdir build-$toolname"
|
|
|
|
mkdir "build-$toolname"
|
|
|
|
|
|
|
|
echo "ROCKBOXDEV: cd build-$toolname"
|
|
|
|
cd "build-$toolname"
|
|
|
|
|
|
|
|
# in-tree/out-of-tree build
|
|
|
|
case "$tool" in
|
|
|
|
linux|alsa-lib)
|
|
|
|
# in-intree
|
|
|
|
echo "ROCKBOXDEV: copy $toolname for in-tree build"
|
|
|
|
# copy the source directory to the build directory
|
|
|
|
cp -r ../$toolname/* .
|
|
|
|
cfg_dir="."
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# out-of-tree
|
|
|
|
cfg_dir="../$toolname";
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-10-29 15:45:17 +00:00
|
|
|
if [ "$tool" == "zlib" ]; then
|
|
|
|
echo "ROCKBOXDEV: $toolname/configure"
|
|
|
|
# NOTE glibc requires to be compiled with optimization
|
|
|
|
CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline -O2' run_cmd "$logfile" \
|
|
|
|
"$cfg_dir/configure" "--prefix=$prefix" \
|
|
|
|
$config_opt
|
|
|
|
elif [ "$config_opt" != "NO_CONFIGURE" ]; then
|
2017-02-23 10:37:50 +00:00
|
|
|
echo "ROCKBOXDEV: $toolname/configure"
|
|
|
|
# NOTE glibc requires to be compiled with optimization
|
|
|
|
CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline -O2' run_cmd "$logfile" \
|
|
|
|
"$cfg_dir/configure" "--prefix=$prefix" \
|
|
|
|
--disable-docs $config_opt
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$make_opts" != "NO_MAKE" ]; then
|
|
|
|
echo "ROCKBOXDEV: $toolname/make"
|
2020-04-03 05:14:46 +00:00
|
|
|
run_cmd "$logfile" $make $make_parallel $make_opts
|
2017-02-23 10:37:50 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$install_opts" = "" ]; then
|
|
|
|
install_opts="install"
|
|
|
|
fi
|
|
|
|
echo "ROCKBOXDEV: $toolname/make (install)"
|
|
|
|
run_cmd "$logfile" $make $install_opts
|
|
|
|
|
|
|
|
echo "ROCKBOXDEV: rm -rf build-$toolname $toolname"
|
|
|
|
cd ..
|
|
|
|
rm -rf build-$toolname
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
toolname="$1"
|
|
|
|
target="$2"
|
|
|
|
version="$3"
|
|
|
|
patch="$4"
|
|
|
|
configure_params="$5"
|
|
|
|
needs_libs="$6"
|
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# create build directory
|
|
|
|
if test -d $builddir; then
|
|
|
|
if test ! -w $builddir; then
|
|
|
|
echo "ROCKBOXDEV: No write permission for $builddir"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
mkdir -p $builddir
|
|
|
|
fi
|
2006-05-29 22:23:00 +00:00
|
|
|
|
2020-04-04 19:42:35 +00:00
|
|
|
patch_dir="$rockboxdevdir/toolchain-patches"
|
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# download source tarball
|
2017-02-23 10:37:50 +00:00
|
|
|
gettool "$toolname" "$version"
|
|
|
|
file="$toolname-$version"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
cd $builddir
|
2006-05-30 08:38:02 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
extract "$toolname-$version"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# do we have a patch?
|
2013-05-14 19:32:20 +00:00
|
|
|
for p in $patch; do
|
|
|
|
echo "ROCKBOXDEV: applying patch $p"
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# apply the patch
|
2020-04-04 19:42:35 +00:00
|
|
|
(cd $builddir/$toolname-$version && patch -p1 < "$patch_dir/$p")
|
2009-03-12 16:48:58 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# check if the patch applied cleanly
|
|
|
|
if [ $? -gt 0 ]; then
|
2013-05-14 19:32:20 +00:00
|
|
|
echo "ROCKBOXDEV: failed to apply patch $p"
|
2010-06-05 23:05:07 +00:00
|
|
|
exit
|
|
|
|
fi
|
2013-05-14 19:32:20 +00:00
|
|
|
done
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2020-03-27 19:31:30 +00:00
|
|
|
# kludge to avoid having to install GMP, MPFR, MPC and ISL
|
2011-01-06 14:56:36 +00:00
|
|
|
if test -n "$needs_libs"; then
|
2020-03-27 19:31:30 +00:00
|
|
|
cd "$toolname-$version"
|
2011-01-06 14:56:36 +00:00
|
|
|
if (echo $needs_libs | grep -q gmp && test ! -d gmp); then
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: Getting GMP"
|
2017-02-23 10:37:50 +00:00
|
|
|
getfile "gmp-4.3.2.tar.bz2" "$GNU_MIRROR/gmp"
|
2011-01-06 14:56:36 +00:00
|
|
|
tar xjf $dlwhere/gmp-4.3.2.tar.bz2
|
|
|
|
ln -s gmp-4.3.2 gmp
|
2010-06-05 23:05:07 +00:00
|
|
|
fi
|
|
|
|
|
2011-01-06 14:56:36 +00:00
|
|
|
if (echo $needs_libs | grep -q mpfr && test ! -d mpfr); then
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: Getting MPFR"
|
2020-03-27 19:31:30 +00:00
|
|
|
getfile "mpfr-3.1.0.tar.bz2" "$GNU_MIRROR/mpfr"
|
|
|
|
tar xjf $dlwhere/mpfr-3.1.0.tar.bz2
|
|
|
|
ln -s mpfr-3.1.0 mpfr
|
2010-06-05 23:05:07 +00:00
|
|
|
fi
|
2011-01-06 14:56:36 +00:00
|
|
|
|
|
|
|
if (echo $needs_libs | grep -q mpc && test ! -d mpc); then
|
|
|
|
echo "ROCKBOXDEV: Getting MPC"
|
2020-03-27 19:31:30 +00:00
|
|
|
getfile "mpc-1.0.1.tar.gz" "http://www.multiprecision.org/downloads"
|
|
|
|
tar xzf $dlwhere/mpc-1.0.1.tar.gz
|
|
|
|
ln -s mpc-1.0.1 mpc
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (echo $needs_libs | grep -q isl && test ! -d isl); then
|
|
|
|
echo "ROCKBOXDEV: Getting ISL"
|
|
|
|
getfile "isl-0.15.tar.bz2" "https://gcc.gnu.org/pub/gcc/infrastructure"
|
|
|
|
tar xjf $dlwhere/isl-0.15.tar.bz2
|
|
|
|
ln -s isl-0.15 isl
|
2011-01-06 14:56:36 +00:00
|
|
|
fi
|
2010-06-06 00:27:52 +00:00
|
|
|
cd $builddir
|
2010-06-05 23:05:07 +00:00
|
|
|
fi
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: mkdir build-$toolname"
|
|
|
|
mkdir build-$toolname
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: cd build-$toolname"
|
|
|
|
cd build-$toolname
|
2009-02-24 20:53:04 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: $toolname/configure"
|
2011-12-23 13:49:43 +00:00
|
|
|
case $toolname in
|
2014-07-30 12:29:11 +00:00
|
|
|
crosstool-ng) # ct-ng doesnt support out-of-tree build and the src folder is named differently
|
2011-12-23 13:49:43 +00:00
|
|
|
toolname="crosstool-ng"
|
2011-12-24 15:40:11 +00:00
|
|
|
cp -r ../$toolname-$version/* ../$toolname-$version/.version .
|
2011-12-23 13:49:43 +00:00
|
|
|
./configure --prefix=$prefix $configure_params
|
|
|
|
;;
|
|
|
|
*)
|
2020-07-02 19:41:07 +00:00
|
|
|
CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline -fcommon' ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params
|
2011-12-23 13:49:43 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-04-10 15:35:24 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: $toolname/make"
|
2020-04-03 05:14:46 +00:00
|
|
|
$make $make_parallel
|
2009-03-12 16:35:03 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: $toolname/make install"
|
|
|
|
$make install
|
2009-03-12 16:35:03 +00:00
|
|
|
|
2010-10-19 21:31:35 +00:00
|
|
|
echo "ROCKBOXDEV: rm -rf build-$toolname $toolname-$version"
|
|
|
|
cd ..
|
|
|
|
rm -rf build-$toolname $toolname-$version
|
2010-06-05 23:05:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-23 13:49:43 +00:00
|
|
|
make_ctng() {
|
|
|
|
if test -f "`which ct-ng 2>/dev/null`"; then
|
|
|
|
ctng="ct-ng"
|
|
|
|
else
|
|
|
|
ctng=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test ! -n "$ctng"; then
|
|
|
|
if test ! -f "$prefix/bin/ct-ng"; then # look if we build it already
|
2014-07-30 12:29:11 +00:00
|
|
|
build "crosstool-ng" "" "1.13.2" "crosstool-ng-1.13.2.diff"
|
2011-12-23 13:49:43 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
ctng=`PATH=$prefix/bin:$PATH which ct-ng`
|
|
|
|
}
|
|
|
|
|
|
|
|
build_ctng() {
|
|
|
|
ctng_target="$1"
|
|
|
|
extra="$2"
|
|
|
|
tc_arch="$3"
|
|
|
|
tc_host="$4"
|
|
|
|
|
|
|
|
make_ctng
|
|
|
|
|
|
|
|
dlurl="http://www.rockbox.org/gcc/$ctng_target"
|
|
|
|
|
2020-07-13 02:24:32 +00:00
|
|
|
# download
|
2011-12-23 13:49:43 +00:00
|
|
|
getfile "ct-ng-config" "$dlurl"
|
|
|
|
|
|
|
|
test -n "$extra" && getfile "$extra" "$dlurl"
|
2020-07-13 02:24:32 +00:00
|
|
|
|
2011-12-23 13:49:43 +00:00
|
|
|
# create build directory
|
|
|
|
if test -d $builddir; then
|
|
|
|
if test ! -w $builddir; then
|
|
|
|
echo "ROCKBOXDEV: No write permission for $builddir"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
mkdir -p $builddir
|
|
|
|
fi
|
|
|
|
|
|
|
|
# copy config and cd to $builddir
|
|
|
|
mkdir $builddir/build-$ctng_target
|
|
|
|
ctng_config="$builddir/build-$ctng_target/.config"
|
|
|
|
cat "$dlwhere/ct-ng-config" | sed -e "s,\(CT_PREFIX_DIR=\).*,\1$prefix," > $ctng_config
|
|
|
|
cd $builddir/build-$ctng_target
|
|
|
|
|
2011-12-23 13:54:00 +00:00
|
|
|
$ctng "build"
|
2011-12-23 13:49:43 +00:00
|
|
|
|
|
|
|
# install extras
|
|
|
|
if test -e "$dlwhere/$extra"; then
|
|
|
|
# verify the toolchain has sysroot support
|
|
|
|
if test -n `cat $ctng_config | grep CT_USE_SYSROOT\=y`; then
|
|
|
|
sysroot=`cat $ctng_config | grep CT_SYSROOT_NAME | sed -e 's,CT_SYSROOT_NAME\=\"\([a-zA-Z0-9]*\)\",\1,'`
|
|
|
|
tar xf "$dlwhere/$extra" -C "$prefix/$tc_arch-$ctng_target-$tc_host/$sysroot"
|
|
|
|
fi
|
|
|
|
fi
|
2020-07-13 02:24:32 +00:00
|
|
|
|
2011-12-23 13:49:43 +00:00
|
|
|
# cleanup
|
|
|
|
cd $builddir
|
|
|
|
rm -rf $builddir/build-$ctng_target
|
|
|
|
}
|
2017-02-23 10:37:50 +00:00
|
|
|
|
|
|
|
# build a cross compiler toolchain for linux
|
|
|
|
# $1=target
|
|
|
|
# $2=binutils version
|
|
|
|
# $3=binutils configure extra options
|
|
|
|
# $4=gcc version
|
|
|
|
# $5=gcc configure extra options
|
|
|
|
# $6=linux version
|
|
|
|
# $7=glibc version
|
|
|
|
# $8=glibc configure extra options
|
|
|
|
build_linux_toolchain () {
|
|
|
|
target="$1"
|
|
|
|
binutils_ver="$2"
|
|
|
|
binutils_opts="$3"
|
|
|
|
gcc_ver="$4"
|
|
|
|
gcc_opts="$5"
|
|
|
|
linux_ver="$6"
|
|
|
|
glibc_ver="$7"
|
|
|
|
glibc_opts="$8"
|
|
|
|
# where to put the sysroot
|
|
|
|
sysroot="$prefix/$target/sysroot"
|
|
|
|
# extract arch from target
|
|
|
|
arch=${target%%-*}
|
|
|
|
|
|
|
|
# check libraries:
|
|
|
|
# contrary to other toolchains that rely on a hack to avoid installing
|
|
|
|
# gmp, mpc and mpfr, we simply require that they are installed on the system
|
|
|
|
# this is not a huge requirement since virtually all systems these days
|
|
|
|
# provide dev packages for them
|
|
|
|
# FIXME: maybe add an option to download and install them automatically
|
|
|
|
checklib "mpc" "gmp" "mpfr"
|
|
|
|
|
|
|
|
# create build directory
|
|
|
|
if test -d $builddir; then
|
|
|
|
if test ! -w $builddir; then
|
|
|
|
echo "ROCKBOXDEV: No write permission for $builddir"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
mkdir -p $builddir
|
|
|
|
fi
|
|
|
|
|
|
|
|
# download all tools
|
|
|
|
gettool "binutils" "$binutils_ver"
|
|
|
|
gettool "gcc" "$gcc_ver"
|
|
|
|
gettool "linux" "$linux_ver"
|
|
|
|
gettool "glibc" "$glibc_ver"
|
|
|
|
|
|
|
|
# extract them
|
|
|
|
cd $builddir
|
|
|
|
extract "binutils-$binutils_ver"
|
|
|
|
extract "gcc-$gcc_ver"
|
|
|
|
extract "linux-$linux_ver"
|
|
|
|
extract "glibc-$glibc_ver"
|
|
|
|
|
|
|
|
# we make it possible to restart a build on error by using the RESTART
|
|
|
|
# variable, the format is RESTART="tool" where tool is the toolname at which
|
|
|
|
# to restart (binutils, gcc)
|
|
|
|
|
|
|
|
# install binutils, with support for sysroot
|
|
|
|
buildtool "binutils" "$binutils_ver" "--target=$target --disable-werror \
|
|
|
|
--with-sysroot=$sysroot --disable-nls" "" ""
|
|
|
|
# build stage 1 compiler: disable headers, disable threading so that
|
|
|
|
# pthread headers are not included, pretend we use newlib so that libgcc
|
|
|
|
# doesn't get linked at the end
|
|
|
|
# NOTE there is some magic involved here
|
|
|
|
RESTART_STEP="gcc-stage1" \
|
|
|
|
buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c --target=$target \
|
|
|
|
--without-headers --disable-threads --disable-libgomp --disable-libmudflap \
|
|
|
|
--disable-libssp --disable-libquadmath --disable-libquadmath-support \
|
|
|
|
--disable-shared --with-newlib --disable-libitm \
|
|
|
|
--disable-libsanitizer --disable-libatomic" "" ""
|
|
|
|
# install linux headers
|
|
|
|
# NOTE: we need to tell make where to put the build files, since buildtool
|
|
|
|
# switches to the builddir, "." will be the correct builddir when ran
|
2018-02-22 08:49:37 +00:00
|
|
|
if [ "$arch" == "mipsel" ]; then
|
|
|
|
arch="mips"
|
|
|
|
fi
|
2017-02-23 10:37:50 +00:00
|
|
|
linux_opts="O=. ARCH=$arch INSTALL_HDR_PATH=$sysroot/usr/"
|
|
|
|
RESTART_STEP="linux-headers" \
|
|
|
|
buildtool "linux" "$linux_ver" "NO_CONFIGURE" \
|
|
|
|
"$linux_opts headers_install" "$linux_opts headers_check"
|
|
|
|
# build glibc using the first stage cross compiler
|
|
|
|
# we need to set the prefix to /usr because the glibc runs on the actual
|
|
|
|
# target and is indeed installed in /usr
|
|
|
|
prefix="/usr" \
|
|
|
|
buildtool "glibc" "$glibc_ver" "--target=$target --host=$target --build=$MACHTYPE \
|
|
|
|
--with-__thread --with-headers=$sysroot/usr/include $glibc_opts" \
|
|
|
|
"" "install install_root=$sysroot"
|
|
|
|
# build stage 2 compiler
|
|
|
|
buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c,c++ --target=$target \
|
|
|
|
--with-sysroot=$sysroot" "" ""
|
|
|
|
}
|
|
|
|
|
|
|
|
usage () {
|
|
|
|
echo "usage: rockboxdev.sh [options]"
|
|
|
|
echo "options:"
|
|
|
|
echo " --help Display this help"
|
|
|
|
echo " --target=LIST List of targets to build"
|
|
|
|
echo " --restart=STEP Restart build at given STEP (same as RESTART env var)"
|
|
|
|
echo " --prefix=PREFIX Set install prefix (same as RBDEV_PREFIX env var)"
|
|
|
|
echo " --dlwhere=DIR Set download directory (same as RBDEV_DOWNLOAD env var)"
|
|
|
|
echo " --builddir=DIR Set build directory (same as RBDEV_BUILD env var)"
|
|
|
|
echo " --makeflags=FLAGS Set make flags (same as MAKEFLAGS env var)"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
##############################################################################
|
|
|
|
# Code:
|
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
# Parse arguments
|
|
|
|
for i in "$@"
|
|
|
|
do
|
|
|
|
case $i in
|
|
|
|
--help)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
--prefix=*)
|
|
|
|
prefix="${i#*=}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--target=*)
|
|
|
|
RBDEV_TARGET="${i#*=}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--restart=*)
|
|
|
|
RBDEV_RESTART="${i#*=}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--dlwhere=*)
|
|
|
|
dlwhere="${i#*=}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--builddir=*)
|
|
|
|
builddir="${i#*=}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--makeflags=*)
|
|
|
|
export MAKEFLAGS="${i#*=}" # export so it's available in make
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option '$i'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Verify required tools and libraries
|
2010-06-05 23:05:07 +00:00
|
|
|
for t in $reqtools; do
|
|
|
|
tool=`findtool $t`
|
|
|
|
if test -z "$tool"; then
|
|
|
|
echo "ROCKBOXDEV: \"$t\" is required for this script to work."
|
2017-02-23 10:37:50 +00:00
|
|
|
missingtools="yes"
|
2010-03-08 14:49:10 +00:00
|
|
|
fi
|
2010-06-05 23:05:07 +00:00
|
|
|
done
|
2017-02-23 10:37:50 +00:00
|
|
|
if [ -n "$missingtools" ]; then
|
|
|
|
echo "ROCKBOXDEV: Please install the missing tools and re-run the script."
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-06-05 23:05:07 +00:00
|
|
|
|
2021-01-31 09:11:23 +00:00
|
|
|
dlwhere=$(readlink -f "$dlwhere")
|
|
|
|
prefix=$(readlink -f "$prefix")
|
|
|
|
builddir=$(readlink -f "$builddir")
|
|
|
|
|
2021-01-29 17:46:37 +00:00
|
|
|
echo "Download directory : $dlwhere (set RBDEV_DOWNLOAD or use --dlwhere= to change)"
|
2017-02-23 10:37:50 +00:00
|
|
|
echo "Install prefix : $prefix (set RBDEV_PREFIX or use --prefix= to change)"
|
|
|
|
echo "Build dir : $builddir (set RBDEV_BUILD or use --builddir= to change)"
|
|
|
|
echo "Make options : $MAKEFLAGS (set MAKEFLAGS or use --makeflags= to change)"
|
|
|
|
echo "Restart step : $RBDEV_RESTART (set RBDEV_RESTART or use --restart= to change)"
|
2021-01-29 17:46:37 +00:00
|
|
|
echo "Target arch : $RBDEV_TARGET (set RBDEV_TARGET or use --target= to change)"
|
2010-06-05 23:05:07 +00:00
|
|
|
|
|
|
|
# Verify download directory
|
|
|
|
if test -d "$dlwhere"; then
|
|
|
|
if ! test -w "$dlwhere"; then
|
|
|
|
echo "ROCKBOXDEV: No write permission for $dlwhere"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
mkdir $dlwhere
|
|
|
|
if test $? -ne 0; then
|
|
|
|
echo "ROCKBOXDEV: Failed creating directory $dlwhere"
|
|
|
|
exit
|
|
|
|
fi
|
2006-05-25 23:44:51 +00:00
|
|
|
fi
|
|
|
|
|
2011-12-23 13:49:43 +00:00
|
|
|
|
2010-06-05 23:05:07 +00:00
|
|
|
# Verify the prefix dir
|
|
|
|
if test ! -d $prefix; then
|
|
|
|
mkdir -p $prefix
|
|
|
|
if test $? -ne 0; then
|
|
|
|
echo "ROCKBOXDEV: Failed creating directory $prefix"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test ! -w $prefix; then
|
|
|
|
echo "ROCKBOXDEV: No write permission for $prefix"
|
|
|
|
exit
|
|
|
|
fi
|
2006-05-30 08:38:02 +00:00
|
|
|
|
2017-02-23 10:37:50 +00:00
|
|
|
if [ -z "$RBDEV_TARGET" ]; then
|
|
|
|
echo "Select target arch:"
|
|
|
|
echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)"
|
|
|
|
echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)"
|
2018-06-28 10:24:26 +00:00
|
|
|
echo "i - mips (Jz47xx and ATJ-based players)"
|
2017-02-23 10:37:50 +00:00
|
|
|
echo "x - arm-linux (Generic Linux ARM: Samsung ypr0, Linux-based Sony NWZ)"
|
2020-10-29 15:45:17 +00:00
|
|
|
echo "y - mips-linux (Generic Linux MIPS: eg the many HiBy-OS targets)"
|
2017-02-23 10:37:50 +00:00
|
|
|
echo "separate multiple targets with spaces"
|
2020-03-27 19:31:30 +00:00
|
|
|
echo "(Example: \"m a i\" will build m68k, arm, and mips)"
|
2017-02-23 10:37:50 +00:00
|
|
|
echo ""
|
|
|
|
selarch=`input`
|
|
|
|
else
|
|
|
|
selarch=$RBDEV_TARGET
|
|
|
|
fi
|
2010-06-05 23:05:07 +00:00
|
|
|
system=`uname -s`
|
|
|
|
|
|
|
|
# add target dir to path to ensure the new binutils are used in gcc build
|
|
|
|
PATH="$prefix/bin:${PATH}"
|
2006-05-30 08:38:02 +00:00
|
|
|
|
2008-09-07 22:01:29 +00:00
|
|
|
for arch in $selarch
|
|
|
|
do
|
2020-07-13 02:24:32 +00:00
|
|
|
export MAKEFLAGS=`echo $MAKEFLAGS| sed 's/ -r / /'` # We don't want -r
|
2010-06-05 23:05:07 +00:00
|
|
|
echo ""
|
|
|
|
case $arch in
|
|
|
|
[Ii])
|
2020-03-27 19:31:30 +00:00
|
|
|
build "binutils" "mipsel-elf" "2.26.1" "" "--disable-werror" "isl"
|
|
|
|
build "gcc" "mipsel-elf" "4.9.4" "" "" "gmp mpfr mpc isl"
|
2010-06-05 23:05:07 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
[Mm])
|
2020-03-27 19:31:30 +00:00
|
|
|
build "binutils" "m68k-elf" "2.26.1" "" "--disable-werror" "isl"
|
|
|
|
build "gcc" "m68k-elf" "4.9.4" "" "--with-arch=cf MAKEINFO=missing" "gmp mpfr mpc isl"
|
2010-06-05 23:05:07 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
[Aa])
|
2010-09-27 20:42:30 +00:00
|
|
|
binopts=""
|
|
|
|
gccopts=""
|
|
|
|
case $system in
|
|
|
|
Darwin)
|
2011-05-27 15:13:29 +00:00
|
|
|
binopts="--disable-nls"
|
2010-09-27 20:42:30 +00:00
|
|
|
gccopts="--disable-nls"
|
|
|
|
;;
|
|
|
|
esac
|
2020-03-27 19:31:30 +00:00
|
|
|
build "binutils" "arm-elf-eabi" "2.26.1" "" "$binopts --disable-werror" "isl"
|
|
|
|
build "gcc" "arm-elf-eabi" "4.9.4" "rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.9.4.diff" "$gccopts MAKEINFO=missing" "gmp mpfr mpc isl"
|
2010-06-05 23:05:07 +00:00
|
|
|
;;
|
2017-02-23 10:37:50 +00:00
|
|
|
[Xx])
|
|
|
|
# IMPORTANT NOTE
|
|
|
|
# This toolchain must support several targets and thus must support
|
|
|
|
# the oldest possible configuration.
|
|
|
|
#
|
|
|
|
# Samsung YP-R0/R1:
|
|
|
|
# ARM1176JZF-S, softfp EABI
|
|
|
|
# gcc: 4.9.4 is the latest 4.9.x stable branch, also the only one that
|
|
|
|
# compiles with GCC >6
|
|
|
|
# kernel: 2.6.27.59 is the same 2.6.x stable kernel as used by the
|
|
|
|
# original ct-ng toolchain, the device runs kernel 2.6.24
|
|
|
|
# glibc: 2.19 is the latest version that supports kernel 2.6.24 which
|
|
|
|
# is used on the device, but we need to support ABI 2.4 because
|
|
|
|
# the device uses glibc 2.4.2
|
|
|
|
#
|
|
|
|
# Sony NWZ:
|
|
|
|
# gcc: 4.9.4 is the latest 4.9.x stable branch, also the only one that
|
|
|
|
# compiles with GCC >6
|
|
|
|
# kernel: 2.6.32.68 is the latest 2.6.x stable kernel, the device
|
|
|
|
# runs kernel 2.6.23 or 2.6.35 or 3.x for the most recent
|
|
|
|
# glibc: 2.19 is the latest version that supports kernel 2.6.23 which
|
|
|
|
# is used on many Sony players, but we need to support ABI 2.7
|
|
|
|
# because the device uses glibc 2.7
|
|
|
|
#
|
|
|
|
# Thus the lowest common denominator is to use the latest 2.6.x stable
|
|
|
|
# kernel but compile glibc to support kernel 2.6.23 and glibc 2.4.
|
|
|
|
# We use a recent 2.26.1 binutils to avoid any build problems and
|
|
|
|
# avoid patches/bugs.
|
|
|
|
glibcopts="--enable-kernel=2.6.23 --enable-oldest-abi=2.4"
|
|
|
|
build_linux_toolchain "arm-rockbox-linux-gnueabi" "2.26.1" "" "4.9.4" \
|
|
|
|
"$gccopts" "2.6.32.68" "2.19" "$glibcopts"
|
|
|
|
# build alsa-lib
|
|
|
|
# we need to set the prefix to how it is on device (/usr) and then
|
|
|
|
# tweak install dir at make install step
|
|
|
|
alsalib_ver="1.0.19"
|
|
|
|
gettool "alsa-lib" "$alsalib_ver"
|
|
|
|
extract "alsa-lib-$alsalib_ver"
|
|
|
|
prefix="/usr" buildtool "alsa-lib" "$alsalib_ver" \
|
|
|
|
"--host=$target --disable-python" "" "install DESTDIR=$prefix/$target/sysroot"
|
|
|
|
;;
|
2020-07-13 02:24:32 +00:00
|
|
|
[Yy])
|
2017-02-23 11:16:32 +00:00
|
|
|
# IMPORTANT NOTE
|
|
|
|
# This toolchain must support several targets and thus must support
|
|
|
|
# the oldest possible configuration.
|
|
|
|
#
|
|
|
|
# AGPTek Rocker:
|
|
|
|
# XBurst release 1 (something inbetween mips32r1 and mips32r2)
|
|
|
|
# gcc: 4.9.4 is the latest 4.9.x stable branch, also the only one that
|
|
|
|
# compiles with GCC >6
|
|
|
|
# kernel: 3.10.14
|
|
|
|
# glibc: 2.16
|
2020-03-27 19:31:30 +00:00
|
|
|
# alsa: 1.0.29
|
|
|
|
#
|
2021-02-27 22:07:37 +00:00
|
|
|
# FiiO M3K Linux:
|
2020-03-27 19:31:30 +00:00
|
|
|
# kernel: 3.10.14
|
|
|
|
# glibc: 2.16
|
|
|
|
# alsa: 1.0.26
|
2017-02-23 11:16:32 +00:00
|
|
|
#
|
|
|
|
# To maximize compatibility, we use kernel 3.2.85 which is the lastest
|
|
|
|
# longterm 3.2 kernel and is supported by the latest glibc, and we
|
2020-03-27 19:31:30 +00:00
|
|
|
# require support for up to glibc 2.16
|
2017-02-23 11:16:32 +00:00
|
|
|
# We use a recent 2.26.1 binutils to avoid any build problems and
|
|
|
|
# avoid patches/bugs.
|
2020-03-27 19:31:30 +00:00
|
|
|
glibcopts="--enable-kernel=3.2 --enable-oldest-abi=2.16"
|
2017-02-23 11:16:32 +00:00
|
|
|
# FIXME: maybe add -mhard-float
|
2018-02-22 08:49:37 +00:00
|
|
|
build_linux_toolchain "mipsel-rockbox-linux-gnu" "2.26.1" "" "4.9.4" \
|
2017-02-23 11:16:32 +00:00
|
|
|
"$gccopts" "3.2.85" "2.25" "$glibcopts"
|
|
|
|
# build alsa-lib
|
|
|
|
# we need to set the prefix to how it is on device (/usr) and then
|
|
|
|
# tweak install dir at make install step
|
2020-03-27 19:31:30 +00:00
|
|
|
alsalib_ver="1.0.26"
|
2017-02-23 11:16:32 +00:00
|
|
|
gettool "alsa-lib" "$alsalib_ver"
|
|
|
|
extract "alsa-lib-$alsalib_ver"
|
|
|
|
prefix="/usr" buildtool "alsa-lib" "$alsalib_ver" \
|
|
|
|
"--host=$target --disable-python" "" "install DESTDIR=$prefix/$target/sysroot"
|
2020-10-29 15:45:17 +00:00
|
|
|
# build libffi
|
|
|
|
libffi_ver="3.2.1"
|
|
|
|
gettool "libffi" "$libffi_ver"
|
|
|
|
extract "libffi-$libffi_ver"
|
|
|
|
prefix="/usr" buildtool "libffi" "$libffi_ver" \
|
|
|
|
"--includedir=/usr/include --host=$target" "" "install DESTDIR=$prefix/$target/sysroot"
|
|
|
|
(cd $prefix/$target/sysroot/usr/include ; ln -s ../lib/libffi-$libffi_ver/include/ffi.h . ; ln -s ../lib/libffi-$libffi_ver/include/ffitarget.h . )
|
|
|
|
|
|
|
|
# build zlib
|
|
|
|
zlib_ver="1.2.11"
|
|
|
|
gettool "zlib" "$zlib_ver"
|
|
|
|
extract "zlib-$zlib_ver"
|
|
|
|
CHOST=$target prefix="/usr" buildtool "zlib" "$zlib_ver" \
|
|
|
|
"" "" "install DESTDIR=$prefix/$target/sysroot"
|
|
|
|
|
|
|
|
# build glib
|
|
|
|
glib_ver="2.46.2"
|
|
|
|
gettool "glib" "$glib_ver"
|
|
|
|
extract "glib-$glib_ver"
|
|
|
|
prefix="/usr" buildtool "glib" "$glib_ver" \
|
|
|
|
"--host=$target --disable-libelf glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes" "" "install DESTDIR=$prefix/$target/sysroot"
|
|
|
|
|
|
|
|
# build expat
|
|
|
|
expat_ver="2.1.0"
|
|
|
|
gettool "expat" "$expat_ver"
|
|
|
|
extract "expat-$expat_ver"
|
|
|
|
prefix="/usr" buildtool "expat" "$expat_ver" \
|
|
|
|
"--host=$target --includedir=/usr/include --enable-abstract-sockets" "" "install DESTDIR=$prefix/$target/sysroot "
|
|
|
|
|
|
|
|
# build dbus
|
|
|
|
dbus_ver="1.10.2"
|
|
|
|
gettool "dbus" "$dbus_ver"
|
|
|
|
extract "dbus-$dbus_ver"
|
|
|
|
prefix="/usr" buildtool "dbus" "$dbus_ver" \
|
|
|
|
"--host=$target --includedir=/usr/include --enable-abstract-sockets ac_cv_lib_expat_XML_ParserCreate_MM=yes --disable-systemd --disable-launchd --enable-x11-autolaunch=no --with-x=no -disable-selinux --disable-apparmor --disable-doxygen-docs " "" "install DESTDIR=$prefix/$target/sysroot "
|
|
|
|
|
|
|
|
|
2017-02-23 11:16:32 +00:00
|
|
|
;;
|
2010-06-05 23:05:07 +00:00
|
|
|
*)
|
|
|
|
echo "ROCKBOXDEV: Unsupported architecture option: $arch"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2006-05-15 13:26:59 +00:00
|
|
|
|
2008-08-01 11:19:29 +00:00
|
|
|
echo ""
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: Done!"
|
2006-05-29 22:23:00 +00:00
|
|
|
echo ""
|
2010-06-05 23:05:07 +00:00
|
|
|
echo "ROCKBOXDEV: Make sure your PATH includes $prefix/bin"
|
2009-04-10 15:35:24 +00:00
|
|
|
echo ""
|