- if [ $TERMUX_ARCH = "arm" ]; then
- # Note that moving to $TERMUX_PREFIX/lib/gcc/arm-linux-androideabi/${TERMUX_PKG_VERSION}/
- # allows compilation but fails to link at runtime
- mv $TERMUX_PREFIX/lib/armv7-a/hard/libgcc_s* $TERMUX_PREFIX/lib/
+ # Android 5.0 only supports PIE binaries, so build that by default with a specs file:
+ 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