2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/
|
|
|
|
TERMUX_PKG_DESCRIPTION="GNU C compiler"
|
2016-04-29 13:47:38 +02:00
|
|
|
TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl, libgnustl"
|
|
|
|
TERMUX_PKG_VERSION=6.1.0
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_SRCURL=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-${TERMUX_PKG_VERSION}/gcc-${TERMUX_PKG_VERSION}.tar.bz2
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-languages=c,c++ --with-system-zlib --disable-multilib --disable-lto"
|
2016-03-20 23:59:41 +01:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --target=$TERMUX_HOST_PLATFORM"
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-gmp=$TERMUX_PREFIX --with-mpfr=$TERMUX_PREFIX --with-mpc=$TERMUX_PREFIX"
|
|
|
|
# To build gcc as a PIE binary:
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-stage1-ldflags=\"-specs=$TERMUX_SCRIPTDIR/termux.spec\""
|
2016-04-18 20:58:44 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-isl-include=$TERMUX_PREFIX/include --with-isl-lib=$TERMUX_PREFIX/lib"
|
2016-03-20 23:59:41 +01:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-isl-version-check"
|
2016-04-18 20:58:44 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-tls"
|
2016-04-29 13:47:38 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-host-shared"
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-default-pie"
|
2016-03-20 23:59:41 +01:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
if [ "$TERMUX_ARCH" = "arm" ]; then
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv7-a --with-fpu=neon --with-float=hard"
|
2016-03-20 23:59:41 +01:00
|
|
|
elif [ "$TERMUX_ARCH" = "aarch64" ]; then
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv8-a"
|
2015-06-13 01:03:31 +02:00
|
|
|
elif [ "$TERMUX_ARCH" = "i686" ]; then
|
|
|
|
# -mstackrealign -msse3 -m32
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=i686 --with-tune=atom --with-fpmath=sse"
|
|
|
|
fi
|
2016-03-24 23:38:13 +01:00
|
|
|
TERMUX_PKG_RM_AFTER_INSTALL="bin/gcc-ar bin/gcc-ranlib bin/*c++ bin/gcc-nm lib/gcc/*-linux-*/${TERMUX_PKG_VERSION}/plugin lib/gcc/*-linux-*/${TERMUX_PKG_VERSION}/include-fixed lib/gcc/*-linux-*/$TERMUX_PKG_VERSION/install-tools libexec/gcc/*-linux-*/${TERMUX_PKG_VERSION}/plugin libexec/gcc/*-linux-*/${TERMUX_PKG_VERSION}/install-tools share/man/man7"
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
export AR_FOR_TARGET="$AR"
|
|
|
|
export AS_FOR_TARGET="$AS"
|
|
|
|
export CC_FOR_TARGET="$CC"
|
|
|
|
export CFLAGS_FOR_TARGET="$CFLAGS"
|
|
|
|
export CPP_FOR_TARGET="$CPP"
|
|
|
|
export CPPFLAGS_FOR_TARGET="$CPPFLAGS"
|
|
|
|
export CXXFLAGS_FOR_TARGET="$CXXFLAGS"
|
|
|
|
export CXX_FOR_TARGET="$CXX"
|
|
|
|
export LDFLAGS_FOR_TARGET="$LDFLAGS"
|
|
|
|
export LD_FOR_TARGET="$LD"
|
|
|
|
export PKG_CONFIG_FOR_TARGET="$PKG_CONFIG"
|
|
|
|
export RANLIB_FOR_TARGET="$RANLIB"
|
|
|
|
|
|
|
|
unset AR
|
|
|
|
unset AS
|
|
|
|
unset CC
|
|
|
|
unset CFLAGS
|
|
|
|
unset CPP
|
|
|
|
unset CPPFLAGS
|
|
|
|
unset CXXFLAGS
|
|
|
|
unset CXX
|
|
|
|
unset LDFLAGS
|
|
|
|
unset LD
|
|
|
|
unset PKG_CONFIG
|
|
|
|
unset RANLIB
|
|
|
|
|
|
|
|
termux_step_make () {
|
|
|
|
make -j $TERMUX_MAKE_PROCESSES all-gcc
|
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_make_install () {
|
2016-03-20 23:59:41 +01:00
|
|
|
make install-gcc
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_post_make_install () {
|
|
|
|
# Android 5.0 only supports PIE binaries, so build that by default with a specs file:
|
2015-09-29 10:14:50 +02:00
|
|
|
local GCC_SPECS=$TERMUX_PREFIX/lib/gcc/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_VERSION/specs
|
|
|
|
cp $TERMUX_SCRIPTDIR/termux.spec $GCC_SPECS
|
|
|
|
|
|
|
|
if [ $TERMUX_ARCH = "i686" ]; then
|
|
|
|
# See https://github.com/termux/termux-packages/issues/3
|
|
|
|
# and https://github.com/termux/termux-packages/issues/14
|
|
|
|
cat >> $GCC_SPECS <<HERE
|
|
|
|
|
|
|
|
*link_emulation:
|
|
|
|
elf_i386
|
|
|
|
|
|
|
|
*dynamic_linker:
|
|
|
|
/system/bin/linker
|
|
|
|
HERE
|
|
|
|
fi
|
2016-03-24 23:38:13 +01:00
|
|
|
|
|
|
|
# Replace hardlinks with symlinks:
|
|
|
|
cd $TERMUX_PREFIX/bin
|
|
|
|
rm ${TERMUX_HOST_PLATFORM}-g++; ln -s g++ ${TERMUX_HOST_PLATFORM}-g++
|
|
|
|
rm ${TERMUX_HOST_PLATFORM}-gcc; ln -s gcc ${TERMUX_HOST_PLATFORM}-gcc
|
|
|
|
rm ${TERMUX_HOST_PLATFORM}-gcc-${TERMUX_PKG_VERSION}; ln -s gcc ${TERMUX_HOST_PLATFORM}-gcc-${TERMUX_PKG_VERSION}
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|