From 84c912475061cca501a05471cf452d5292e09621 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 31 May 2019 21:21:52 +0200 Subject: [PATCH] grep: don't use _FORTIFY_SOURCE=2 for debug builds --- packages/grep/build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/grep/build.sh b/packages/grep/build.sh index 218b48677..0b4a67f39 100644 --- a/packages/grep/build.sh +++ b/packages/grep/build.sh @@ -6,3 +6,16 @@ TERMUX_PKG_VERSION=3.3 TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/grep/grep-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=b960541c499619efd6afe1fa795402e4733c8e11ebf9fafccc0bb4bccdc5b514 + +termux_step_pre_configure() { + if [ "$TERMUX_DEBUG" == "true" ]; then + # When doing debug build, -D_FORTIFY_SOURCE=2 gives this error: + # /home/builder/.termux-build/_cache/19b-aarch64-24-v5/bin/../sysroot/usr/include/bits/fortify/stdio.h:51:53: error: use of undeclared identifier '__USE_FORTIFY_LEVEL' + # return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap); + # ^ + # lib/cdefs.h:123:48: note: expanded from macro '__bos' + # #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) + # ^ + export CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} + fi +}