-termux_step_extract_into_massagedir () {
- mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/
- LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_ARCH}-linux-android/lib/libgnustl_shared.so
- if [ $TERMUX_ARCH = arm ]; then
- LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/arm-linux-androideabi/lib/armv7-a/hard/libgnustl_shared.so
- fi
- cp $LIBFILE $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/
+termux_step_post_massage () {
+ # We take the library here after massage step to
+ # avoid stripping the library after running termux-elf-cleaner,
+ # which causes a broken library (program compiled on the
+ # device linking to the library will segfault, at least on aarch64).
+ mkdir lib
+ cp $TERMUX_PREFIX/lib/libgnustl_shared.so lib/