Skip to content

Commit

Permalink
scripts: add termux_setup_gnu_as_23c for NDK r25 (#11615)
Browse files Browse the repository at this point in the history
NDK r25 has removed GNU Assembler (GAS). Removal of GAS introduced a number of build issues.
The most prominent is:
/usr/bin/as: unrecognized option '-EL'

Some options to solve this:
1. Disable building custom assembly and suffer performance penalty
2. Hand rewrite the custom assembly to be LLVM compatible
3. Wait for upstream to write LLVM compatible assembly (openssl, openssl-1.1)
4. Bring back GAS from NDK r23c

In this commit, GAS is brought back as a separate toolchain instead of following NDK r23c file hierarchy.
We pass "--gcc-toolchain=GAS_TOOLCHAIN_DIR" to NDK r25 clang to detect.
Packages only have to add "termux_step_gnu_as_23c" to build.sh to enable GAS.
In the future, we expect packages should follow option 3 more than option 4 as that is a last resort.

This commit also bumps revision for packages that rely (or previously rely) on "-fno-integrated-as":
hors, libffi, libgcrypt, libpixman, openssl, openssl-1.1

Co-authored-by: Henrik Grimler <grimler@termux.dev>
Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 24, 2022
1 parent 6328d8a commit ea37ad9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 3 additions & 1 deletion packages/hors/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ TERMUX_PKG_DESCRIPTION="Instant coding answers via the command line (howdoi in r
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="Krishna Kanhaiya @kcubeterm"
TERMUX_PKG_VERSION=0.8.2
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/WindSoilder/hors/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=22419b26f64a2793759d3a3616df58196897cd9227074f475aeb3e1c366296a9
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_pre_configure() {
if [ $TERMUX_ARCH = arm ]; then
if [ "$TERMUX_ARCH" = arm ]; then
termux_setup_gnu_as_23c
CFLAGS+=" -fno-integrated-as"
fi

Expand Down
4 changes: 3 additions & 1 deletion packages/libffi/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Library providing a portable, high level programming int
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.4.2
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/libffi/libffi/releases/download/v${TERMUX_PKG_VERSION}/libffi-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620
TERMUX_PKG_BREAKS="libffi-dev"
Expand All @@ -11,7 +12,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-multi-os-directory"
TERMUX_PKG_RM_AFTER_INSTALL="lib/libffi-${TERMUX_PKG_VERSION}/include"

termux_step_pre_configure() {
if [ $TERMUX_ARCH = arm ]; then
if [ "$TERMUX_ARCH" = arm ]; then
termux_setup_gnu_as_23c
CFLAGS+=" -fno-integrated-as"
fi
}
Expand Down
8 changes: 5 additions & 3 deletions packages/libgcrypt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="GPL-2.0, LGPL-2.1, BSD 3-Clause, MIT, Public Domain"
TERMUX_PKG_LICENSE_FILE="COPYING, COPYING.LIB, LICENSES"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.10.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=ef14ae546b0084cd84259f61a55e07a38c3b53afc0f546bffcef2f01baffe9de
TERMUX_PKG_DEPENDS="libgpg-error"
Expand All @@ -16,13 +17,14 @@ ac_cv_lib_pthread_pthread_create=yes
"

termux_step_pre_configure() {
CFLAGS+=" -no-integrated-as"
if [ $TERMUX_ARCH = "arm" ]; then
termux_setup_gnu_as_23c
CFLAGS+=" -fno-integrated-as"
if [ "$TERMUX_ARCH" = arm ]; then
# See http://marc.info/?l=gnupg-devel&m=139136972631909&w=3
CFLAGS+=" -mno-unaligned-access"
# Avoid text relocations:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" gcry_cv_gcc_inline_asm_neon=no"
elif [ $TERMUX_ARCH = "i686" ] || [ $TERMUX_ARCH = "x86_64" ]; then
elif [ "$TERMUX_ARCH" = i686 ] || [ "$TERMUX_ARCH" = x86_64 ]; then
# Fix i686 android build, also in https://bugzilla.gnome.org/show_bug.cgi?id=724050
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-asm"
fi
Expand Down
5 changes: 3 additions & 2 deletions packages/libpixman/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ TERMUX_PKG_DESCRIPTION="Low-level library for pixel manipulation"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.40.0
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://cairographics.org/releases/pixman-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc
TERMUX_PKG_BREAKS="libpixman-dev"
TERMUX_PKG_REPLACES="libpixman-dev"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-libpng"

termux_step_pre_configure() {
if [ $TERMUX_ARCH = arm ]; then
if [ "$TERMUX_ARCH" = arm ]; then
termux_setup_gnu_as_23c
CFLAGS+=" -fno-integrated-as"
fi
}
4 changes: 1 addition & 3 deletions packages/openssl-1.1/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="LICENSE"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.1.1o
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.openssl.org/source/openssl-${TERMUX_PKG_VERSION/\~/-}.tar.gz
TERMUX_PKG_SHA256=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f
TERMUX_PKG_DEPENDS="ca-certificates, zlib"
Expand All @@ -27,9 +28,6 @@ termux_step_configure() {
fi

CFLAGS+=" -DNO_SYSLOG"
if [ $TERMUX_ARCH = arm ]; then
CFLAGS+=" -fno-integrated-as"
fi

perl -p -i -e "s@TERMUX_CFLAGS@$CFLAGS@g" Configure
test $TERMUX_ARCH = "arm" && TERMUX_OPENSSL_PLATFORM="android-arm"
Expand Down
4 changes: 1 addition & 3 deletions packages/openssl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Library implementing the SSL and TLS protocols as well a
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.0.3
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.openssl.org/source/openssl-${TERMUX_PKG_VERSION/\~/-}.tar.gz
TERMUX_PKG_SHA256=ee0078adcef1de5f003c62c80cc96527721609c6f3bb42b7795df31f8b558c0b
TERMUX_PKG_DEPENDS="ca-certificates, zlib"
Expand All @@ -21,9 +22,6 @@ termux_step_configure() {
fi

CFLAGS+=" -DNO_SYSLOG"
if [ $TERMUX_ARCH = arm ]; then
ASLAGS+=" -fno-integrated-as"
fi

perl -p -i -e "s@TERMUX_CFLAGS@$CFLAGS@g" Configure
rm -Rf $TERMUX_PREFIX/lib/libcrypto.* $TERMUX_PREFIX/lib/libssl.*
Expand Down

0 comments on commit ea37ad9

Please sign in to comment.