termux-packages/packages/libandroid-spawn/build.sh
Henrik Grimler b782c7da0e toolchain: add -fPIC to CPPFLAGS for i686
When adding this, we go from compiling with

  /home/builder/.termux-build/_cache/android-r21d-api-24-v4/bin/clang++ [...] -mrelocation-model pic -pic-level 2 -pic-is-pie [...]

to

  /home/builder/.termux-build/_cache/android-r21d-api-24-v5/bin/clang++ [...] -mrelocation-model pic -pic-level 2 [...]

Before, we got a warning when compiling libandroid-spawn:

  /home/builder/.termux-build/_cache/android-r21d-api-24-v4/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: warning: shared library text segment is not shareable

and trying to use a program linked against libandroid-spawn gave an
error, see
https://github.com/termux/termux-packages/issues/7215#issuecomment-906154438
the Without this, libraries might end up with text relocations. For
some reason it does not seem to be an issue on the other arches.

%ci:no-build
2021-08-27 10:02:20 +02:00

22 lines
869 B
Bash

TERMUX_PKG_HOMEPAGE=https://man7.org/linux/man-pages/man3/posix_spawn.3.html
TERMUX_PKG_DESCRIPTION="Shared library for the posix_spawn system function"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.2
TERMUX_PKG_REVISION=4
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_make() {
$CXX $CFLAGS $CPPFLAGS -I$TERMUX_PKG_BUILDER_DIR -c $TERMUX_PKG_BUILDER_DIR/posix_spawn.cpp
$CXX $LDFLAGS -shared posix_spawn.o -o libandroid-spawn.so
$AR rcu libandroid-spawn.a posix_spawn.o
cp -f $TERMUX_PKG_BUILDER_DIR/LICENSE $TERMUX_PKG_SRCDIR/
}
termux_step_make_install() {
install -Dm600 $TERMUX_PKG_BUILDER_DIR/posix_spawn.h $TERMUX_PREFIX/include/spawn.h
install -Dm600 libandroid-spawn.a $TERMUX_PREFIX/lib/libandroid-spawn.a
install -Dm600 libandroid-spawn.so $TERMUX_PREFIX/lib/libandroid-spawn.so
}