Skip to content

Commit

Permalink
Mention the new supported target
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartatz committed May 30, 2024
1 parent 9de12a5 commit d98ba2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 58 deletions.
70 changes: 13 additions & 57 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ declare -r binutils_directory='/tmp/binutils-2.42'
declare -r gcc_tarball='/tmp/gcc.tar.gz'
declare -r gcc_directory='/tmp/gcc-14.1.0'

declare -r sysroot_tarball='/tmp/sysroot.tar.xz'

declare -r optflags='-Os'
declare -r linkflags='-Wl,-s'

Expand Down Expand Up @@ -149,65 +151,19 @@ for target in "${targets[@]}"; do

cd "$(mktemp --directory)"

if [ "${os}" == 'void' ] || [ "${os}" == 'sabotage' ]; then
declare sysroot_filename="./sysroot.tar.xz"
else
declare sysroot_filename="./sysroot.tar.gz"
fi

curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --output "${sysroot_filename}" --url "${sysroot}"

tar --ignore-failed-read --extract --file="${sysroot_filename}" || true

if [ "${os}" == 'void' ]; then
declare package_filename="./package.tar.xst"
else
declare package_filename="./package.tar.gz"
fi

for package in "${packages[@]}"; do
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --output "${package_filename}" --url "${package}"
tar --extract --file="${package_filename}"
done

[ -d "${toolchain_directory}/${triplet}" ] || mkdir --parent "${toolchain_directory}/${triplet}"

if [ "${os}" == 'sabotage' ]; then
cp --recursive './opt/musl/include' "${toolchain_directory}/${triplet}"
cp --recursive './opt/musl/lib' "${toolchain_directory}/${triplet}"
else
cp --recursive './usr/include' "${toolchain_directory}/${triplet}"
cp --recursive './usr/lib' "${toolchain_directory}/${triplet}"
fi

if [ "${os}" != 'sabotage' ] && [ -d './lib' ]; then
cp --remove-destination --recursive './lib/'* "${toolchain_directory}/${triplet}/lib"
fi

pushd "${toolchain_directory}/${triplet}/lib"

if [ "${os}" == 'alpine' ]; then
find . -xtype l | xargs ls -l | grep '/lib/' | awk '{print "unlink "$9" && ln -s $(basename "$11") $(basename "$9")"}' | bash

unlink './libc.so'
mv "${ld}" './libc.so'

patchelf --set-soname 'libc.so' './libc.so'
fi

if [ -L "${ld}" ]; then
unlink "${ld}"
fi
curl \
--url "https://github.com/AmanoTeam/musl-sysroot/releases/latest/download/${triplet}.tar.xz" \
--retry '30' \
--retry-all-errors \
--retry-delay '0' \
--retry-max-time '0' \
--location \
--continue-at '-' \
--output "${sysroot_tarball}"

ln --symbolic './libc.so' "${ld}"
tar --directory="${toolchain_directory}" --extract --file="${sysroot_tarball}"

while read filename; do
if [[ "${filename}" =~ ^lib(pthread|resolv|rt|c|m|util|xnet)\.(so|a)$ || "${filename}" =~ ^.*\.o$ || "${filename}" =~ ^ld\-.*\.so.*$ ]]; then
continue
fi

rm --recursive "${filename}"
done <<< "$(ls)"
unlink "${sysroot_tarball}"

[ -d "${binutils_directory}/build" ] || mkdir "${binutils_directory}/build"

Expand Down
2 changes: 1 addition & 1 deletion powerpc-unknown-linux-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare packages=()

declare extra_configure_flags='--disable-decimal-float --without-long-double-128 gcc_cv_target_ldbl128=no libgcc_cv_powerpc_float128=no'
declare extra_configure_flags='--disable-decimal-float gcc_cv_target_ldbl128=no' # --without-long-double-128 libgcc_cv_powerpc_float128=no'

declare triplet='powerpc-unknown-linux-musl'

Expand Down

0 comments on commit d98ba2e

Please sign in to comment.