command-not-found: Update package list
[termux-packages] / packages / gcc / build.sh
CommitLineData
59f0d218
FF
1TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/
2TERMUX_PKG_DESCRIPTION="GNU C compiler"
98cc1d7b
FF
3TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl"
4TERMUX_PKG_VERSION=5.3.0
59f0d218
FF
5TERMUX_PKG_SRCURL=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-${TERMUX_PKG_VERSION}/gcc-${TERMUX_PKG_VERSION}.tar.bz2
6TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-languages=c,c++ --with-system-zlib --disable-multilib --disable-lto"
98cc1d7b 7TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --target=$TERMUX_HOST_PLATFORM"
59f0d218
FF
8TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-gmp=$TERMUX_PREFIX --with-mpfr=$TERMUX_PREFIX --with-mpc=$TERMUX_PREFIX"
9# To build gcc as a PIE binary:
10TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-stage1-ldflags=\"-specs=$TERMUX_SCRIPTDIR/termux.spec\""
98cc1d7b
FF
11# TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-isl-include=$TERMUX_PREFIX/include --with-isl-lib=$TERMUX_PREFIX/lib"
12TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-isl-version-check"
13
14# TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --without-headers --with-local-prefix=$TERMUX_PREFIX/include" # FIXME: gcc5 trying
59f0d218
FF
15if [ "$TERMUX_ARCH" = "arm" ]; then
16 TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv7-a --with-fpu=neon --with-float=hard"
98cc1d7b
FF
17elif [ "$TERMUX_ARCH" = "aarch64" ]; then
18 TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv8-a"
59f0d218
FF
19elif [ "$TERMUX_ARCH" = "i686" ]; then
20 # -mstackrealign -msse3 -m32
21 TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=i686 --with-tune=atom --with-fpmath=sse"
22fi
98cc1d7b 23TERMUX_PKG_RM_AFTER_INSTALL="bin/gcc-ar bin/gcc-ranlib bin/c++ bin/gcc-nm bin/*-linux-* 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"
59f0d218
FF
24
25export AR_FOR_TARGET="$AR"
26export AS_FOR_TARGET="$AS"
27export CC_FOR_TARGET="$CC"
28export CFLAGS_FOR_TARGET="$CFLAGS"
29export CPP_FOR_TARGET="$CPP"
30export CPPFLAGS_FOR_TARGET="$CPPFLAGS"
31export CXXFLAGS_FOR_TARGET="$CXXFLAGS"
32export CXX_FOR_TARGET="$CXX"
33export LDFLAGS_FOR_TARGET="$LDFLAGS"
34export LD_FOR_TARGET="$LD"
35export PKG_CONFIG_FOR_TARGET="$PKG_CONFIG"
36export RANLIB_FOR_TARGET="$RANLIB"
37
38unset AR
39unset AS
40unset CC
41unset CFLAGS
42unset CPP
43unset CPPFLAGS
44unset CXXFLAGS
45unset CXX
46unset LDFLAGS
47unset LD
48unset PKG_CONFIG
49unset RANLIB
50
51termux_step_make () {
52 make -j $TERMUX_MAKE_PROCESSES all-gcc
59f0d218
FF
53}
54
55termux_step_make_install () {
98cc1d7b 56 make install-gcc
59f0d218
FF
57}
58
59termux_step_post_make_install () {
59f0d218 60 # Android 5.0 only supports PIE binaries, so build that by default with a specs file:
4d685cb6
FF
61 local GCC_SPECS=$TERMUX_PREFIX/lib/gcc/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_VERSION/specs
62 cp $TERMUX_SCRIPTDIR/termux.spec $GCC_SPECS
63
64 if [ $TERMUX_ARCH = "i686" ]; then
65 # See https://github.com/termux/termux-packages/issues/3
66 # and https://github.com/termux/termux-packages/issues/14
67 cat >> $GCC_SPECS <<HERE
68
69*link_emulation:
70elf_i386
71
72*dynamic_linker:
73/system/bin/linker
74HERE
75 fi
59f0d218 76}