Skip to content

Commit 92955a7

Browse files
author
Daniel Rossier
committed
Re-add toolchains directory (mistaken removal)
1 parent 11bb0aa commit 92955a7

3 files changed

Lines changed: 245 additions & 0 deletions

File tree

toolchains/build-toolchain.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (C) 2025 Jean-Pierre Miceli <jean-pierre.miceli@heig-vd.ch>
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License version 2 as
7+
# published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
#
18+
19+
# This script build 'arm' & 'aarch64' MUSL toolchains
20+
21+
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
22+
23+
# output PATH - select where the toolchain will be installed
24+
#
25+
# The final path will be:
26+
# * arm: <OUTPUT_PATH>/arm-linux-musleabihf
27+
# * aarch64: <OUTPUT_PATH>/aarch64-linux-musl
28+
# default: '<CURRENT DIR>/aarch64-linux-musl' and '<CURRENT DIR>/arm-linux-musleabihf'
29+
#OUTPUT_PATH=
30+
31+
GIT_COMMIT="3635262"
32+
33+
AARCH64_PATH='aarch64-linux-musl'
34+
ARM_PATH='arm-linux-musleabihf'
35+
36+
if [[ $EUID -ne 0 ]]; then
37+
echo "Please run as root"
38+
exit 1
39+
fi
40+
41+
pushd $SCRIPTPATH
42+
43+
if [[ -v $OUTPUT_PATH ]]; then
44+
OUTPUT=$OUTPUT_PATH
45+
else
46+
OUTPUT=$SCRIPTPATH
47+
fi
48+
49+
echo "== base installation path is '$SCRIPTPATH'"
50+
51+
# 1. Retrieve the repo
52+
git clone https://github.com/richfelker/musl-cross-make
53+
cd musl-cross-make
54+
git checkout $GIT_COMMIT
55+
56+
# Compile & install 'aarch64-linux-musl'
57+
echo "== Compiling 'aarch64-linux-musl' (installation path: $OUTPUT/$AARCH64_PATH"
58+
cp ../config.mak.aarch64 config.mak
59+
echo "OUTPUT = $OUTPUT/$AARCH64_PATH" >> config.mak
60+
make && sudo make install
61+
62+
# Compile & install 'arm-linux-musleabihf'
63+
echo "== Compiling 'arm-linux-musleabihf'"
64+
make clean
65+
cp ../config.mak.arm config.mak
66+
echo "OUTPUT = $OUTPUT/$ARM_PATH" >> config.mak
67+
make && sudo make install
68+
69+
popd

toolchains/config.mak.aarch64

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#
2+
# config.mak.dist - sample musl-cross-make configuration
3+
#
4+
# Copy to config.mak and edit as desired.
5+
#
6+
7+
# There is no default TARGET; you must select one here or on the make
8+
# command line. Some examples:
9+
10+
# TARGET = i486-linux-musl
11+
# TARGET = x86_64-linux-musl
12+
# TARGET = arm-linux-musleabi
13+
# TARGET = arm-linux-musleabihf
14+
# TARGET = sh2eb-linux-muslfdpic
15+
# ...
16+
TARGET = aarch64-linux-musl
17+
18+
# By default, cross compilers are installed to ./output under the top-level
19+
# musl-cross-make directory and can later be moved wherever you want them.
20+
# To install directly to a specific location, set it here. Multiple targets
21+
# can safely be installed in the same location. Some examples:
22+
23+
# OUTPUT = /opt/cross
24+
# OUTPUT = /usr/local
25+
26+
# By default, latest supported release versions of musl and the toolchain
27+
# components are used. You can override those here, but the version selected
28+
# must be supported (under hashes/ and patches/) to work. For musl, you
29+
# can use "git-refname" (e.g. git-master) instead of a release. Setting a
30+
# blank version for gmp, mpc, mpfr and isl will suppress download and
31+
# in-tree build of these libraries and instead depend on pre-installed
32+
# libraries when available (isl is optional and not set by default).
33+
# Setting a blank version for linux will suppress installation of kernel
34+
# headers, which are not needed unless compiling programs that use them.
35+
36+
BINUTILS_VER = 2.44
37+
GCC_VER = 12.4.0
38+
# MUSL_VER = git-master
39+
# GMP_VER =
40+
# MPC_VER =
41+
# MPFR_VER =
42+
# ISL_VER =
43+
# LINUX_VER =
44+
45+
# By default source archives are downloaded with wget. curl is also an option.
46+
47+
# DL_CMD = wget -c -O
48+
# DL_CMD = curl -C - -L -o
49+
50+
# Check sha-1 hashes of downloaded source archives. On gnu systems this is
51+
# usually done with sha1sum.
52+
53+
# SHA1_CMD = sha1sum -c
54+
# SHA1_CMD = sha1 -c
55+
# SHA1_CMD = shasum -a 1 -c
56+
57+
# Something like the following can be used to produce a static-linked
58+
# toolchain that's deployable to any system with matching arch, using
59+
# an existing musl-targeted cross compiler. This only works if the
60+
# system you build on can natively (or via binfmt_misc and qemu) run
61+
# binaries produced by the existing toolchain (in this example, i486).
62+
63+
# COMMON_CONFIG += CC="i486-linux-musl-gcc -static --static" CXX="i486-linux-musl-g++ -static --static"
64+
65+
# Recommended options for smaller build for deploying binaries:
66+
67+
COMMON_CONFIG += CFLAGS="-g -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"
68+
69+
# Options you can add for faster/simpler build at the expense of features:
70+
71+
# COMMON_CONFIG += --disable-nls
72+
# GCC_CONFIG += --disable-libquadmath --disable-decimal-float
73+
# GCC_CONFIG += --disable-libitm
74+
# GCC_CONFIG += --disable-fixed-point
75+
# GCC_CONFIG += --disable-lto
76+
77+
# By default C and C++ are the only languages enabled, and these are
78+
# the only ones tested and known to be supported. You can uncomment the
79+
# following and add other languages if you want to try getting them to
80+
# work too.
81+
82+
# GCC_CONFIG += --enable-languages=c,c++
83+
84+
# You can keep the local build path out of your toolchain binaries and
85+
# target libraries with the following, but then gdb needs to be told
86+
# where to look for source files.
87+
88+
# COMMON_CONFIG += --with-debug-prefix-map=$(CURDIR)=

toolchains/config.mak.arm

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#
2+
# config.mak.dist - sample musl-cross-make configuration
3+
#
4+
# Copy to config.mak and edit as desired.
5+
#
6+
7+
# There is no default TARGET; you must select one here or on the make
8+
# command line. Some examples:
9+
10+
# TARGET = i486-linux-musl
11+
# TARGET = x86_64-linux-musl
12+
# TARGET = arm-linux-musleabi
13+
# TARGET = arm-linux-musleabihf
14+
# TARGET = sh2eb-linux-muslfdpic
15+
# ...
16+
TARGET = arm-linux-musleabihf
17+
18+
# By default, cross compilers are installed to ./output under the top-level
19+
# musl-cross-make directory and can later be moved wherever you want them.
20+
# To install directly to a specific location, set it here. Multiple targets
21+
# can safely be installed in the same location. Some examples:
22+
23+
# OUTPUT = /opt/cross
24+
# OUTPUT = /usr/local
25+
26+
# By default, latest supported release versions of musl and the toolchain
27+
# components are used. You can override those here, but the version selected
28+
# must be supported (under hashes/ and patches/) to work. For musl, you
29+
# can use "git-refname" (e.g. git-master) instead of a release. Setting a
30+
# blank version for gmp, mpc, mpfr and isl will suppress download and
31+
# in-tree build of these libraries and instead depend on pre-installed
32+
# libraries when available (isl is optional and not set by default).
33+
# Setting a blank version for linux will suppress installation of kernel
34+
# headers, which are not needed unless compiling programs that use them.
35+
36+
BINUTILS_VER = 2.44
37+
GCC_VER = 12.4.0
38+
# MUSL_VER = git-master
39+
# GMP_VER =
40+
# MPC_VER =
41+
# MPFR_VER =
42+
# ISL_VER =
43+
# LINUX_VER =
44+
45+
# By default source archives are downloaded with wget. curl is also an option.
46+
47+
# DL_CMD = wget -c -O
48+
# DL_CMD = curl -C - -L -o
49+
50+
# Check sha-1 hashes of downloaded source archives. On gnu systems this is
51+
# usually done with sha1sum.
52+
53+
# SHA1_CMD = sha1sum -c
54+
# SHA1_CMD = sha1 -c
55+
# SHA1_CMD = shasum -a 1 -c
56+
57+
# Something like the following can be used to produce a static-linked
58+
# toolchain that's deployable to any system with matching arch, using
59+
# an existing musl-targeted cross compiler. This only works if the
60+
# system you build on can natively (or via binfmt_misc and qemu) run
61+
# binaries produced by the existing toolchain (in this example, i486).
62+
63+
# COMMON_CONFIG += CC="i486-linux-musl-gcc -static --static" CXX="i486-linux-musl-g++ -static --static"
64+
65+
# Recommended options for smaller build for deploying binaries:
66+
67+
COMMON_CONFIG += CFLAGS="-g -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"
68+
69+
# Options you can add for faster/simpler build at the expense of features:
70+
71+
# COMMON_CONFIG += --disable-nls
72+
# GCC_CONFIG += --disable-libquadmath --disable-decimal-float
73+
# GCC_CONFIG += --disable-libitm
74+
# GCC_CONFIG += --disable-fixed-point
75+
# GCC_CONFIG += --disable-lto
76+
77+
# By default C and C++ are the only languages enabled, and these are
78+
# the only ones tested and known to be supported. You can uncomment the
79+
# following and add other languages if you want to try getting them to
80+
# work too.
81+
82+
# GCC_CONFIG += --enable-languages=c,c++
83+
84+
# You can keep the local build path out of your toolchain binaries and
85+
# target libraries with the following, but then gdb needs to be told
86+
# where to look for source files.
87+
88+
# COMMON_CONFIG += --with-debug-prefix-map=$(CURDIR)=

0 commit comments

Comments
 (0)