Compare commits

...

4 Commits

1 changed files with 22 additions and 2 deletions

View File

@ -71,10 +71,31 @@ mkdir -p sh3eb-elf/bin
ln -sf $(command -v sh-elf-as) sh3eb-elf/bin/as
ln -sf $(command -v sh-elf-ld) sh3eb-elf/bin/ld
ln -sf $(command -v sh-elf-ar) sh3eb-elf/bin/ar
ln -sf $(command -v sh-elf-nm) sh3eb-elf/bin/nm
ln -sf $(command -v sh-elf-ranlib) sh3eb-elf/bin/ranlib
cd build
echo "$TAG Configuring gcc..."
if command -v termux-setup-storage >/dev/null 2>&1; then
# Android 5.0 and later only support position-independent executables (-fPIE)
sed -i -e's/NO_PIE_FLAG="-no-pie"/NO_PIE_FLAG="-pie"/g' -e's/NO_PIE_CFLAGS="-fno-PIE"/NO_PIE_CFLAGS="-fPIC"/g' ../gcc-$VERSION/gcc/configure
# 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
# OpenBSD apparently installs these in /usr/local
if [[ $(uname) == "OpenBSD" ]]; then
extra_args="--with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local"
@ -82,6 +103,5 @@ else
extra_args=
fi
echo "$TAG Configuring gcc..."
run_quietly giteapc-configure.log \
run_quietly giteapc-configure.log \
../gcc-$VERSION/configure --prefix="$PREFIX" --target=sh3eb-elf --with-multilib-list=m3,m4-nofpu --enable-languages=c,c++ --without-headers --with-newlib --program-prefix=sh-elf- --enable-libssp --enable-lto $extra_args