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