kumquat-buildroot/package/flex/flex.mk
Adrian Perez de Castro c128c5f3c7 flex: Fix segfault of stage1flex when host has glibc 2.26 or newer
When the host uses glibc 2.26 or newer, Flex will try to use the
newly-introduced reallocarray() function, but as it would not define
_GNU_SOURCE a segmentation fault would occur later on due to the
compiler assumming that the function is implicitly defined.

This issue manifests itself due to a crash of "stage1flex" during the
Flex bootstrap:

  ./stage1flex   -o stage1scan.c ./scan.l
  make[2]: *** [Makefile:1725: stage1scan.c] Segmentation fault (core dumped)

This imports the patch from the upstream Git repository, and adds flags
in the .mk file to rebuild the Autotools scripts and support files. Due
to the latter, the patch to disable the documentation is changed so it
modifies the .am file instead.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
[Arnout:
 - Add Adrian's Sob and upstream ref to new patch;
 - Keep patch 1 as patch 1;
 - Keep Vicente as author of path 1;
 - Add reason for autoreconf in a comment.]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-09-27 23:28:35 +02:00

36 lines
1.0 KiB
Makefile

################################################################################
#
# flex
#
################################################################################
FLEX_VERSION = 2.6.4
FLEX_SITE = https://github.com/westes/flex/files/981163
FLEX_INSTALL_STAGING = YES
FLEX_LICENSE = FLEX
FLEX_LICENSE_FILES = COPYING
FLEX_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES) host-m4
# 0001-flex-disable-documentation.patch
# 0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch
FLEX_AUTORECONF = YES
FLEX_GETTEXTIZE = YES
FLEX_CONF_ENV = ac_cv_path_M4=/usr/bin/m4 \
ac_cv_func_reallocarray=no
HOST_FLEX_DEPENDENCIES = host-m4
define FLEX_DISABLE_PROGRAM
$(SED) 's/^bin_PROGRAMS.*//' $(@D)/src/Makefile.in
endef
FLEX_POST_PATCH_HOOKS += FLEX_DISABLE_PROGRAM
# flex++ symlink is broken when flex binary is not installed
define FLEX_REMOVE_BROKEN_SYMLINK
rm -f $(TARGET_DIR)/usr/bin/flex++
endef
FLEX_POST_INSTALL_TARGET_HOOKS += FLEX_REMOVE_BROKEN_SYMLINK
$(eval $(autotools-package))
$(eval $(host-autotools-package))